@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.
@@ -396,7 +396,7 @@ class WebsyDatePicker {
396
396
  }
397
397
  else {
398
398
  if (this.options.mode === 'hour') {
399
- let hoursOut = this.selectedRangeDates.map(h => this.options.hours[h])
399
+ let hoursOut = this.currentselection.map(h => this.options.hours[h])
400
400
  this.options.onChange(hoursOut, true)
401
401
  }
402
402
  else {
@@ -948,9 +948,12 @@ class WebsyDatePicker {
948
948
  this.close(confirm)
949
949
  }
950
950
  }
951
- selectCustomRange (range) {
951
+ selectCustomRange (range, isRange = true) {
952
952
  this.selectedRange = -1
953
953
  this.selectedRangeDates = range
954
+ if (isRange === true) {
955
+ this.currentselection = []
956
+ }
954
957
  // check if the custom range matches a configured range
955
958
  for (let i = 0; i < this.options.ranges[this.options.mode].length; i++) {
956
959
  if (this.options.ranges[this.options.mode][i].range.length === 1) {
@@ -1015,18 +1018,23 @@ class WebsyDatePicker {
1015
1018
  })
1016
1019
  let start = list[0]
1017
1020
  let end = ''
1018
- if (this.customRangeSelected === true) {
1021
+ if (this.customRangeSelected === true) {
1019
1022
  end = ` - ${list[list.length - 1]}`
1023
+ if (this.options.mode === 'hour') {
1024
+ start = this.options.hours[start].text
1025
+ end = `${this.customRangeSelected === true ? ' - ' : ''}${this.options.hours[list[list.length - 1]].text}`
1026
+ }
1020
1027
  }
1021
1028
  else {
1022
1029
  if (list.length > 1) {
1023
1030
  start = `${list.length} selected`
1031
+ }
1032
+ else {
1033
+ if (this.options.mode === 'hour') {
1034
+ start = this.options.hours[start].text
1035
+ }
1024
1036
  }
1025
- }
1026
- if (this.options.mode === 'hour') {
1027
- start = this.options.hours[start].text
1028
- end = `${this.customRangeSelected === true ? ' - ' : ''}${this.options.hours[list[list.length - 1]].text}`
1029
- }
1037
+ }
1030
1038
  range = { label: `${start}${end}` }
1031
1039
  }
1032
1040
  else {
@@ -437,7 +437,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
437
437
  }
438
438
  } else {
439
439
  if (this.options.mode === 'hour') {
440
- var _hoursOut = this.selectedRangeDates.map(function (h) {
440
+ var _hoursOut = this.currentselection.map(function (h) {
441
441
  return _this2.options.hours[h];
442
442
  });
443
443
 
@@ -1054,8 +1054,14 @@ var WebsyDatePicker = /*#__PURE__*/function () {
1054
1054
  }, {
1055
1055
  key: "selectCustomRange",
1056
1056
  value: function selectCustomRange(range) {
1057
+ var isRange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1057
1058
  this.selectedRange = -1;
1058
- this.selectedRangeDates = range; // check if the custom range matches a configured range
1059
+ this.selectedRangeDates = range;
1060
+
1061
+ if (isRange === true) {
1062
+ this.currentselection = [];
1063
+ } // check if the custom range matches a configured range
1064
+
1059
1065
 
1060
1066
  for (var i = 0; i < this.options.ranges[this.options.mode].length; i++) {
1061
1067
  if (this.options.ranges[this.options.mode][i].range.length === 1) {
@@ -1127,17 +1133,21 @@ var WebsyDatePicker = /*#__PURE__*/function () {
1127
1133
 
1128
1134
  if (this.customRangeSelected === true) {
1129
1135
  end = " - ".concat(list[list.length - 1]);
1136
+
1137
+ if (this.options.mode === 'hour') {
1138
+ start = this.options.hours[start].text;
1139
+ end = "".concat(this.customRangeSelected === true ? ' - ' : '').concat(this.options.hours[list[list.length - 1]].text);
1140
+ }
1130
1141
  } else {
1131
1142
  if (list.length > 1) {
1132
1143
  start = "".concat(list.length, " selected");
1144
+ } else {
1145
+ if (this.options.mode === 'hour') {
1146
+ start = this.options.hours[start].text;
1147
+ }
1133
1148
  }
1134
1149
  }
1135
1150
 
1136
- if (this.options.mode === 'hour') {
1137
- start = this.options.hours[start].text;
1138
- end = "".concat(this.customRangeSelected === true ? ' - ' : '').concat(this.options.hours[list[list.length - 1]].text);
1139
- }
1140
-
1141
1151
  range = {
1142
1152
  label: "".concat(start).concat(end)
1143
1153
  };