@websy/websy-designs 1.2.17 → 1.2.19
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/websy-designs-es6.debug.js +31 -6
- package/dist/websy-designs-es6.js +222 -193
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +31 -6
- package/dist/websy-designs.js +222 -193
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -582,7 +582,7 @@ class WebsyDatePicker {
|
|
|
582
582
|
}
|
|
583
583
|
else {
|
|
584
584
|
if (this.options.mode === 'hour') {
|
|
585
|
-
let hoursOut = this.
|
|
585
|
+
let hoursOut = this.currentselection.map(h => this.options.hours[h])
|
|
586
586
|
this.options.onChange(hoursOut, true)
|
|
587
587
|
}
|
|
588
588
|
else {
|
|
@@ -1134,20 +1134,44 @@ class WebsyDatePicker {
|
|
|
1134
1134
|
this.close(confirm)
|
|
1135
1135
|
}
|
|
1136
1136
|
}
|
|
1137
|
-
selectCustomRange (
|
|
1137
|
+
selectCustomRange (rangeInput) {
|
|
1138
1138
|
this.selectedRange = -1
|
|
1139
|
-
|
|
1140
|
-
|
|
1139
|
+
let isContinuousRange = true
|
|
1140
|
+
if (rangeInput.length === 1) {
|
|
1141
|
+
this.selectedRangeDates = [...rangeInput]
|
|
1142
|
+
this.customRangeSelected = [...rangeInput]
|
|
1143
|
+
}
|
|
1144
|
+
else if (rangeInput.length === 2) {
|
|
1145
|
+
this.selectedRangeDates = [...rangeInput]
|
|
1146
|
+
this.customRangeSelected = [...rangeInput]
|
|
1147
|
+
}
|
|
1148
|
+
rangeInput.forEach((r, i) => {
|
|
1149
|
+
if (i > 0) {
|
|
1150
|
+
if (this.options.mode === 'date' || this.options.mode === 'monthyear') {
|
|
1151
|
+
if ((r.getTime() / this.oneDay) - (rangeInput[i - 1] / this.oneDay) > 1) {
|
|
1152
|
+
isContinuousRange = false
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
else if (this.options.mode === 'hour' || this.options.mode === 'year') {
|
|
1156
|
+
if (r - rangeInput[i - 1] > 1) {
|
|
1157
|
+
isContinuousRange = false
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
})
|
|
1162
|
+
if (rangeInput.length > 2 && isContinuousRange === true) {
|
|
1163
|
+
this.selectedRangeDates = [rangeInput[0], rangeInput[rangeInput.length - 1]]
|
|
1164
|
+
}
|
|
1141
1165
|
// check if the custom range matches a configured range
|
|
1142
1166
|
for (let i = 0; i < this.options.ranges[this.options.mode].length; i++) {
|
|
1143
1167
|
if (this.options.ranges[this.options.mode][i].range.length === 1) {
|
|
1144
|
-
if (this.options.ranges[this.options.mode][i].range[0] ===
|
|
1168
|
+
if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0]) {
|
|
1145
1169
|
this.selectedRange = i
|
|
1146
1170
|
break
|
|
1147
1171
|
}
|
|
1148
1172
|
}
|
|
1149
1173
|
else if (this.options.ranges[this.options.mode][i].range.length === 2) {
|
|
1150
|
-
if (this.options.ranges[this.options.mode][i].range[0] ===
|
|
1174
|
+
if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0] && this.options.ranges[this.options.mode][i].range[1] === rangeInput[1]) {
|
|
1151
1175
|
this.selectedRange = i
|
|
1152
1176
|
break
|
|
1153
1177
|
}
|
|
@@ -1205,6 +1229,7 @@ class WebsyDatePicker {
|
|
|
1205
1229
|
if (this.customRangeSelected === true) {
|
|
1206
1230
|
end = ` - ${list[list.length - 1]}`
|
|
1207
1231
|
if (this.options.mode === 'hour') {
|
|
1232
|
+
start = this.options.hours[start].text
|
|
1208
1233
|
end = `${this.customRangeSelected === true ? ' - ' : ''}${this.options.hours[list[list.length - 1]].text}`
|
|
1209
1234
|
}
|
|
1210
1235
|
}
|