ember-power-calendar 0.20.2 → 0.22.0-beta.0

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.
Files changed (76) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +32 -43
  3. package/addon-main.cjs +4 -0
  4. package/dist/-private/utils/own-prop.js +6 -0
  5. package/dist/-private/utils/own-prop.js.map +1 -0
  6. package/dist/_app_/components/power-calendar/days.js +1 -0
  7. package/dist/_app_/components/power-calendar/nav.js +1 -0
  8. package/dist/_app_/components/power-calendar-multiple/days.js +1 -0
  9. package/dist/_app_/components/power-calendar-multiple.js +1 -0
  10. package/dist/_app_/components/power-calendar-range/days.js +1 -0
  11. package/dist/_app_/components/power-calendar-range.js +1 -0
  12. package/dist/_app_/components/power-calendar.js +1 -0
  13. package/dist/_app_/helpers/ember-power-calendar-day-classes.js +1 -0
  14. package/dist/_app_/helpers/power-calendar-format-date.js +1 -0
  15. package/dist/_app_/services/power-calendar.js +1 -0
  16. package/dist/_rollupPluginBabelHelpers-NZXUO_9u.js +63 -0
  17. package/dist/_rollupPluginBabelHelpers-NZXUO_9u.js.map +1 -0
  18. package/{addon → dist}/components/power-calendar/days.js +53 -85
  19. package/dist/components/power-calendar/days.js.map +1 -0
  20. package/dist/components/power-calendar/nav.js +17 -0
  21. package/dist/components/power-calendar/nav.js.map +1 -0
  22. package/dist/components/power-calendar-multiple/days.js +22 -0
  23. package/dist/components/power-calendar-multiple/days.js.map +1 -0
  24. package/dist/components/power-calendar-multiple.js +70 -0
  25. package/dist/components/power-calendar-multiple.js.map +1 -0
  26. package/{addon → dist}/components/power-calendar-range/days.js +14 -8
  27. package/dist/components/power-calendar-range/days.js.map +1 -0
  28. package/dist/components/power-calendar-range.js +179 -0
  29. package/dist/components/power-calendar-range.js.map +1 -0
  30. package/dist/components/power-calendar.js +148 -0
  31. package/dist/components/power-calendar.js.map +1 -0
  32. package/{addon → dist}/helpers/ember-power-calendar-day-classes.js +5 -7
  33. package/dist/helpers/ember-power-calendar-day-classes.js.map +1 -0
  34. package/dist/helpers/power-calendar-format-date.js +12 -0
  35. package/dist/helpers/power-calendar-format-date.js.map +1 -0
  36. package/dist/index.js +2 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/services/power-calendar.js +35 -0
  39. package/dist/services/power-calendar.js.map +1 -0
  40. package/dist/styles.js +2 -0
  41. package/dist/styles.js.map +1 -0
  42. package/{addon-test-support/index.js → dist/test-support.js} +12 -29
  43. package/dist/test-support.js.map +1 -0
  44. package/dist/utils.js +88 -0
  45. package/dist/utils.js.map +1 -0
  46. package/package.json +83 -110
  47. package/vendor/ember-power-calendar.css +74 -0
  48. package/vendor/ember-power-calendar.js +3 -0
  49. package/addon/-private/utils/own-prop.js +0 -3
  50. package/addon/.gitkeep +0 -0
  51. package/addon/components/power-calendar/days.hbs +0 -32
  52. package/addon/components/power-calendar/nav.hbs +0 -15
  53. package/addon/components/power-calendar/nav.js +0 -11
  54. package/addon/components/power-calendar-multiple/days.js +0 -24
  55. package/addon/components/power-calendar-multiple.js +0 -76
  56. package/addon/components/power-calendar-range.js +0 -175
  57. package/addon/components/power-calendar.hbs +0 -17
  58. package/addon/components/power-calendar.js +0 -133
  59. package/addon/helpers/power-calendar-format-date.js +0 -8
  60. package/addon/services/power-calendar.js +0 -26
  61. package/addon/utils.js +0 -119
  62. package/app/.gitkeep +0 -0
  63. package/app/components/power-calendar/days.js +0 -1
  64. package/app/components/power-calendar/nav.js +0 -1
  65. package/app/components/power-calendar-multiple/days.js +0 -1
  66. package/app/components/power-calendar-multiple.js +0 -1
  67. package/app/components/power-calendar-range/days.js +0 -1
  68. package/app/components/power-calendar-range.js +0 -1
  69. package/app/components/power-calendar.js +0 -1
  70. package/app/helpers/ember-power-calendar-day-classes.js +0 -4
  71. package/app/helpers/power-calendar-format-date.js +0 -4
  72. package/app/services/power-calendar.js +0 -1
  73. package/index.js +0 -5
  74. package/test-support/helpers/ember-power-calendar.js +0 -21
  75. /package/{app/styles/ember-power-calendar.less → less/base.less} +0 -0
  76. /package/{app/styles/ember-power-calendar.scss → scss/base.scss} +0 -0
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019
3
+ Copyright (c) 2024
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
package/README.md CHANGED
@@ -1,43 +1,32 @@
1
- # Ember Power Calendar
2
-
3
- [![CI](https://github.com/cibernox/ember-power-calendar/actions/workflows/ci.yml/badge.svg)](https://github.com/cibernox/ember-power-calendar/actions/workflows/ci.yml)
4
- [![Ember Observer Score](http://emberobserver.com/badges/ember-power-calendar.svg)](http://emberobserver.com/addons/ember-power-calendar)
5
- [![npm version](https://badge.fury.io/js/ember-power-calendar.svg)](https://badge.fury.io/js/ember-power-calendar)
6
-
7
- Customizable Calendar Component for Ember.
8
-
9
- ## Compatibility
10
-
11
- * Ember.js v3.28 or above
12
- * Ember CLI v3.28 or above
13
- * Node.js v16 or above
14
-
15
- ## Installation
16
-
17
- `ember install ember-power-calendar`
18
-
19
- Internet Explorer 11 support requires babel polyfill:
20
-
21
- ```js
22
- // ember-cli-build.js
23
-
24
- let app = new EmberAddon(defaults, {
25
- 'ember-cli-babel': {
26
- includePolyfill: true
27
- }
28
- });
29
- ```
30
-
31
- ## Usage
32
-
33
- There are many possible ways to use it, for giving you just a taste of the API:
34
-
35
- ```hbs
36
- <PowerCalendar @selected={{this.arrival}} @onSelect={{this.onChange}} as |calendar|>
37
- <calendar.Nav/>
38
- <calendar.Days/>
39
- </PowerCalendar>
40
- ```
41
-
42
- Check the full documentation at www.ember-power-calendar.com
43
-
1
+ # Ember Power Calendar
2
+
3
+ [![CI](https://github.com/cibernox/ember-power-calendar/actions/workflows/ci.yml/badge.svg)](https://github.com/cibernox/ember-power-calendar/actions/workflows/ci.yml)
4
+ [![Ember Observer Score](http://emberobserver.com/badges/ember-power-calendar.svg)](http://emberobserver.com/addons/ember-power-calendar)
5
+ [![npm version](https://badge.fury.io/js/ember-power-calendar.svg)](https://badge.fury.io/js/ember-power-calendar)
6
+
7
+ Customizable Calendar Component for Ember.
8
+
9
+ ## Compatibility
10
+
11
+ * Ember.js v3.28 or above
12
+ * Ember CLI v3.28 or above
13
+ * Node.js v18 or above
14
+
15
+ ## Installation
16
+
17
+ `ember install ember-power-calendar`
18
+
19
+
20
+ ## Usage
21
+
22
+ There are many possible ways to use it, for giving you just a taste of the API:
23
+
24
+ ```hbs
25
+ <PowerCalendar @selected={{this.arrival}} @onSelect={{this.onChange}} as |calendar|>
26
+ <calendar.Nav/>
27
+ <calendar.Days/>
28
+ </PowerCalendar>
29
+ ```
30
+
31
+ Check the full documentation at www.ember-power-calendar.com
32
+
package/addon-main.cjs ADDED
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+ const { addonV1Shim } = require('@embroider/addon-shim');
4
+ module.exports = addonV1Shim(__dirname);
@@ -0,0 +1,6 @@
1
+ function ownProp(obj, prop) {
2
+ return Object.prototype.hasOwnProperty.call(obj, prop);
3
+ }
4
+
5
+ export { ownProp as default };
6
+ //# sourceMappingURL=own-prop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"own-prop.js","sources":["../../../src/-private/utils/own-prop.js"],"sourcesContent":["export default function ownProp(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n"],"names":["ownProp","obj","prop","Object","prototype","hasOwnProperty","call"],"mappings":"AAAe,SAASA,OAAOA,CAACC,GAAG,EAAEC,IAAI,EAAE;EACzC,OAAOC,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACL,GAAG,EAAEC,IAAI,CAAC,CAAA;AACxD;;;;"}
@@ -0,0 +1 @@
1
+ export { default } from "ember-power-calendar/components/power-calendar/days";
@@ -0,0 +1 @@
1
+ export { default } from "ember-power-calendar/components/power-calendar/nav";
@@ -0,0 +1 @@
1
+ export { default } from "ember-power-calendar/components/power-calendar-multiple/days";
@@ -0,0 +1 @@
1
+ export { default } from "ember-power-calendar/components/power-calendar-multiple";
@@ -0,0 +1 @@
1
+ export { default } from "ember-power-calendar/components/power-calendar-range/days";
@@ -0,0 +1 @@
1
+ export { default } from "ember-power-calendar/components/power-calendar-range";
@@ -0,0 +1 @@
1
+ export { default } from "ember-power-calendar/components/power-calendar";
@@ -0,0 +1 @@
1
+ export { default } from "ember-power-calendar/helpers/ember-power-calendar-day-classes";
@@ -0,0 +1 @@
1
+ export { default } from "ember-power-calendar/helpers/power-calendar-format-date";
@@ -0,0 +1 @@
1
+ export { default } from "ember-power-calendar/services/power-calendar";
@@ -0,0 +1,63 @@
1
+ function _toPrimitive(t, r) {
2
+ if ("object" != typeof t || !t) return t;
3
+ var e = t[Symbol.toPrimitive];
4
+ if (void 0 !== e) {
5
+ var i = e.call(t, r || "default");
6
+ if ("object" != typeof i) return i;
7
+ throw new TypeError("@@toPrimitive must return a primitive value.");
8
+ }
9
+ return ("string" === r ? String : Number)(t);
10
+ }
11
+ function _toPropertyKey(t) {
12
+ var i = _toPrimitive(t, "string");
13
+ return "symbol" == typeof i ? i : String(i);
14
+ }
15
+ function _defineProperty(obj, key, value) {
16
+ key = _toPropertyKey(key);
17
+ if (key in obj) {
18
+ Object.defineProperty(obj, key, {
19
+ value: value,
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true
23
+ });
24
+ } else {
25
+ obj[key] = value;
26
+ }
27
+ return obj;
28
+ }
29
+ function _initializerDefineProperty(target, property, descriptor, context) {
30
+ if (!descriptor) return;
31
+ Object.defineProperty(target, property, {
32
+ enumerable: descriptor.enumerable,
33
+ configurable: descriptor.configurable,
34
+ writable: descriptor.writable,
35
+ value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
36
+ });
37
+ }
38
+ function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
39
+ var desc = {};
40
+ Object.keys(descriptor).forEach(function (key) {
41
+ desc[key] = descriptor[key];
42
+ });
43
+ desc.enumerable = !!desc.enumerable;
44
+ desc.configurable = !!desc.configurable;
45
+ if ('value' in desc || desc.initializer) {
46
+ desc.writable = true;
47
+ }
48
+ desc = decorators.slice().reverse().reduce(function (desc, decorator) {
49
+ return decorator(target, property, desc) || desc;
50
+ }, desc);
51
+ if (context && desc.initializer !== void 0) {
52
+ desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
53
+ desc.initializer = undefined;
54
+ }
55
+ if (desc.initializer === void 0) {
56
+ Object.defineProperty(target, property, desc);
57
+ desc = null;
58
+ }
59
+ return desc;
60
+ }
61
+
62
+ export { _applyDecoratedDescriptor as _, _defineProperty as a, _initializerDefineProperty as b };
63
+ //# sourceMappingURL=_rollupPluginBabelHelpers-NZXUO_9u.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_rollupPluginBabelHelpers-NZXUO_9u.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,57 +1,39 @@
1
+ import { _ as _applyDecoratedDescriptor, b as _initializerDefineProperty } from '../../_rollupPluginBabelHelpers-NZXUO_9u.js';
1
2
  import Component from '@glimmer/component';
2
3
  import { tracked } from '@glimmer/tracking';
3
4
  import { action } from '@ember/object';
4
5
  import { scheduleOnce } from '@ember/runloop';
5
- import { inject as service } from '@ember/service';
6
+ import { inject } from '@ember/service';
6
7
  import { assert } from '@ember/debug';
7
- import {
8
- add,
9
- endOf,
10
- endOfWeek,
11
- formatDate,
12
- getWeekdays,
13
- getWeekdaysMin,
14
- getWeekdaysShort,
15
- isAfter,
16
- isBefore,
17
- isSame,
18
- localeStartOfWeek,
19
- normalizeCalendarDay,
20
- normalizeDate,
21
- startOf,
22
- startOfWeek,
23
- withLocale,
24
- } from 'ember-power-calendar/utils';
8
+ import { withLocale, getWeekdaysMin, getWeekdaysShort, getWeekdays, localeStartOfWeek, isBefore, add, normalizeDate, formatDate, normalizeCalendarDay, isSame, startOf, isAfter, endOf, startOfWeek, endOfWeek } from '../../utils.js';
9
+ import { precompileTemplate } from '@ember/template-compilation';
10
+ import { setComponentTemplate } from '@ember/component';
25
11
 
26
- const WEEK_DAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
27
-
28
- export default class extends Component {
29
- @service('power-calendar') powerCalendarService;
30
-
31
- @tracked focusedId = undefined;
12
+ var TEMPLATE = precompileTemplate("{{! template-lint-disable no-invalid-interactive }}\n<div\n class=\"ember-power-calendar-days\"\n {{on \"click\" this.handleClick}}\n ...attributes\n data-power-calendar-id={{or @calendar.calendarUniqueId @calendar.uniqueId}}>\n <div class=\"ember-power-calendar-row ember-power-calendar-weekdays\">\n {{#each this.weekdaysNames as |wdn|}}\n <div class=\"ember-power-calendar-weekday\">{{wdn}}</div>\n {{/each}}\n </div>\n <div class=\"ember-power-calendar-day-grid\" {{on \"keydown\" this.handleKeyDown}}>\n {{#each this.weeks key=\'id\' as |week|}}\n <div class=\"ember-power-calendar-row ember-power-calendar-week\" data-missing-days={{week.missingDays}}>\n {{#each week.days key=\'id\' as |day|}}\n <button type=\"button\"\n data-date=\"{{day.id}}\"\n class={{ember-power-calendar-day-classes day @calendar this.weeks @dayClass}}\n {{on \"focus\" this.handleDayFocus}}\n {{on \"blur\" this.handleDayBlur}}\n disabled={{day.isDisabled}}>\n {{#if (has-block)}}\n {{yield day @calendar this.weeks}}\n {{else}}\n {{day.number}}\n {{/if}}\n </button>\n {{/each}}\n </div>\n {{/each}}\n </div>\n</div>\n");
32
13
 
14
+ var _dec, _class, _descriptor, _descriptor2;
15
+ const WEEK_DAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
16
+ var DaysComponent = setComponentTemplate(TEMPLATE, (_dec = inject('power-calendar'), (_class = class _class extends Component {
17
+ constructor(...args) {
18
+ super(...args);
19
+ _initializerDefineProperty(this, "powerCalendarService", _descriptor, this);
20
+ _initializerDefineProperty(this, "focusedId", _descriptor2, this);
21
+ }
33
22
  get weekdayFormat() {
34
23
  return this.args.weekdayFormat || 'short'; // "min" | "short" | "long"
35
24
  }
36
-
37
25
  get showDaysAround() {
38
- return this.args.showDaysAround !== undefined
39
- ? this.args.showDaysAround
40
- : true;
26
+ return this.args.showDaysAround !== undefined ? this.args.showDaysAround : true;
41
27
  }
42
-
43
28
  get weekdaysMin() {
44
29
  return withLocale(this.args.calendar.locale, getWeekdaysMin);
45
30
  }
46
-
47
31
  get weekdaysShort() {
48
32
  return withLocale(this.args.calendar.locale, getWeekdaysShort);
49
33
  }
50
-
51
34
  get weekdays() {
52
35
  return withLocale(this.args.calendar.locale, getWeekdays);
53
36
  }
54
-
55
37
  get localeStartOfWeek() {
56
38
  let forcedStartOfWeek = this.args.startOfWeek;
57
39
  if (forcedStartOfWeek) {
@@ -59,18 +41,15 @@ export default class extends Component {
59
41
  }
60
42
  return localeStartOfWeek(this.args.calendar.locale);
61
43
  }
62
-
63
44
  get weekdaysNames() {
64
- let { localeStartOfWeek, weekdayFormat } = this;
65
- let format = `weekdays${
66
- weekdayFormat === 'long' ? '' : weekdayFormat === 'min' ? 'Min' : 'Short'
67
- }`;
45
+ let {
46
+ localeStartOfWeek,
47
+ weekdayFormat
48
+ } = this;
49
+ let format = `weekdays${weekdayFormat === 'long' ? '' : weekdayFormat === 'min' ? 'Min' : 'Short'}`;
68
50
  let weekdaysNames = this[format];
69
- return weekdaysNames
70
- .slice(localeStartOfWeek)
71
- .concat(weekdaysNames.slice(0, localeStartOfWeek));
51
+ return weekdaysNames.slice(localeStartOfWeek).concat(weekdaysNames.slice(0, localeStartOfWeek));
72
52
  }
73
-
74
53
  get days() {
75
54
  let today = this.powerCalendarService.getDate();
76
55
  let lastDay = this.lastDay();
@@ -82,26 +61,27 @@ export default class extends Component {
82
61
  }
83
62
  return days;
84
63
  }
85
-
86
64
  get weeks() {
87
- let { showDaysAround, days } = this;
65
+ let {
66
+ showDaysAround,
67
+ days
68
+ } = this;
88
69
  let weeks = [];
89
70
  let i = 0;
90
71
  while (days[i]) {
91
72
  let daysOfWeek = days.slice(i, i + 7);
92
73
  if (!showDaysAround) {
93
- daysOfWeek = daysOfWeek.filter((d) => d.isCurrentMonth);
74
+ daysOfWeek = daysOfWeek.filter(d => d.isCurrentMonth);
94
75
  }
95
76
  weeks.push({
96
77
  id: `week-of-${daysOfWeek[0].id}`,
97
78
  days: daysOfWeek,
98
- missingDays: 7 - daysOfWeek.length,
79
+ missingDays: 7 - daysOfWeek.length
99
80
  });
100
81
  i += 7;
101
82
  }
102
83
  return weeks;
103
84
  }
104
-
105
85
  get currentCenter() {
106
86
  let center = this.args.center;
107
87
  if (!center) {
@@ -111,19 +91,16 @@ export default class extends Component {
111
91
  }
112
92
 
113
93
  // Actions
114
- @action
115
94
  handleDayFocus(e) {
116
95
  scheduleOnce('actions', this, this._updateFocused, e.target.dataset.date);
117
96
  }
118
-
119
- @action
120
97
  handleDayBlur() {
121
98
  scheduleOnce('actions', this, this._updateFocused, null);
122
99
  }
123
-
124
- @action
125
100
  handleKeyDown(e) {
126
- let { focusedId } = this;
101
+ let {
102
+ focusedId
103
+ } = this;
127
104
  if (focusedId) {
128
105
  let days = this.days;
129
106
  let day, index;
@@ -178,7 +155,6 @@ export default class extends Component {
178
155
  // Methods
179
156
  buildDay(date, today, calendar) {
180
157
  let id = formatDate(date, 'YYYY-MM-DD');
181
-
182
158
  return normalizeCalendarDay({
183
159
  id,
184
160
  number: date.getDate(),
@@ -187,85 +163,62 @@ export default class extends Component {
187
163
  isFocused: this.focusedId === id,
188
164
  isCurrentMonth: date.getMonth() === this.currentCenter.getMonth(),
189
165
  isToday: isSame(date, today, 'day'),
190
- isSelected: this.dayIsSelected(date, calendar),
166
+ isSelected: this.dayIsSelected(date, calendar)
191
167
  });
192
168
  }
193
-
194
169
  buildonSelectValue(day) {
195
170
  return day;
196
171
  }
197
-
198
172
  dayIsSelected(date, calendar = this.args.calendar) {
199
173
  return calendar.selected ? isSame(date, calendar.selected, 'day') : false;
200
174
  }
201
-
202
175
  dayIsDisabled(date) {
203
176
  let isDisabled = !this.args.calendar.actions.select;
204
177
  if (isDisabled) {
205
178
  return true;
206
179
  }
207
-
208
- if (
209
- this.args.minDate &&
210
- isBefore(date, startOf(this.args.minDate, 'day'))
211
- ) {
180
+ if (this.args.minDate && isBefore(date, startOf(this.args.minDate, 'day'))) {
212
181
  return true;
213
182
  }
214
-
215
183
  if (this.args.maxDate && isAfter(date, endOf(this.args.maxDate, 'day'))) {
216
184
  return true;
217
185
  }
218
-
219
186
  if (this.args.disabledDates) {
220
- let disabledInRange = this.args.disabledDates.some((d) => {
187
+ let disabledInRange = this.args.disabledDates.some(d => {
221
188
  let isSameDay = isSame(date, d, 'day');
222
- let isWeekDayIncludes =
223
- WEEK_DAYS.indexOf(d) !== -1 && formatDate(date, 'ddd') === d;
189
+ let isWeekDayIncludes = WEEK_DAYS.indexOf(d) !== -1 && formatDate(date, 'ddd') === d;
224
190
  return isSameDay || isWeekDayIncludes;
225
191
  });
226
-
227
192
  if (disabledInRange) {
228
193
  return true;
229
194
  }
230
195
  }
231
-
232
196
  return false;
233
197
  }
234
-
235
198
  firstDay() {
236
199
  let firstDay = startOf(this.currentCenter, 'month');
237
200
  return startOfWeek(firstDay, this.localeStartOfWeek);
238
201
  }
239
-
240
202
  lastDay() {
241
203
  let localeStartOfWeek = this.localeStartOfWeek;
242
- assert(
243
- 'The center of the calendar is an invalid date.',
244
- !isNaN(this.currentCenter.getTime()),
245
- );
204
+ assert('The center of the calendar is an invalid date.', !isNaN(this.currentCenter.getTime()));
246
205
  let lastDay = endOf(this.currentCenter, 'month');
247
206
  return endOfWeek(lastDay, localeStartOfWeek);
248
207
  }
249
-
250
208
  _updateFocused(id) {
251
209
  this.focusedId = id;
252
210
  }
253
-
254
211
  _focusDate(id) {
255
- let dayElement = document.querySelector(
256
- `[data-power-calendar-id="${this.args.calendar.uniqueId}"] [data-date="${id}"]`,
257
- );
212
+ let dayElement = document.querySelector(`[data-power-calendar-id="${this.args.calendar.uniqueId}"] [data-date="${id}"]`);
258
213
  if (dayElement) {
259
214
  dayElement.focus();
260
215
  }
261
216
  }
262
-
263
- @action
264
217
  handleClick(e) {
265
218
  let dayEl = e.target.closest('[data-date]');
266
219
  if (dayEl) {
267
220
  let dateStr = dayEl.dataset.date;
268
- let day = this.days.find((d) => d.id === dateStr);
221
+ let day = this.days.find(d => d.id === dateStr);
269
222
  if (day) {
270
223
  if (this.args.calendar.actions.select) {
271
224
  this.args.calendar.actions.select(day, this.args.calendar, e);
@@ -273,4 +226,19 @@ export default class extends Component {
273
226
  }
274
227
  }
275
228
  }
276
- }
229
+ }, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "powerCalendarService", [_dec], {
230
+ configurable: true,
231
+ enumerable: true,
232
+ writable: true,
233
+ initializer: null
234
+ }), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "focusedId", [tracked], {
235
+ configurable: true,
236
+ enumerable: true,
237
+ writable: true,
238
+ initializer: function () {
239
+ return undefined;
240
+ }
241
+ }), _applyDecoratedDescriptor(_class.prototype, "handleDayFocus", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleDayFocus"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "handleDayBlur", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleDayBlur"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "handleKeyDown", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleKeyDown"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "handleClick", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleClick"), _class.prototype)), _class)));
242
+
243
+ export { DaysComponent as default };
244
+ //# sourceMappingURL=days.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"days.js","sources":["../../../src/components/power-calendar/days.hbs","../../../src/components/power-calendar/days.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! template-lint-disable no-invalid-interactive }}\\n<div\\n class=\\\"ember-power-calendar-days\\\"\\n {{on \\\"click\\\" this.handleClick}}\\n ...attributes\\n data-power-calendar-id={{or @calendar.calendarUniqueId @calendar.uniqueId}}>\\n <div class=\\\"ember-power-calendar-row ember-power-calendar-weekdays\\\">\\n {{#each this.weekdaysNames as |wdn|}}\\n <div class=\\\"ember-power-calendar-weekday\\\">{{wdn}}</div>\\n {{/each}}\\n </div>\\n <div class=\\\"ember-power-calendar-day-grid\\\" {{on \\\"keydown\\\" this.handleKeyDown}}>\\n {{#each this.weeks key=\\'id\\' as |week|}}\\n <div class=\\\"ember-power-calendar-row ember-power-calendar-week\\\" data-missing-days={{week.missingDays}}>\\n {{#each week.days key=\\'id\\' as |day|}}\\n <button type=\\\"button\\\"\\n data-date=\\\"{{day.id}}\\\"\\n class={{ember-power-calendar-day-classes day @calendar this.weeks @dayClass}}\\n {{on \\\"focus\\\" this.handleDayFocus}}\\n {{on \\\"blur\\\" this.handleDayBlur}}\\n disabled={{day.isDisabled}}>\\n {{#if (has-block)}}\\n {{yield day @calendar this.weeks}}\\n {{else}}\\n {{day.number}}\\n {{/if}}\\n </button>\\n {{/each}}\\n </div>\\n {{/each}}\\n </div>\\n</div>\\n\")","import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { scheduleOnce } from '@ember/runloop';\nimport { inject as service } from '@ember/service';\nimport { assert } from '@ember/debug';\nimport {\n add,\n endOf,\n endOfWeek,\n formatDate,\n getWeekdays,\n getWeekdaysMin,\n getWeekdaysShort,\n isAfter,\n isBefore,\n isSame,\n localeStartOfWeek,\n normalizeCalendarDay,\n normalizeDate,\n startOf,\n startOfWeek,\n withLocale,\n} from '../../utils';\n\nconst WEEK_DAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];\n\nexport default class extends Component {\n @service('power-calendar') powerCalendarService;\n\n @tracked focusedId = undefined;\n\n get weekdayFormat() {\n return this.args.weekdayFormat || 'short'; // \"min\" | \"short\" | \"long\"\n }\n\n get showDaysAround() {\n return this.args.showDaysAround !== undefined\n ? this.args.showDaysAround\n : true;\n }\n\n get weekdaysMin() {\n return withLocale(this.args.calendar.locale, getWeekdaysMin);\n }\n\n get weekdaysShort() {\n return withLocale(this.args.calendar.locale, getWeekdaysShort);\n }\n\n get weekdays() {\n return withLocale(this.args.calendar.locale, getWeekdays);\n }\n\n get localeStartOfWeek() {\n let forcedStartOfWeek = this.args.startOfWeek;\n if (forcedStartOfWeek) {\n return parseInt(forcedStartOfWeek, 10);\n }\n return localeStartOfWeek(this.args.calendar.locale);\n }\n\n get weekdaysNames() {\n let { localeStartOfWeek, weekdayFormat } = this;\n let format = `weekdays${\n weekdayFormat === 'long' ? '' : weekdayFormat === 'min' ? 'Min' : 'Short'\n }`;\n let weekdaysNames = this[format];\n return weekdaysNames\n .slice(localeStartOfWeek)\n .concat(weekdaysNames.slice(0, localeStartOfWeek));\n }\n\n get days() {\n let today = this.powerCalendarService.getDate();\n let lastDay = this.lastDay();\n let day = this.firstDay();\n let days = [];\n while (isBefore(day, lastDay)) {\n days.push(this.buildDay(day, today, this.args.calendar));\n day = add(day, 1, 'day');\n }\n return days;\n }\n\n get weeks() {\n let { showDaysAround, days } = this;\n let weeks = [];\n let i = 0;\n while (days[i]) {\n let daysOfWeek = days.slice(i, i + 7);\n if (!showDaysAround) {\n daysOfWeek = daysOfWeek.filter((d) => d.isCurrentMonth);\n }\n weeks.push({\n id: `week-of-${daysOfWeek[0].id}`,\n days: daysOfWeek,\n missingDays: 7 - daysOfWeek.length,\n });\n i += 7;\n }\n return weeks;\n }\n\n get currentCenter() {\n let center = this.args.center;\n if (!center) {\n center = this.args.selected || this.args.calendar.center;\n }\n return normalizeDate(center);\n }\n\n // Actions\n @action\n handleDayFocus(e) {\n scheduleOnce('actions', this, this._updateFocused, e.target.dataset.date);\n }\n\n @action\n handleDayBlur() {\n scheduleOnce('actions', this, this._updateFocused, null);\n }\n\n @action\n handleKeyDown(e) {\n let { focusedId } = this;\n if (focusedId) {\n let days = this.days;\n let day, index;\n for (let i = 0; i < days.length; i++) {\n if (days[i].id === focusedId) {\n index = i;\n break;\n }\n }\n if (e.keyCode === 38) {\n e.preventDefault();\n let newIndex = Math.max(index - 7, 0);\n day = days[newIndex];\n if (day.isDisabled) {\n for (let i = newIndex + 1; i <= index; i++) {\n day = days[i];\n if (!day.isDisabled) {\n break;\n }\n }\n }\n } else if (e.keyCode === 40) {\n e.preventDefault();\n let newIndex = Math.min(index + 7, days.length - 1);\n day = days[newIndex];\n if (day.isDisabled) {\n for (let i = newIndex - 1; i >= index; i--) {\n day = days[i];\n if (!day.isDisabled) {\n break;\n }\n }\n }\n } else if (e.keyCode === 37) {\n day = days[Math.max(index - 1, 0)];\n if (day.isDisabled) {\n return;\n }\n } else if (e.keyCode === 39) {\n day = days[Math.min(index + 1, days.length - 1)];\n if (day.isDisabled) {\n return;\n }\n } else {\n return;\n }\n this.focusedId = day.id;\n scheduleOnce('afterRender', this, '_focusDate', day.id);\n }\n }\n\n // Methods\n buildDay(date, today, calendar) {\n let id = formatDate(date, 'YYYY-MM-DD');\n\n return normalizeCalendarDay({\n id,\n number: date.getDate(),\n date: new Date(date),\n isDisabled: this.dayIsDisabled(date),\n isFocused: this.focusedId === id,\n isCurrentMonth: date.getMonth() === this.currentCenter.getMonth(),\n isToday: isSame(date, today, 'day'),\n isSelected: this.dayIsSelected(date, calendar),\n });\n }\n\n buildonSelectValue(day) {\n return day;\n }\n\n dayIsSelected(date, calendar = this.args.calendar) {\n return calendar.selected ? isSame(date, calendar.selected, 'day') : false;\n }\n\n dayIsDisabled(date) {\n let isDisabled = !this.args.calendar.actions.select;\n if (isDisabled) {\n return true;\n }\n\n if (\n this.args.minDate &&\n isBefore(date, startOf(this.args.minDate, 'day'))\n ) {\n return true;\n }\n\n if (this.args.maxDate && isAfter(date, endOf(this.args.maxDate, 'day'))) {\n return true;\n }\n\n if (this.args.disabledDates) {\n let disabledInRange = this.args.disabledDates.some((d) => {\n let isSameDay = isSame(date, d, 'day');\n let isWeekDayIncludes =\n WEEK_DAYS.indexOf(d) !== -1 && formatDate(date, 'ddd') === d;\n return isSameDay || isWeekDayIncludes;\n });\n\n if (disabledInRange) {\n return true;\n }\n }\n\n return false;\n }\n\n firstDay() {\n let firstDay = startOf(this.currentCenter, 'month');\n return startOfWeek(firstDay, this.localeStartOfWeek);\n }\n\n lastDay() {\n let localeStartOfWeek = this.localeStartOfWeek;\n assert(\n 'The center of the calendar is an invalid date.',\n !isNaN(this.currentCenter.getTime()),\n );\n let lastDay = endOf(this.currentCenter, 'month');\n return endOfWeek(lastDay, localeStartOfWeek);\n }\n\n _updateFocused(id) {\n this.focusedId = id;\n }\n\n _focusDate(id) {\n let dayElement = document.querySelector(\n `[data-power-calendar-id=\"${this.args.calendar.uniqueId}\"] [data-date=\"${id}\"]`,\n );\n if (dayElement) {\n dayElement.focus();\n }\n }\n\n @action\n handleClick(e) {\n let dayEl = e.target.closest('[data-date]');\n if (dayEl) {\n let dateStr = dayEl.dataset.date;\n let day = this.days.find((d) => d.id === dateStr);\n if (day) {\n if (this.args.calendar.actions.select) {\n this.args.calendar.actions.select(day, this.args.calendar, e);\n }\n }\n }\n }\n}\n"],"names":["WEEK_DAYS","setComponentTemplate","TEMPLATE","_dec","service","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","weekdayFormat","showDaysAround","undefined","weekdaysMin","withLocale","calendar","locale","getWeekdaysMin","weekdaysShort","getWeekdaysShort","weekdays","getWeekdays","localeStartOfWeek","forcedStartOfWeek","startOfWeek","parseInt","weekdaysNames","format","slice","concat","days","today","powerCalendarService","getDate","lastDay","day","firstDay","isBefore","push","buildDay","add","weeks","i","daysOfWeek","filter","d","isCurrentMonth","id","missingDays","length","currentCenter","center","selected","normalizeDate","handleDayFocus","e","scheduleOnce","_updateFocused","target","dataset","date","handleDayBlur","handleKeyDown","focusedId","index","keyCode","preventDefault","newIndex","Math","max","isDisabled","min","formatDate","normalizeCalendarDay","number","Date","dayIsDisabled","isFocused","getMonth","isToday","isSame","isSelected","dayIsSelected","buildonSelectValue","actions","select","minDate","startOf","maxDate","isAfter","endOf","disabledDates","disabledInRange","some","isSameDay","isWeekDayIncludes","indexOf","assert","isNaN","getTime","endOfWeek","_focusDate","dayElement","document","querySelector","uniqueId","focus","handleClick","dayEl","closest","dateStr","find","_applyDecoratedDescriptor","prototype","configurable","enumerable","writable","initializer","tracked","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;;;AACA,eAAe,kBAAkB,CAAC,owCAAowC;;;ACwBtyC,MAAMA,SAAS,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;AAEnE,oBAAAC,oBAAA,CAAAC,QAAA,GAAAC,IAAA,GACGC,MAAO,CAAC,gBAAgB,CAAC,GAAAC,MAAA,GAAA,MAAAA,MAAA,SADCC,SAAS,CAAC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,+BAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAAD,IAAAA,0BAAA,oBAAAE,YAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;EAKrC,IAAIC,aAAaA,GAAG;IAClB,OAAO,IAAI,CAACJ,IAAI,CAACI,aAAa,IAAI,OAAO,CAAC;AAC5C,GAAA;EAEA,IAAIC,cAAcA,GAAG;AACnB,IAAA,OAAO,IAAI,CAACL,IAAI,CAACK,cAAc,KAAKC,SAAS,GACzC,IAAI,CAACN,IAAI,CAACK,cAAc,GACxB,IAAI,CAAA;AACV,GAAA;EAEA,IAAIE,WA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AAoG,yBAAA,CAAA7G,MAAA,CAAA8G,SAAA,qBAmF7BM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAtH,MAAA,CAAA8G,SAAA,EAAA,gBAAA,CAAA,EAAA9G,MAAA,CAAA8G,SAAA,CAAAD,EAAAA,yBAAA,CAAA7G,MAAA,CAAA8G,SAAA,EAAA,eAAA,EAAA,CAKNM,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAtH,MAAA,CAAA8G,SAAA,EAAA9G,eAAAA,CAAAA,EAAAA,MAAA,CAAA8G,SAAA,CAAA,EAAAD,yBAAA,CAAA7G,MAAA,CAAA8G,SAAA,EAKNM,eAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAAtH,MAAA,CAAA8G,SAAA,oBAAA9G,MAAA,CAAA8G,SAAA,CAAAD,EAAAA,yBAAA,CAAA7G,MAAA,CAAA8G,SAAA,EAAA,aAAA,EAAA,CA2INM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAtH,MAAA,CAAA8G,SAAA,EAAA,aAAA,CAAA,EAAA9G,MAAA,CAAA8G,SAAA,IAAA9G,MAAA,CAAA,EAAA;;;;"}
@@ -0,0 +1,17 @@
1
+ import Component from '@glimmer/component';
2
+ import { precompileTemplate } from '@ember/template-compilation';
3
+ import { setComponentTemplate } from '@ember/component';
4
+
5
+ var TEMPLATE = precompileTemplate("<nav class=\"ember-power-calendar-nav\">\n {{#if @calendar.actions.changeCenter}}\n <button type=\"button\" class=\"ember-power-calendar-nav-control ember-power-calendar-nav-control--previous\" {{on \"click\" (fn @calendar.actions.moveCenter -1 this.unit @calendar)}}>«</button>\n {{/if}}\n <div class=\"ember-power-calendar-nav-title\">\n {{#if (has-block)}}\n {{yield @calendar}}\n {{else}}\n {{power-calendar-format-date @calendar.center this.format locale=@calendar.locale}}\n {{/if}}\n </div>\n {{#if @calendar.actions.changeCenter}}\n <button type=\"button\" class=\"ember-power-calendar-nav-control ember-power-calendar-nav-control--next\" {{on \"click\" (fn @calendar.actions.moveCenter 1 this.unit @calendar)}}>»</button>\n {{/if}}\n</nav>\n");
6
+
7
+ var PowerCalendarNavComponent = setComponentTemplate(TEMPLATE, class extends Component {
8
+ get unit() {
9
+ return this.args.unit || 'month';
10
+ }
11
+ get format() {
12
+ return this.args.format || 'MMMM YYYY';
13
+ }
14
+ });
15
+
16
+ export { PowerCalendarNavComponent as default };
17
+ //# sourceMappingURL=nav.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nav.js","sources":["../../../src/components/power-calendar/nav.hbs","../../../src/components/power-calendar/nav.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"<nav class=\\\"ember-power-calendar-nav\\\">\\n {{#if @calendar.actions.changeCenter}}\\n <button type=\\\"button\\\" class=\\\"ember-power-calendar-nav-control ember-power-calendar-nav-control--previous\\\" {{on \\\"click\\\" (fn @calendar.actions.moveCenter -1 this.unit @calendar)}}>«</button>\\n {{/if}}\\n <div class=\\\"ember-power-calendar-nav-title\\\">\\n {{#if (has-block)}}\\n {{yield @calendar}}\\n {{else}}\\n {{power-calendar-format-date @calendar.center this.format locale=@calendar.locale}}\\n {{/if}}\\n </div>\\n {{#if @calendar.actions.changeCenter}}\\n <button type=\\\"button\\\" class=\\\"ember-power-calendar-nav-control ember-power-calendar-nav-control--next\\\" {{on \\\"click\\\" (fn @calendar.actions.moveCenter 1 this.unit @calendar)}}>»</button>\\n {{/if}}\\n</nav>\\n\")","import Component from '@glimmer/component';\n\nexport default class extends Component {\n get unit() {\n return this.args.unit || 'month';\n }\n\n get format() {\n return this.args.format || 'MMMM YYYY';\n }\n}\n"],"names":["setComponentTemplate","TEMPLATE","Component","unit","args","format"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,+wBAA+wB;;ACCjzB,gCAAAA,oBAAA,CAAAC,QAAA,EAAA,cAA6BC,SAAS,CAAC;EACrC,IAAIC,IAAIA,GAAG;AACT,IAAA,OAAO,IAAI,CAACC,IAAI,CAACD,IAAI,IAAI,OAAO,CAAA;AAClC,GAAA;EAEA,IAAIE,MAAMA,GAAG;AACX,IAAA,OAAO,IAAI,CAACD,IAAI,CAACC,MAAM,IAAI,WAAW,CAAA;AACxC,GAAA;AACF,CAAC,CAAA;;;;"}
@@ -0,0 +1,22 @@
1
+ import DaysComponent from '../power-calendar/days.js';
2
+ import { isSame } from '../../utils.js';
3
+
4
+ class PowerCalendarMultipleDaysComponent extends DaysComponent {
5
+ get maxLength() {
6
+ return this.args.maxLength || Infinity;
7
+ }
8
+
9
+ // Methods
10
+ dayIsSelected(date, calendar = this.args.calendar) {
11
+ let selected = calendar.selected || [];
12
+ return selected.some(d => isSame(date, d, 'day'));
13
+ }
14
+ dayIsDisabled(date) {
15
+ let numSelected = this.args.calendar.selected && this.args.calendar.selected.length || 0;
16
+ let maxLength = this.maxLength || Infinity;
17
+ return super.dayIsDisabled(...arguments) || numSelected >= maxLength && !this.dayIsSelected(date);
18
+ }
19
+ }
20
+
21
+ export { PowerCalendarMultipleDaysComponent as default };
22
+ //# sourceMappingURL=days.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"days.js","sources":["../../../src/components/power-calendar-multiple/days.js"],"sourcesContent":["import DaysComponent from '../power-calendar/days';\nimport { isSame } from '../../utils';\n\nexport default class extends DaysComponent {\n get maxLength() {\n return this.args.maxLength || Infinity;\n }\n\n // Methods\n dayIsSelected(date, calendar = this.args.calendar) {\n let selected = calendar.selected || [];\n return selected.some((d) => isSame(date, d, 'day'));\n }\n\n dayIsDisabled(date) {\n let numSelected =\n (this.args.calendar.selected && this.args.calendar.selected.length) || 0;\n let maxLength = this.maxLength || Infinity;\n return (\n super.dayIsDisabled(...arguments) ||\n (numSelected >= maxLength && !this.dayIsSelected(date))\n );\n }\n}\n"],"names":["DaysComponent","maxLength","args","Infinity","dayIsSelected","date","calendar","selected","some","d","isSame","dayIsDisabled","numSelected","length","arguments"],"mappings":";;;AAGe,wCAAA,SAAcA,aAAa,CAAC;EACzC,IAAIC,SAASA,GAAG;AACd,IAAA,OAAO,IAAI,CAACC,IAAI,CAACD,SAAS,IAAIE,QAAQ,CAAA;AACxC,GAAA;;AAEA;EACAC,aAAaA,CAACC,IAAI,EAAEC,QAAQ,GAAG,IAAI,CAACJ,IAAI,CAACI,QAAQ,EAAE;AACjD,IAAA,IAAIC,QAAQ,GAAGD,QAAQ,CAACC,QAAQ,IAAI,EAAE,CAAA;AACtC,IAAA,OAAOA,QAAQ,CAACC,IAAI,CAAEC,CAAC,IAAKC,MAAM,CAACL,IAAI,EAAEI,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA;AACrD,GAAA;EAEAE,aAAaA,CAACN,IAAI,EAAE;IAClB,IAAIO,WAAW,GACZ,IAAI,CAACV,IAAI,CAACI,QAAQ,CAACC,QAAQ,IAAI,IAAI,CAACL,IAAI,CAACI,QAAQ,CAACC,QAAQ,CAACM,MAAM,IAAK,CAAC,CAAA;AAC1E,IAAA,IAAIZ,SAAS,GAAG,IAAI,CAACA,SAAS,IAAIE,QAAQ,CAAA;AAC1C,IAAA,OACE,KAAK,CAACQ,aAAa,CAAC,GAAGG,SAAS,CAAC,IAChCF,WAAW,IAAIX,SAAS,IAAI,CAAC,IAAI,CAACG,aAAa,CAACC,IAAI,CAAE,CAAA;AAE3D,GAAA;AACF;;;;"}