@websy/websy-designs 1.2.11 → 1.2.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.
|
@@ -636,7 +636,10 @@ class WebsyDatePicker {
|
|
|
636
636
|
this.close()
|
|
637
637
|
}
|
|
638
638
|
else if (event.target.classList.contains('clear-selection')) {
|
|
639
|
-
this.selectRange(0)
|
|
639
|
+
this.selectRange(0, false)
|
|
640
|
+
if (this.options.onClear) {
|
|
641
|
+
this.options.onClear()
|
|
642
|
+
}
|
|
640
643
|
this.updateRange(0)
|
|
641
644
|
}
|
|
642
645
|
}
|
|
@@ -721,17 +724,7 @@ class WebsyDatePicker {
|
|
|
721
724
|
console.log('diff', diff)
|
|
722
725
|
}
|
|
723
726
|
else if (this.options.mode === 'hour') {
|
|
724
|
-
|
|
725
|
-
let diffEnd
|
|
726
|
-
this.options.hours.forEach((h, i) => {
|
|
727
|
-
if (h.text === this.selectedRangeDates[0]) {
|
|
728
|
-
diffStart = i
|
|
729
|
-
}
|
|
730
|
-
if (h.text === this.selectedRangeDates[this.selectedRangeDates.length - 1]) {
|
|
731
|
-
diffEnd = i
|
|
732
|
-
}
|
|
733
|
-
})
|
|
734
|
-
diff = diffEnd - diffStart
|
|
727
|
+
diff = this.selectedRangeDates[this.selectedRangeDates.length - 1] - this.selectedRangeDates[0]
|
|
735
728
|
}
|
|
736
729
|
for (let i = 0; i < diff + 1; i++) {
|
|
737
730
|
let d
|
|
@@ -754,7 +747,7 @@ class WebsyDatePicker {
|
|
|
754
747
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime()
|
|
755
748
|
}
|
|
756
749
|
else if (this.options.mode === 'hour') {
|
|
757
|
-
d = this.
|
|
750
|
+
d = this.selectedRangeDates[0] + i
|
|
758
751
|
rangeStart = this.selectedRangeDates[0]
|
|
759
752
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1]
|
|
760
753
|
}
|
|
@@ -765,7 +758,10 @@ class WebsyDatePicker {
|
|
|
765
758
|
else if (this.options.mode === 'year') {
|
|
766
759
|
dateEl = document.getElementById(`${this.elementId}_${d}_year`)
|
|
767
760
|
}
|
|
768
|
-
else if (this.options.mode === 'monthyear') {
|
|
761
|
+
else if (this.options.mode === 'monthyear') {
|
|
762
|
+
console.log('d', d)
|
|
763
|
+
console.log(this.selectedRangeDates)
|
|
764
|
+
console.log(rangeStart, rangeEnd)
|
|
769
765
|
dateEl = document.getElementById(`${this.elementId}_${d}_monthyear`)
|
|
770
766
|
}
|
|
771
767
|
else if (this.options.mode === 'hour') {
|
|
@@ -1128,7 +1124,7 @@ class WebsyDatePicker {
|
|
|
1128
1124
|
this.selectedRange = -1
|
|
1129
1125
|
this.highlightRange()
|
|
1130
1126
|
}
|
|
1131
|
-
selectRange (index) {
|
|
1127
|
+
selectRange (index, confirm = true) {
|
|
1132
1128
|
if (this.options.ranges[this.options.mode][index]) {
|
|
1133
1129
|
this.selectedRangeDates = [...this.options.ranges[this.options.mode][index].range]
|
|
1134
1130
|
this.currentselection = [...this.options.ranges[this.options.mode][index].range]
|
|
@@ -1143,7 +1139,7 @@ class WebsyDatePicker {
|
|
|
1143
1139
|
}
|
|
1144
1140
|
}
|
|
1145
1141
|
this.highlightRange()
|
|
1146
|
-
this.close(
|
|
1142
|
+
this.close(confirm)
|
|
1147
1143
|
}
|
|
1148
1144
|
}
|
|
1149
1145
|
selectCustomRange (range) {
|
package/dist/websy-designs.js
CHANGED
|
@@ -705,7 +705,12 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
705
705
|
} else if (event.target.classList.contains('websy-dp-cancel')) {
|
|
706
706
|
this.close();
|
|
707
707
|
} else if (event.target.classList.contains('clear-selection')) {
|
|
708
|
-
this.selectRange(0);
|
|
708
|
+
this.selectRange(0, false);
|
|
709
|
+
|
|
710
|
+
if (this.options.onClear) {
|
|
711
|
+
this.options.onClear();
|
|
712
|
+
}
|
|
713
|
+
|
|
709
714
|
this.updateRange(0);
|
|
710
715
|
}
|
|
711
716
|
}
|
|
@@ -807,18 +812,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
807
812
|
console.log('year diff', yearDiff);
|
|
808
813
|
console.log('diff', diff);
|
|
809
814
|
} else if (this.options.mode === 'hour') {
|
|
810
|
-
|
|
811
|
-
var diffEnd;
|
|
812
|
-
this.options.hours.forEach(function (h, i) {
|
|
813
|
-
if (h.text === _this5.selectedRangeDates[0]) {
|
|
814
|
-
diffStart = i;
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
if (h.text === _this5.selectedRangeDates[_this5.selectedRangeDates.length - 1]) {
|
|
818
|
-
diffEnd = i;
|
|
819
|
-
}
|
|
820
|
-
});
|
|
821
|
-
diff = diffEnd - diffStart;
|
|
815
|
+
diff = this.selectedRangeDates[this.selectedRangeDates.length - 1] - this.selectedRangeDates[0];
|
|
822
816
|
}
|
|
823
817
|
|
|
824
818
|
for (var _i = 0; _i < diff + 1; _i++) {
|
|
@@ -840,7 +834,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
840
834
|
rangeStart = this.selectedRangeDates[0].getTime();
|
|
841
835
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
842
836
|
} else if (this.options.mode === 'hour') {
|
|
843
|
-
d = this.
|
|
837
|
+
d = this.selectedRangeDates[0] + _i;
|
|
844
838
|
rangeStart = this.selectedRangeDates[0];
|
|
845
839
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
|
|
846
840
|
}
|
|
@@ -852,6 +846,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
852
846
|
} else if (this.options.mode === 'year') {
|
|
853
847
|
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_year"));
|
|
854
848
|
} else if (this.options.mode === 'monthyear') {
|
|
849
|
+
console.log('d', d);
|
|
850
|
+
console.log(this.selectedRangeDates);
|
|
851
|
+
console.log(rangeStart, rangeEnd);
|
|
855
852
|
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_monthyear"));
|
|
856
853
|
} else if (this.options.mode === 'hour') {
|
|
857
854
|
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_hour"));
|
|
@@ -1255,6 +1252,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1255
1252
|
}, {
|
|
1256
1253
|
key: "selectRange",
|
|
1257
1254
|
value: function selectRange(index) {
|
|
1255
|
+
var confirm = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
1256
|
+
|
|
1258
1257
|
if (this.options.ranges[this.options.mode][index]) {
|
|
1259
1258
|
this.selectedRangeDates = _toConsumableArray(this.options.ranges[this.options.mode][index].range);
|
|
1260
1259
|
this.currentselection = _toConsumableArray(this.options.ranges[this.options.mode][index].range);
|
|
@@ -1270,7 +1269,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1270
1269
|
}
|
|
1271
1270
|
|
|
1272
1271
|
this.highlightRange();
|
|
1273
|
-
this.close(
|
|
1272
|
+
this.close(confirm);
|
|
1274
1273
|
}
|
|
1275
1274
|
}
|
|
1276
1275
|
}, {
|