@websy/websy-designs 1.2.18 → 1.2.20

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.
@@ -27,7 +27,7 @@ router.post('/', (req, res) => {
27
27
  // res.setHeader('Content-Disposition', `attachment;filename=${req.body.name || utils.createIdentity()}.pdf`)
28
28
  res.contentType('application/pdf')
29
29
  res.setHeader('filename', `${req.body.name || utils.createIdentity()}.pdf`)
30
- // req.session.pdf = pdf
30
+ req.session.pdf = pdf
31
31
  res.send(pdf)
32
32
  }
33
33
  })
@@ -948,22 +948,47 @@ class WebsyDatePicker {
948
948
  this.close(confirm)
949
949
  }
950
950
  }
951
- selectCustomRange (range, isRange = true) {
951
+ selectCustomRange (rangeInput) {
952
952
  this.selectedRange = -1
953
- this.selectedRangeDates = range
954
- if (isRange === true) {
955
- this.currentselection = []
956
- }
953
+ let isContinuousRange = true
954
+ if (rangeInput.length === 1) {
955
+ this.selectedRangeDates = [...rangeInput]
956
+ this.customRangeSelected = [...rangeInput]
957
+ }
958
+ else if (rangeInput.length === 2) {
959
+ this.selectedRangeDates = [...rangeInput]
960
+ this.customRangeSelected = [...rangeInput]
961
+ }
962
+ rangeInput.forEach((r, i) => {
963
+ if (i > 0) {
964
+ if (this.options.mode === 'date' || this.options.mode === 'monthyear') {
965
+ if ((r.getTime() / this.oneDay) - (rangeInput[i - 1] / this.oneDay) > 1) {
966
+ isContinuousRange = false
967
+ }
968
+ }
969
+ else if (this.options.mode === 'hour' || this.options.mode === 'year') {
970
+ if (r - rangeInput[i - 1] > 1) {
971
+ isContinuousRange = false
972
+ }
973
+ }
974
+ }
975
+ })
976
+ if (rangeInput.length > 2 && isContinuousRange === true) {
977
+ this.selectedRangeDates = [rangeInput[0], rangeInput[rangeInput.length - 1]]
978
+ }
979
+ if (isContinuousRange === false) {
980
+ this.currentselection = []
981
+ }
957
982
  // check if the custom range matches a configured range
958
983
  for (let i = 0; i < this.options.ranges[this.options.mode].length; i++) {
959
984
  if (this.options.ranges[this.options.mode][i].range.length === 1) {
960
- if (this.options.ranges[this.options.mode][i].range[0] === range[0]) {
985
+ if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0]) {
961
986
  this.selectedRange = i
962
987
  break
963
988
  }
964
989
  }
965
990
  else if (this.options.ranges[this.options.mode][i].range.length === 2) {
966
- if (this.options.ranges[this.options.mode][i].range[0] === range[0] && this.options.ranges[this.options.mode][i].range[1] === range[1]) {
991
+ if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0] && this.options.ranges[this.options.mode][i].range[1] === rangeInput[1]) {
967
992
  this.selectedRange = i
968
993
  break
969
994
  }