@websy/websy-designs 1.2.16 → 1.2.18
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.
|
@@ -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,9 +1134,12 @@ class WebsyDatePicker {
|
|
|
1134
1134
|
this.close(confirm)
|
|
1135
1135
|
}
|
|
1136
1136
|
}
|
|
1137
|
-
selectCustomRange (range) {
|
|
1137
|
+
selectCustomRange (range, isRange = true) {
|
|
1138
1138
|
this.selectedRange = -1
|
|
1139
1139
|
this.selectedRangeDates = range
|
|
1140
|
+
if (isRange === true) {
|
|
1141
|
+
this.currentselection = []
|
|
1142
|
+
}
|
|
1140
1143
|
// check if the custom range matches a configured range
|
|
1141
1144
|
for (let i = 0; i < this.options.ranges[this.options.mode].length; i++) {
|
|
1142
1145
|
if (this.options.ranges[this.options.mode][i].range.length === 1) {
|
|
@@ -1201,18 +1204,23 @@ class WebsyDatePicker {
|
|
|
1201
1204
|
})
|
|
1202
1205
|
let start = list[0]
|
|
1203
1206
|
let end = ''
|
|
1204
|
-
if (this.customRangeSelected === true) {
|
|
1207
|
+
if (this.customRangeSelected === true) {
|
|
1205
1208
|
end = ` - ${list[list.length - 1]}`
|
|
1209
|
+
if (this.options.mode === 'hour') {
|
|
1210
|
+
start = this.options.hours[start].text
|
|
1211
|
+
end = `${this.customRangeSelected === true ? ' - ' : ''}${this.options.hours[list[list.length - 1]].text}`
|
|
1212
|
+
}
|
|
1206
1213
|
}
|
|
1207
1214
|
else {
|
|
1208
1215
|
if (list.length > 1) {
|
|
1209
1216
|
start = `${list.length} selected`
|
|
1217
|
+
}
|
|
1218
|
+
else {
|
|
1219
|
+
if (this.options.mode === 'hour') {
|
|
1220
|
+
start = this.options.hours[start].text
|
|
1221
|
+
}
|
|
1210
1222
|
}
|
|
1211
|
-
}
|
|
1212
|
-
if (this.options.mode === 'hour') {
|
|
1213
|
-
start = this.options.hours[start].text
|
|
1214
|
-
end = `${this.customRangeSelected === true ? ' - ' : ''}${this.options.hours[list[list.length - 1]].text}`
|
|
1215
|
-
}
|
|
1223
|
+
}
|
|
1216
1224
|
range = { label: `${start}${end}` }
|
|
1217
1225
|
}
|
|
1218
1226
|
else {
|
package/dist/websy-designs.js
CHANGED
|
@@ -649,7 +649,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
649
649
|
}
|
|
650
650
|
} else {
|
|
651
651
|
if (this.options.mode === 'hour') {
|
|
652
|
-
var _hoursOut = this.
|
|
652
|
+
var _hoursOut = this.currentselection.map(function (h) {
|
|
653
653
|
return _this4.options.hours[h];
|
|
654
654
|
});
|
|
655
655
|
|
|
@@ -1266,8 +1266,14 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1266
1266
|
}, {
|
|
1267
1267
|
key: "selectCustomRange",
|
|
1268
1268
|
value: function selectCustomRange(range) {
|
|
1269
|
+
var isRange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
1269
1270
|
this.selectedRange = -1;
|
|
1270
|
-
this.selectedRangeDates = range;
|
|
1271
|
+
this.selectedRangeDates = range;
|
|
1272
|
+
|
|
1273
|
+
if (isRange === true) {
|
|
1274
|
+
this.currentselection = [];
|
|
1275
|
+
} // check if the custom range matches a configured range
|
|
1276
|
+
|
|
1271
1277
|
|
|
1272
1278
|
for (var i = 0; i < this.options.ranges[this.options.mode].length; i++) {
|
|
1273
1279
|
if (this.options.ranges[this.options.mode][i].range.length === 1) {
|
|
@@ -1339,17 +1345,21 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1339
1345
|
|
|
1340
1346
|
if (this.customRangeSelected === true) {
|
|
1341
1347
|
end = " - ".concat(list[list.length - 1]);
|
|
1348
|
+
|
|
1349
|
+
if (this.options.mode === 'hour') {
|
|
1350
|
+
start = this.options.hours[start].text;
|
|
1351
|
+
end = "".concat(this.customRangeSelected === true ? ' - ' : '').concat(this.options.hours[list[list.length - 1]].text);
|
|
1352
|
+
}
|
|
1342
1353
|
} else {
|
|
1343
1354
|
if (list.length > 1) {
|
|
1344
1355
|
start = "".concat(list.length, " selected");
|
|
1356
|
+
} else {
|
|
1357
|
+
if (this.options.mode === 'hour') {
|
|
1358
|
+
start = this.options.hours[start].text;
|
|
1359
|
+
}
|
|
1345
1360
|
}
|
|
1346
1361
|
}
|
|
1347
1362
|
|
|
1348
|
-
if (this.options.mode === 'hour') {
|
|
1349
|
-
start = this.options.hours[start].text;
|
|
1350
|
-
end = "".concat(this.customRangeSelected === true ? ' - ' : '').concat(this.options.hours[list[list.length - 1]].text);
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
1363
|
range = {
|
|
1354
1364
|
label: "".concat(start).concat(end)
|
|
1355
1365
|
};
|