@limetech/lime-elements 37.65.11 → 37.65.13
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/CHANGELOG.md +17 -0
- package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +8 -26
- package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js.map +1 -1
- package/dist/collection/components/date-picker/flatpickr-adapter/flatpickr-adapter.js +7 -26
- package/dist/collection/components/date-picker/flatpickr-adapter/flatpickr-adapter.js.map +1 -1
- package/dist/collection/components/date-picker/pickers/Picker.js +1 -0
- package/dist/collection/components/date-picker/pickers/Picker.js.map +1 -1
- package/dist/esm/limel-flatpickr-adapter.entry.js +8 -26
- package/dist/esm/limel-flatpickr-adapter.entry.js.map +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-9c92c1db.entry.js → p-adfa2c05.entry.js} +3 -3
- package/dist/lime-elements/p-adfa2c05.entry.js.map +1 -0
- package/dist/types/components/date-picker/flatpickr-adapter/flatpickr-adapter.d.ts +0 -2
- package/package.json +3 -3
- package/dist/lime-elements/p-9c92c1db.entry.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## [37.65.13](https://github.com/Lundalogik/lime-elements/compare/v37.65.12...v37.65.13) (2024-11-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
* **flatpickr-adapter:** handle missing `formatter` property ([05a1b06](https://github.com/Lundalogik/lime-elements/commit/05a1b06aefcb4eade4e86221541fb9952b40d1b2))
|
|
8
|
+
|
|
9
|
+
## [37.65.12](https://github.com/Lundalogik/lime-elements/compare/v37.65.11...v37.65.12) (2024-11-12)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
* **date-picker:** avoid creating flatpickr instance while hidden ([7bd6f8a](https://github.com/Lundalogik/lime-elements/commit/7bd6f8a7f37d9920c832dc3513632927d0ae5365))
|
|
16
|
+
* **flatpickr-adapter:** create flatpickr again after disconnected ([737178a](https://github.com/Lundalogik/lime-elements/commit/737178a62b8958c9f9b7d2af23764e7ec150fb6d))
|
|
17
|
+
|
|
1
18
|
## [37.65.11](https://github.com/Lundalogik/lime-elements/compare/v37.65.10...v37.65.11) (2024-11-11)
|
|
2
19
|
|
|
3
20
|
|
|
@@ -6469,6 +6469,7 @@ const ARIA_DATE_FORMAT = 'F j, Y';
|
|
|
6469
6469
|
class Picker {
|
|
6470
6470
|
constructor(dateFormat, language, change) {
|
|
6471
6471
|
this.change = change;
|
|
6472
|
+
this.formatter = (date) => moment.moment(date).locale(this.getMomentLang()).format(this.dateFormat);
|
|
6472
6473
|
this.language = 'en';
|
|
6473
6474
|
this.language = language;
|
|
6474
6475
|
const isMobile = device.isIOSDevice() || device.isAndroidDevice();
|
|
@@ -7615,7 +7616,9 @@ const DatePickerCalendar = class {
|
|
|
7615
7616
|
this.picker = new DatetimePicker(this.format, this.language, this.change);
|
|
7616
7617
|
break;
|
|
7617
7618
|
}
|
|
7618
|
-
this.
|
|
7619
|
+
if (this.formatter) {
|
|
7620
|
+
this.picker.formatter = this.formatter;
|
|
7621
|
+
}
|
|
7619
7622
|
}
|
|
7620
7623
|
componentDidUpdate() {
|
|
7621
7624
|
if (!this.flatPickrCreated) {
|
|
@@ -7624,28 +7627,6 @@ const DatePickerCalendar = class {
|
|
|
7624
7627
|
else if (!this.isOpen) {
|
|
7625
7628
|
this.picker.setValue(this.value);
|
|
7626
7629
|
}
|
|
7627
|
-
this.tryFixConfusingWidthBug();
|
|
7628
|
-
}
|
|
7629
|
-
tryFixConfusingWidthBug() {
|
|
7630
|
-
// Sometimes the datepickr renders with the width set to 1px.
|
|
7631
|
-
// We've not been able to understand why but believe it has
|
|
7632
|
-
// to do with the internal implementation of flatpickr.
|
|
7633
|
-
// The fix below is an ugly fix that seems to solve this
|
|
7634
|
-
// issue for us.
|
|
7635
|
-
const ONE_SECOND = 1000;
|
|
7636
|
-
const TEN_PIXELS = 10;
|
|
7637
|
-
if (this.isOpen) {
|
|
7638
|
-
setTimeout(() => {
|
|
7639
|
-
if (this.isOpen) {
|
|
7640
|
-
const flatpickrElement = this.container.querySelector('div.flatpickr-calendar');
|
|
7641
|
-
const { width } = flatpickrElement.getBoundingClientRect();
|
|
7642
|
-
if (width < TEN_PIXELS) {
|
|
7643
|
-
this.destroyFlatpickr();
|
|
7644
|
-
this.createFlatpickr();
|
|
7645
|
-
}
|
|
7646
|
-
}
|
|
7647
|
-
}, ONE_SECOND);
|
|
7648
|
-
}
|
|
7649
7630
|
}
|
|
7650
7631
|
createFlatpickr() {
|
|
7651
7632
|
if (!this.inputElement) {
|
|
@@ -7653,14 +7634,15 @@ const DatePickerCalendar = class {
|
|
|
7653
7634
|
// after its been rendered.
|
|
7654
7635
|
return;
|
|
7655
7636
|
}
|
|
7637
|
+
if (!this.isOpen || !this.container.checkVisibility()) {
|
|
7638
|
+
return;
|
|
7639
|
+
}
|
|
7656
7640
|
this.picker.init(this.inputElement, this.container, this.value);
|
|
7657
7641
|
this.flatPickrCreated = true;
|
|
7658
7642
|
}
|
|
7659
|
-
destroyFlatpickr() {
|
|
7660
|
-
this.picker.destroy();
|
|
7661
|
-
}
|
|
7662
7643
|
disconnectedCallback() {
|
|
7663
7644
|
this.picker.destroy();
|
|
7645
|
+
this.flatPickrCreated = false;
|
|
7664
7646
|
}
|
|
7665
7647
|
render() {
|
|
7666
7648
|
return (index.h("div", { class: "container", ref: (el) => (this.container = el), style: {
|