lanes 0.3.0 → 0.4.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 (104) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/client/lanes/Config.coffee +1 -1
  4. data/client/lanes/access/LoginDialog.cjsx +1 -1
  5. data/client/lanes/access/Roles.coffee +1 -1
  6. data/client/lanes/access/User.coffee +2 -2
  7. data/client/lanes/access/screens/user-management/UserManagement.cjsx +1 -1
  8. data/client/lanes/components/calendar/styles.scss +1 -1
  9. data/client/lanes/components/grid/Body.cjsx +5 -2
  10. data/client/lanes/components/grid/EditingMixin.cjsx +3 -0
  11. data/client/lanes/components/grid/Editor.cjsx +3 -11
  12. data/client/lanes/components/grid/Grid.cjsx +22 -12
  13. data/client/lanes/components/grid/Selections.cjsx +4 -1
  14. data/client/lanes/components/grid/Toolbar.cjsx +1 -1
  15. data/client/lanes/components/record-finder/RecordFinder.cjsx +2 -2
  16. data/client/lanes/components/select-field/SelectField.cjsx +19 -16
  17. data/client/lanes/components/select-field/styles.scss +1 -1
  18. data/client/lanes/components/shared/FieldMixin.cjsx +2 -2
  19. data/client/lanes/components/shared/Input.cjsx +2 -13
  20. data/client/lanes/components/shared/InputFieldMixin.cjsx +15 -8
  21. data/client/lanes/components/shared/NetworkActivityOverlay.cjsx +1 -1
  22. data/client/lanes/components/shared/NumberInput.cjsx +4 -12
  23. data/client/lanes/components/shared/ToggleField.cjsx +0 -2
  24. data/client/lanes/components/shared/fields.scss +9 -0
  25. data/client/lanes/components/shared/styles.scss +2 -1
  26. data/client/lanes/components/toolbar/Toolbar.cjsx +1 -1
  27. data/client/lanes/lib/HotReload.coffee +2 -2
  28. data/client/lanes/lib/development.coffee +1 -1
  29. data/client/lanes/lib/loader.coffee +3 -3
  30. data/client/lanes/models/AssociationMap.coffee +1 -1
  31. data/client/lanes/models/AssociationProxy.coffee +1 -0
  32. data/client/lanes/models/Base.coffee +7 -10
  33. data/client/lanes/models/Collection.coffee +3 -6
  34. data/client/lanes/models/JobStatus.coffee +1 -1
  35. data/client/lanes/models/PubSub.coffee +51 -33
  36. data/client/lanes/models/Query.coffee +1 -1
  37. data/client/lanes/models/Sync.coffee +1 -1
  38. data/client/lanes/models/User.coffee +3 -3
  39. data/client/lanes/models/mixins/FileSupport.coffee +3 -3
  40. data/client/lanes/models/query/ArrayResult.coffee +3 -6
  41. data/client/lanes/models/query/CollectionResult.coffee +5 -3
  42. data/client/lanes/react/Component.coffee +2 -2
  43. data/client/lanes/react/DefaultComponentNotFound.cjsx +2 -2
  44. data/client/lanes/react/Screen.coffee +1 -1
  45. data/client/lanes/react/Viewport.coffee +1 -1
  46. data/client/lanes/react/mixins/Access.coffee +1 -1
  47. data/client/lanes/react/mixins/Data.coffee +9 -5
  48. data/client/lanes/screens/Commands.coffee +1 -1
  49. data/client/lanes/screens/UserPreferences.cjsx +1 -1
  50. data/client/lanes/testing/BeforeEach.coffee +7 -0
  51. data/client/lanes/vendor/base.js.erb +5 -0
  52. data/client/lanes/vendor/calendar.js.erb +5 -0
  53. data/client/lanes/vendor/commons.js.erb +5 -0
  54. data/client/lanes/vendor/{base.js → development/base.js} +37776 -40850
  55. data/client/lanes/vendor/development/calendar.js +1667 -0
  56. data/client/lanes/vendor/development/commons.js +39085 -0
  57. data/client/lanes/vendor/development/helpers.js +578 -0
  58. data/client/lanes/vendor/{toggle.js → development/toggle.js} +22 -82
  59. data/client/lanes/vendor/development/widgets.js +8975 -0
  60. data/client/lanes/vendor/production/base.js +63239 -0
  61. data/client/lanes/vendor/production/calendar.js +1667 -0
  62. data/client/lanes/vendor/production/commons.js +38505 -0
  63. data/client/lanes/vendor/production/toggle.js +285 -0
  64. data/client/lanes/vendor/production/widgets.js +8975 -0
  65. data/client/lanes/vendor/{calendar.scss → styles/calendar.scss} +6 -0
  66. data/client/lanes/vendor/{toggle.scss → styles/toggle.scss} +0 -0
  67. data/client/lanes/vendor/{widgets.scss → styles/widgets.scss} +2 -2
  68. data/client/lanes/vendor/toggle.js.erb +5 -0
  69. data/client/lanes/vendor/widgets.js.erb +5 -0
  70. data/lib/lanes/api/default_routes.rb +3 -3
  71. data/lib/lanes/api/routing.rb +1 -1
  72. data/lib/lanes/configuration.rb +8 -14
  73. data/lib/lanes/environment.rb +3 -0
  74. data/lib/lanes/extension/definition.rb +4 -0
  75. data/lib/lanes/system_settings.rb +21 -6
  76. data/lib/lanes/version.rb +1 -1
  77. data/npm-build/base.js +9 -4
  78. data/npm-build/build +9 -0
  79. data/npm-build/development.js +3 -1
  80. data/npm-build/package.json +34 -34
  81. data/npm-build/update-dayz +1 -1
  82. data/npm-build/webpack.config.js +36 -20
  83. data/spec/command-reference-files/initial/Gemfile +1 -1
  84. data/spec/command-reference-files/screen/config/screens.rb +1 -1
  85. data/spec/lanes/components/grid/RowEditorSpec.coffee +3 -1
  86. data/spec/lanes/components/select-field/SelectFieldSpec.coffee +33 -28
  87. data/spec/lanes/models/AssociationProxySpec.coffee +36 -37
  88. data/spec/lanes/models/BaseSpec.coffee +0 -32
  89. data/spec/lanes/models/CollectionSpec.coffee +0 -10
  90. data/spec/lanes/models/PubSubSpec.coffee +63 -13
  91. data/spec/lanes/screens/DefinitionsSpec.coffee +2 -2
  92. metadata +23 -20
  93. data/client/lanes/vendor/calendar.js +0 -17301
  94. data/client/lanes/vendor/commons.js +0 -19722
  95. data/client/lanes/vendor/development.js +0 -5471
  96. data/client/lanes/vendor/grid.js +0 -15384
  97. data/client/lanes/vendor/grid.scss +0 -928
  98. data/client/lanes/vendor/rw-widgets.eot +0 -0
  99. data/client/lanes/vendor/rw-widgets.svg +0 -18
  100. data/client/lanes/vendor/rw-widgets.ttf +0 -0
  101. data/client/lanes/vendor/rw-widgets.woff +0 -0
  102. data/client/lanes/vendor/widgets.js +0 -23204
  103. data/npm-build/compile.coffee +0 -19
  104. data/spec/lanes/models/ServerCacheSpec.coffee +0 -65
@@ -0,0 +1,1667 @@
1
+ webpackJsonp([1],{
2
+
3
+ /***/ 0:
4
+ /***/ function(module, exports, __webpack_require__) {
5
+
6
+ /* WEBPACK VAR INJECTION */(function(global) {var Lanes = ( global.Lanes || (global.Lanes = {}) );
7
+ Lanes.Vendor = ( Lanes.Vendor || {} );
8
+
9
+ Lanes.Vendor.Dayz = __webpack_require__(895);
10
+
11
+ __webpack_require__(921);
12
+
13
+ /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
14
+
15
+ /***/ },
16
+
17
+ /***/ 895:
18
+ /***/ function(module, exports, __webpack_require__) {
19
+
20
+ 'use strict';
21
+
22
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
23
+
24
+ var React = __webpack_require__(66);
25
+ var moment = __webpack_require__(695);
26
+ var Layout = __webpack_require__(896);
27
+ var Day = __webpack_require__(900);
28
+ var XLabels = __webpack_require__(903);
29
+ var YLabels = __webpack_require__(906);
30
+
31
+ __webpack_require__(887); // needed in order to for range to install itself
32
+
33
+ var EventsCollection = __webpack_require__(910);
34
+
35
+ var Dayz = React.createClass({
36
+ displayName: 'Dayz',
37
+
38
+
39
+ propTypes: {
40
+ editComponent: React.PropTypes.func,
41
+ display: React.PropTypes.oneOf(['month', 'week', 'day']),
42
+ date: React.PropTypes.object.isRequired,
43
+ displayHours: React.PropTypes.array,
44
+ events: React.PropTypes.instanceOf(EventsCollection),
45
+ onDayClick: React.PropTypes.func,
46
+ onDayDoubleClick: React.PropTypes.func,
47
+ onEventClick: React.PropTypes.func,
48
+ onEventResize: React.PropTypes.func
49
+ },
50
+
51
+ getDefaultProps: function getDefaultProps() {
52
+ return {
53
+ display: 'month'
54
+ };
55
+ },
56
+ componentWillMount: function componentWillMount() {
57
+ this.calculateLayout(this.props);
58
+ },
59
+ componentWillUnmount: function componentWillUnmount() {
60
+ this.detachEventBindings();
61
+ },
62
+ detachEventBindings: function detachEventBindings() {
63
+ if (this.props.events) {
64
+ this.props.events.off('change', this.onEventAdd);
65
+ }
66
+ },
67
+ componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
68
+ this.calculateLayout(nextProps);
69
+ },
70
+ onEventsChange: function onEventsChange() {
71
+ this.calculateLayout(this.props);
72
+ },
73
+ calculateLayout: function calculateLayout(props) {
74
+ var range = moment.range(props.date.clone().startOf(props.display), props.date.clone().endOf(props.display));
75
+ if (props.events) {
76
+ this.detachEventBindings();
77
+ props.events.on('change', this.onEventsChange, this);
78
+ }
79
+ if (props.display === 'month') {
80
+ range.start.subtract(range.start.weekday(), 'days');
81
+ range.end.add(6 - range.end.weekday(), 'days');
82
+ }
83
+
84
+ var layout = new Layout(_extends({}, props, { range: range }));
85
+
86
+ this.setState({ range: range, layout: layout });
87
+ },
88
+ render: function render() {
89
+ var _this = this;
90
+
91
+ var classes = ["dayz", this.props.display];
92
+ var days = [];
93
+ this.state.range.by('days', function (day) {
94
+ return days.push(React.createElement(Day, { key: day.format('YYYYMMDD'),
95
+ day: day,
96
+ position: days.length,
97
+ layout: _this.state.layout,
98
+ editComponent: _this.props.editComponent,
99
+ onClick: _this.props.onDayClick,
100
+ onDoubleClick: _this.props.onDayDoubleClick,
101
+ onEventClick: _this.props.onEventClick,
102
+ onEventResize: _this.props.onEventResize
103
+
104
+ }));
105
+ });
106
+ return React.createElement(
107
+ 'div',
108
+ { className: classes.join(' ') },
109
+ React.createElement(XLabels, { date: this.props.date, display: this.props.display }),
110
+ React.createElement(
111
+ 'div',
112
+ { className: 'body' },
113
+ React.createElement(YLabels, {
114
+ layout: this.state.layout,
115
+ display: this.props.display,
116
+ date: this.props.date
117
+ }),
118
+ React.createElement(
119
+ 'div',
120
+ { className: 'days' },
121
+ days,
122
+ this.props.children
123
+ )
124
+ )
125
+ );
126
+ }
127
+ });
128
+
129
+ Dayz.EventsCollection = EventsCollection;
130
+
131
+ module.exports = Dayz;
132
+
133
+ /***/ },
134
+
135
+ /***/ 896:
136
+ /***/ function(module, exports, __webpack_require__) {
137
+
138
+ 'use strict';
139
+
140
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
141
+
142
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
143
+
144
+ var assign = __webpack_require__(341);
145
+ var each = __webpack_require__(897);
146
+ var moment = __webpack_require__(695);
147
+ var EventLayout = __webpack_require__(898);
148
+ var C = __webpack_require__(899);
149
+
150
+ function cacheKey(day) {
151
+ return day.format('YYYYMMDD');
152
+ }
153
+
154
+ // a layout describes how the calendar is displayed.
155
+
156
+ var Layout = function () {
157
+ function Layout(options) {
158
+ var _this = this;
159
+
160
+ _classCallCheck(this, Layout);
161
+
162
+ assign(this, options);
163
+ this.cache = Object.create(null);
164
+
165
+ var multiDayCount = 0;
166
+ var cacheMethod = 'day' === this.display ? 'addtoDaysCache' : 'calculateSpanningLayout';
167
+ if (!this.events) {
168
+ return;
169
+ }
170
+ var range = this.range;
171
+
172
+ this.events.each(function (event) {
173
+ // we only care about events that are in the range we were provided
174
+ if (range.overlaps(event.range())) {
175
+ _this[cacheMethod](event);
176
+ if (!event.isSingleDay()) {
177
+ multiDayCount += 1;
178
+ }
179
+ }
180
+ });
181
+ this.multiDayCount = multiDayCount;
182
+ this.calculateStacking();
183
+ if (!this.isDisplayingAsMonth() && !this.displayHours) {
184
+ this.displayHours = this.hourRange();
185
+ } else {
186
+ this.displayHours = this.displayHours || [0, 24];
187
+ }
188
+ }
189
+
190
+ _createClass(Layout, [{
191
+ key: 'minutesInDay',
192
+ value: function minutesInDay() {
193
+ return (this.displayHours[1] - this.displayHours[0]) * 60;
194
+ }
195
+ }, {
196
+ key: 'propsForDayContainer',
197
+ value: function propsForDayContainer(props) {
198
+ var classes = ['day'];
199
+ if (this.isDateOutsideRange(props.day)) {
200
+ classes.push('outside');
201
+ }
202
+ return { className: classes.join(' '), style: { order: props.position } };
203
+ }
204
+ }, {
205
+ key: 'propsForAllDayEventContainer',
206
+ value: function propsForAllDayEventContainer() {
207
+ var style = this.multiDayCount ? { flexBasis: this.multiDayCount * C.eventHeight } : { display: 'none' };
208
+ return { className: 'all-day', style: style };
209
+ }
210
+ }, {
211
+ key: 'hourRange',
212
+ value: function hourRange() {
213
+ var _this2 = this;
214
+
215
+ var range = [7, 19];
216
+ this.range.by('days', function (day) {
217
+ each(_this2.forDay(day), function (layout) {
218
+ range[0] = Math.min(layout.event.start().hour(), range[0]);
219
+ range[1] = Math.max(layout.event.end().hour(), range[1]);
220
+ });
221
+ });
222
+ range[1] += 1;
223
+ return range;
224
+ }
225
+ }, {
226
+ key: 'getEventsForWeek',
227
+ value: function getEventsForWeek(start) {
228
+ var day = start.clone();
229
+ var weeklyEvents = [];
230
+ for (var i = 0; i < 7; i++) {
231
+ var layouts = this.forDay(day);
232
+ each(layouts, function (layout) {
233
+ weeklyEvents.push(layout);
234
+ });
235
+ day.add(1, 'day');
236
+ }
237
+ var minLong = function minLong(range) {
238
+ return moment.max(start, range.start).diff(moment.min(day, range.end), 'minutes');
239
+ };
240
+ return weeklyEvents.sort(function (a, b) {
241
+ a = minLong(a.event.range());b = minLong(b.event.range());
242
+ return a === b ? 0 : a > b ? 1 : -1;
243
+ });
244
+ }
245
+ }, {
246
+ key: 'calculateStacking',
247
+ value: function calculateStacking() {
248
+ var firstOfWeek = this.range.start.clone().startOf('week');
249
+ do {
250
+ var weeklyEvents = this.getEventsForWeek(firstOfWeek);
251
+ for (var layoutIndex = 0; layoutIndex < weeklyEvents.length; layoutIndex++) {
252
+ var layout = weeklyEvents[layoutIndex];
253
+ // loop through each layout that is before this one
254
+ var ceilingIndex = 0;
255
+ for (var pi = layoutIndex - 1; pi >= 0; pi--) {
256
+ var prevLayout = weeklyEvents[pi];
257
+ if (prevLayout.range.start.isSame(layout.range.start, 'd')) {
258
+ ceilingIndex = pi + 1;
259
+ break;
260
+ }
261
+ }
262
+ for (var _pi = ceilingIndex; _pi < layoutIndex; _pi++) {
263
+ var _prevLayout = weeklyEvents[_pi];
264
+ if (layout.range.overlaps(_prevLayout.range)) {
265
+ layout.stack++;
266
+ }
267
+ }
268
+ }
269
+ firstOfWeek.add(7, 'day');
270
+ } while (!firstOfWeek.isAfter(this.range.end));
271
+ }
272
+ }, {
273
+ key: 'isDateOutsideRange',
274
+ value: function isDateOutsideRange(date) {
275
+ return this.isDisplayingAsMonth() && this.date.month() !== date.month();
276
+ }
277
+ }, {
278
+ key: 'forDay',
279
+ value: function forDay(day) {
280
+ return this.cache[cacheKey(day)] || [];
281
+ }
282
+
283
+ // a single day is easy, just add the event to that day
284
+
285
+ }, {
286
+ key: 'addtoDaysCache',
287
+ value: function addtoDaysCache(event) {
288
+ var layout = new EventLayout(this, event, this.range);
289
+ this.addToCache(this.range.start, layout);
290
+ }
291
+
292
+ // other layouts must break at week boundaries, with indicators if they were/are continuing
293
+
294
+ }, {
295
+ key: 'calculateSpanningLayout',
296
+ value: function calculateSpanningLayout(event) {
297
+ var end = moment.min(this.range.end, event.range().end);
298
+ var start = moment.max(this.range.start, event.range().start).clone();
299
+ do {
300
+ var range = moment.range(start, start.clone().endOf('week'));
301
+ var layout = new EventLayout(this, event, range);
302
+ this.addToCache(start, layout);
303
+ // go to first day of next week
304
+ start.add(7 - start.day(), 'day');
305
+ } while (!start.isAfter(end));
306
+ }
307
+ }, {
308
+ key: 'addToCache',
309
+ value: function addToCache(date, eventLayout) {
310
+ date = date.clone();
311
+ var found = false;
312
+ each(this.cache, function (key, layout) {
313
+ if (layout.event === eventLayout.event) {
314
+ found = true;
315
+ return false;
316
+ }
317
+ });
318
+ if (!found) {
319
+ eventLayout.first = true;
320
+ }
321
+ var dayCache = this.cache[cacheKey(date)] || (this.cache[cacheKey(date)] = []);
322
+ dayCache.push(eventLayout);
323
+ }
324
+ }, {
325
+ key: 'displayingAs',
326
+ value: function displayingAs() {
327
+ return this.display;
328
+ }
329
+ }, {
330
+ key: 'isDisplayingAsMonth',
331
+ value: function isDisplayingAsMonth() {
332
+ return 'month' === this.display;
333
+ }
334
+ }]);
335
+
336
+ return Layout;
337
+ }();
338
+
339
+ module.exports = Layout;
340
+
341
+ /***/ },
342
+
343
+ /***/ 897:
344
+ /***/ function(module, exports, __webpack_require__) {
345
+
346
+ module.exports = __webpack_require__(350);
347
+
348
+
349
+ /***/ },
350
+
351
+ /***/ 898:
352
+ /***/ function(module, exports, __webpack_require__) {
353
+
354
+ 'use strict';
355
+
356
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
357
+
358
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
359
+
360
+ var moment = __webpack_require__(695);
361
+
362
+ // an event layout describes how an event is displayed.
363
+ // A event may be split into one or more layouts in order to be split across week boundaries
364
+
365
+ var EventLayout = function () {
366
+ function EventLayout(layout, event, displayRange) {
367
+ _classCallCheck(this, EventLayout);
368
+
369
+ this.layout = layout;
370
+ this.event = event;
371
+ this.stack = 0;
372
+ this.displayRange = displayRange;
373
+ this.startsBefore = event.start().isBefore(displayRange.start);
374
+ this.endsAfter = event.end().isAfter(displayRange.end);
375
+ this.range = moment.range(moment.max(displayRange.start, event.start()), moment.min(displayRange.end, event.end()));
376
+ var latest = moment.min(displayRange.end, event.end());
377
+ this.span = Math.max(1, Math.round(latest.diff(displayRange.start, 'day', true)));
378
+ }
379
+
380
+ _createClass(EventLayout, [{
381
+ key: 'isEditing',
382
+ value: function isEditing() {
383
+ return this.first && this.event.isEditing();
384
+ }
385
+ }, {
386
+ key: 'startsOnWeek',
387
+ value: function startsOnWeek() {
388
+ return 0 === this.event.start().day();
389
+ }
390
+ }, {
391
+ key: 'adjustEventTime',
392
+ value: function adjustEventTime(startOrEnd, position, height) {
393
+ if (position < 0 || position > height) {
394
+ return;
395
+ }
396
+ var time = this.event[startOrEnd]().startOf('day').add(this.layout.displayHours[0], 'hours').add(this.layout.minutesInDay() * (position / height), 'minutes');
397
+ var step = this.event.get('resizable').step;
398
+ if (step) {
399
+ var rounded = Math.round(time.minute() / step) * step;
400
+ time.minute(rounded).second(0);
401
+ }
402
+ this.event.emit('change');
403
+ }
404
+ }, {
405
+ key: 'inlineStyles',
406
+ value: function inlineStyles() {
407
+ if (this.layout.displayingAs() === 'month' || !this.event.isSingleDay()) {
408
+ return {};
409
+ } else {
410
+ var _event$daysMinuteRang = this.event.daysMinuteRange();
411
+
412
+ var start = _event$daysMinuteRang.start;
413
+ var end = _event$daysMinuteRang.end;
414
+
415
+ var startOffset = this.layout.displayHours[0] * 60;
416
+ start -= startOffset;
417
+ end -= startOffset;
418
+ var inday = this.layout.minutesInDay();
419
+ var top = (start / inday * 100).toFixed(2) + '%';
420
+ var bottom = (100 - end / inday * 100).toFixed(2) + '%';
421
+ return { top: top, bottom: bottom };
422
+ }
423
+ }
424
+ }, {
425
+ key: 'isResizable',
426
+ value: function isResizable() {
427
+ return this.layout.displayingAs() !== 'month' && this.event.get('resizable');
428
+ }
429
+ }, {
430
+ key: 'key',
431
+ value: function key() {
432
+ return this.displayRange.start.format('YYYYMMDD') + this.event.key;
433
+ }
434
+ }, {
435
+ key: 'setIsResizing',
436
+ value: function setIsResizing(val) {
437
+ this.isResizing = val;
438
+ }
439
+ }, {
440
+ key: 'classNames',
441
+ value: function classNames() {
442
+ var classes = ['event', 'span-' + this.span, 'color-' + this.event.colorIndex()];
443
+ if (this.isResizing) classes.push('is-resizing');
444
+ if (this.startsBefore) classes.push('is-continuation');
445
+ if (this.endsAfter) classes.push('is-continued');
446
+ if (this.stack) classes.push('stack-' + this.stack);
447
+ if (this.isEditing()) classes.push('is-editing');
448
+ if (this.isResizable()) classes.push('is-resizable');
449
+ return classes.join(' ');
450
+ }
451
+ }]);
452
+
453
+ return EventLayout;
454
+ }();
455
+
456
+ module.exports = EventLayout;
457
+
458
+ /***/ },
459
+
460
+ /***/ 899:
461
+ /***/ function(module, exports) {
462
+
463
+ "use strict";
464
+
465
+ module.exports = {
466
+
467
+ eventHeight: 20 // px
468
+
469
+ };
470
+
471
+ /***/ },
472
+
473
+ /***/ 900:
474
+ /***/ function(module, exports, __webpack_require__) {
475
+
476
+ 'use strict';
477
+
478
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
479
+
480
+ var React = __webpack_require__(66);
481
+ var Layout = __webpack_require__(896);
482
+ var Event = __webpack_require__(901);
483
+ var Label = __webpack_require__(902);
484
+ var assign = __webpack_require__(341);
485
+ var each = __webpack_require__(897);
486
+ var ReactDOM = __webpack_require__(96);
487
+
488
+ var IsDayClass = new RegExp('(\\s|^)(events|day|label)(\\s|$)');
489
+
490
+ var Day = React.createClass({
491
+ displayName: 'Day',
492
+
493
+
494
+ propTypes: {
495
+ day: React.PropTypes.object.isRequired,
496
+ layout: React.PropTypes.instanceOf(Layout).isRequired,
497
+ position: React.PropTypes.number.isRequired,
498
+ onClick: React.PropTypes.func,
499
+ onDoubleClick: React.PropTypes.func,
500
+ onEventClick: React.PropTypes.func,
501
+ onEventResize: React.PropTypes.func,
502
+ editComponent: React.PropTypes.func,
503
+ onEventDoubleClick: React.PropTypes.func
504
+ },
505
+
506
+ getInitialState: function getInitialState() {
507
+ return { resize: false };
508
+ },
509
+ getBounds: function getBounds() {
510
+ return ReactDOM.findDOMNode(this).getBoundingClientRect();
511
+ },
512
+ _onClickHandler: function _onClickHandler(ev, handler) {
513
+ if (!handler || !IsDayClass.test(ev.target.className) || this.lastMouseUp && this.lastMouseUp < new Date().getMilliseconds() + 100) {
514
+ return;
515
+ }
516
+ this.lastMouseUp = 0;
517
+ var bounds = this.getBounds();
518
+ var perc = (ev.clientY - bounds.top) / ev.target.offsetHeight;
519
+ var hours = this.props.layout.displayHours[0] + this.props.layout.minutesInDay() * perc / 60;
520
+ handler.call(this, ev, this.props.day.clone().startOf('day').add(hours, 'hour'));
521
+ },
522
+ onClick: function onClick(ev) {
523
+ this._onClickHandler(ev, this.props.onClick);
524
+ },
525
+ onDoubleClick: function onDoubleClick(ev) {
526
+ this._onClickHandler(ev, this.props.onDoubleClick);
527
+ },
528
+ onDragStart: function onDragStart(resize, eventLayout) {
529
+ eventLayout.setIsResizing(true);
530
+ var bounds = this.getBounds();
531
+ assign(resize, { eventLayout: eventLayout, height: bounds.height, top: bounds.top });
532
+ this.setState({ resize: resize });
533
+ },
534
+ onMouseMove: function onMouseMove(ev) {
535
+ if (!this.state.resize) {
536
+ return;
537
+ }
538
+ var coord = ev.clientY - this.state.resize.top;
539
+ this.state.resize.eventLayout.adjustEventTime(this.state.resize.type, coord, this.state.resize.height);
540
+ this.forceUpdate();
541
+ },
542
+ onMouseUp: function onMouseUp(ev) {
543
+ var _this = this;
544
+
545
+ if (!this.state.resize) {
546
+ return;
547
+ }
548
+ this.state.resize.eventLayout.setIsResizing(false);
549
+ setTimeout(function () {
550
+ return _this.setState({ resize: false });
551
+ }, 1);
552
+ if (this.props.onEventResize) {
553
+ this.props.onEventResize(ev, this.state.resize.eventLayout.event);
554
+ }
555
+ this.lastMouseUp = new Date().getMilliseconds();
556
+ },
557
+ renderEvents: function renderEvents() {
558
+ var _this2 = this;
559
+
560
+ var asMonth = this.props.layout.isDisplayingAsMonth();
561
+ var singleDayEvents = [];
562
+ var allDayEvents = [];
563
+ var onMouseMove = asMonth ? null : this.onMouseMove;
564
+ each(this.props.layout.forDay(this.props.day), function (layout) {
565
+ var event = React.createElement(Event, {
566
+ layout: layout,
567
+ key: layout.key(),
568
+ day: _this2.props.day,
569
+ parent: _this2,
570
+ onDragStart: _this2.onDragStart,
571
+ onClick: _this2.props.onEventClick,
572
+ editComponent: _this2.props.editComponent,
573
+ onDoubleClick: _this2.props.onEventDoubleClick
574
+ });
575
+ (layout.event.isSingleDay() ? singleDayEvents : allDayEvents).push(event);
576
+ });
577
+ var events = [];
578
+ if (allDayEvents.length || !asMonth) {
579
+ events.push(React.createElement(
580
+ 'div',
581
+ _extends({ key: 'allday' }, this.props.layout.propsForAllDayEventContainer()),
582
+ allDayEvents
583
+ ));
584
+ }
585
+ if (singleDayEvents.length) {
586
+ events.push(React.createElement(
587
+ 'div',
588
+ { key: 'events', refs: 'events', className: 'events',
589
+ onMouseMove: onMouseMove, onMouseUp: this.onMouseUp },
590
+ singleDayEvents
591
+ ));
592
+ }
593
+ return events;
594
+ },
595
+ render: function render() {
596
+ var props = this.props.layout.propsForDayContainer(this.props);
597
+
598
+ return React.createElement(
599
+ 'div',
600
+ _extends({}, props, {
601
+ onClick: this.onClick,
602
+ onDoubleClick: this.onDoubleClick
603
+ }),
604
+ React.createElement(
605
+ Label,
606
+ { day: this.props.day, className: 'label' },
607
+ this.props.day.format('D')
608
+ ),
609
+ this.renderEvents()
610
+ );
611
+ }
612
+ });
613
+
614
+ module.exports = Day;
615
+
616
+ /***/ },
617
+
618
+ /***/ 901:
619
+ /***/ function(module, exports, __webpack_require__) {
620
+
621
+ 'use strict';
622
+
623
+ var React = __webpack_require__(66);
624
+ var EventLayout = __webpack_require__(898);
625
+
626
+ var IsResizeClass = new RegExp('(\\s|^)event(\\s|$)');
627
+
628
+ var Event = React.createClass({
629
+ displayName: 'Event',
630
+
631
+
632
+ propTypes: {
633
+ layout: React.PropTypes.instanceOf(EventLayout),
634
+ editComponent: React.PropTypes.func,
635
+ onClick: React.PropTypes.func,
636
+ onDoubleClick: React.PropTypes.func
637
+ },
638
+
639
+ onClick: function onClick(ev) {
640
+ if (!this.props.onClick) {
641
+ return;
642
+ }
643
+ this.props.onClick(ev, this.props.layout.event);
644
+ ev.stopPropagation();
645
+ },
646
+ onDoubleClick: function onDoubleClick(ev) {
647
+ if (!this.props.onDoubleClick) {
648
+ return;
649
+ }
650
+ this.props.onDoubleClick(ev, this.props.layout.event);
651
+ ev.stopPropagation();
652
+ },
653
+ onDragStart: function onDragStart(ev) {
654
+ if (!IsResizeClass.test(ev.target.className)) {
655
+ return;
656
+ }
657
+ var bounds = this.refs.element.getBoundingClientRect();
658
+ var resize = void 0;
659
+ if (ev.clientY - bounds.top < 10) {
660
+ resize = { type: 'start' };
661
+ } else if (bounds.bottom - ev.clientY < 10) {
662
+ resize = { type: 'end' };
663
+ } else {
664
+ return;
665
+ }
666
+ this.props.onDragStart(resize, this.props.layout);
667
+ },
668
+ render: function render() {
669
+ var body = React.createElement(
670
+ 'div',
671
+ { className: 'evbody', onClick: this.onClick },
672
+ this.props.layout.event.render()
673
+ );
674
+ var Edit = this.props.editComponent;
675
+ var children = this.props.layout.isEditing() ? React.createElement(
676
+ Edit,
677
+ { event: this.props.layout.event },
678
+ body
679
+ ) : body;
680
+ return React.createElement(
681
+ 'div',
682
+ {
683
+ ref: 'element',
684
+ onMouseDown: this.onDragStart,
685
+ style: this.props.layout.inlineStyles(),
686
+ className: this.props.layout.classNames()
687
+ },
688
+ children
689
+ );
690
+ }
691
+ });
692
+
693
+ module.exports = Event;
694
+
695
+ /***/ },
696
+
697
+ /***/ 902:
698
+ /***/ function(module, exports, __webpack_require__) {
699
+
700
+ 'use strict';
701
+
702
+ var React = __webpack_require__(66);
703
+
704
+ var Label = React.createClass({
705
+ displayName: 'Label',
706
+
707
+
708
+ propTypes: {
709
+ day: React.PropTypes.object.isRequired
710
+ },
711
+
712
+ render: function render() {
713
+ return React.createElement(
714
+ 'div',
715
+ { className: 'label' },
716
+ this.props.day.format('D')
717
+ );
718
+ }
719
+ });
720
+
721
+ module.exports = Label;
722
+
723
+ /***/ },
724
+
725
+ /***/ 903:
726
+ /***/ function(module, exports, __webpack_require__) {
727
+
728
+ 'use strict';
729
+
730
+ var React = __webpack_require__(66);
731
+ var map = __webpack_require__(904);
732
+
733
+ var XLabels = React.createClass({
734
+ displayName: 'XLabels',
735
+
736
+
737
+ propTypes: {
738
+ display: React.PropTypes.oneOf(['month', 'week', 'day']),
739
+ date: React.PropTypes.object.isRequired
740
+ },
741
+
742
+ render: function render() {
743
+ var days = [];
744
+ if (this.props.display === 'day') {
745
+ days.push(this.props.date);
746
+ } else {
747
+ var day = this.props.date.clone().startOf('week');
748
+ for (var i = 0; i < 7; i++) {
749
+ days.push(day.clone().add(i, 'day'));
750
+ }
751
+ }
752
+ var format = this.props.display === 'month' ? 'dddd' : 'ddd, MMM Do';
753
+ var labels = map(days, function (day) {
754
+ return React.createElement(
755
+ 'div',
756
+ { key: day.format('YYYYMMDD'), className: 'day-label' },
757
+ day.format(format)
758
+ );
759
+ });
760
+
761
+ return React.createElement(
762
+ 'div',
763
+ { className: 'x-labels' },
764
+ labels
765
+ );
766
+ }
767
+ });
768
+
769
+ module.exports = XLabels;
770
+
771
+ /***/ },
772
+
773
+ /***/ 904:
774
+ /***/ function(module, exports, __webpack_require__) {
775
+
776
+ var arrayMap = __webpack_require__(399),
777
+ baseIteratee = __webpack_require__(357),
778
+ baseMap = __webpack_require__(905),
779
+ isArray = __webpack_require__(322);
780
+
781
+ /**
782
+ * Creates an array of values by running each element in `collection` thru
783
+ * `iteratee`. The iteratee is invoked with three arguments:
784
+ * (value, index|key, collection).
785
+ *
786
+ * Many lodash methods are guarded to work as iteratees for methods like
787
+ * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
788
+ *
789
+ * The guarded methods are:
790
+ * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
791
+ * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
792
+ * `sampleSize`, `slice`, `some`, `sortBy`, `take`, `takeRight`, `template`,
793
+ * `trim`, `trimEnd`, `trimStart`, and `words`
794
+ *
795
+ * @static
796
+ * @memberOf _
797
+ * @since 0.1.0
798
+ * @category Collection
799
+ * @param {Array|Object} collection The collection to iterate over.
800
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
801
+ * The function invoked per iteration.
802
+ * @returns {Array} Returns the new mapped array.
803
+ * @example
804
+ *
805
+ * function square(n) {
806
+ * return n * n;
807
+ * }
808
+ *
809
+ * _.map([4, 8], square);
810
+ * // => [16, 64]
811
+ *
812
+ * _.map({ 'a': 4, 'b': 8 }, square);
813
+ * // => [16, 64] (iteration order is not guaranteed)
814
+ *
815
+ * var users = [
816
+ * { 'user': 'barney' },
817
+ * { 'user': 'fred' }
818
+ * ];
819
+ *
820
+ * // The `_.property` iteratee shorthand.
821
+ * _.map(users, 'user');
822
+ * // => ['barney', 'fred']
823
+ */
824
+ function map(collection, iteratee) {
825
+ var func = isArray(collection) ? arrayMap : baseMap;
826
+ return func(collection, baseIteratee(iteratee, 3));
827
+ }
828
+
829
+ module.exports = map;
830
+
831
+
832
+ /***/ },
833
+
834
+ /***/ 905:
835
+ /***/ function(module, exports, __webpack_require__) {
836
+
837
+ var baseEach = __webpack_require__(352),
838
+ isArrayLike = __webpack_require__(318);
839
+
840
+ /**
841
+ * The base implementation of `_.map` without support for iteratee shorthands.
842
+ *
843
+ * @private
844
+ * @param {Array|Object} collection The collection to iterate over.
845
+ * @param {Function} iteratee The function invoked per iteration.
846
+ * @returns {Array} Returns the new mapped array.
847
+ */
848
+ function baseMap(collection, iteratee) {
849
+ var index = -1,
850
+ result = isArrayLike(collection) ? Array(collection.length) : [];
851
+
852
+ baseEach(collection, function(value, key, collection) {
853
+ result[++index] = iteratee(value, key, collection);
854
+ });
855
+ return result;
856
+ }
857
+
858
+ module.exports = baseMap;
859
+
860
+
861
+ /***/ },
862
+
863
+ /***/ 906:
864
+ /***/ function(module, exports, __webpack_require__) {
865
+
866
+ 'use strict';
867
+
868
+ var React = __webpack_require__(66);
869
+ var moment = __webpack_require__(695);
870
+ var Layout = __webpack_require__(896);
871
+ var each = __webpack_require__(897);
872
+ var range = __webpack_require__(907);
873
+
874
+ var YLabels = React.createClass({
875
+ displayName: 'YLabels',
876
+
877
+
878
+ propTypes: {
879
+ display: React.PropTypes.oneOf(['month', 'week', 'day']),
880
+ date: React.PropTypes.object.isRequired,
881
+ layout: React.PropTypes.instanceOf(Layout).isRequired
882
+ },
883
+
884
+ render: function render() {
885
+ if (this.props.display === 'month') {
886
+ return null;
887
+ }
888
+
889
+ var day = moment();
890
+ var labels = [];
891
+ var hours = range(this.props.layout.displayHours[0], this.props.layout.displayHours[1]);
892
+ each(hours, function (hour) {
893
+ day.hour(hour);
894
+ labels.push(React.createElement(
895
+ 'div',
896
+ { key: hour, className: 'hour' },
897
+ day.format('ha')
898
+ ));
899
+ });
900
+
901
+ var multiDay = React.createElement(
902
+ 'div',
903
+ this.props.layout.propsForAllDayEventContainer(),
904
+ 'All Day'
905
+ );
906
+
907
+ return React.createElement(
908
+ 'div',
909
+ null,
910
+ React.createElement(
911
+ 'div',
912
+ { className: 'y-labels' },
913
+ multiDay,
914
+ labels
915
+ )
916
+ );
917
+ }
918
+ });
919
+
920
+ module.exports = YLabels;
921
+
922
+ /***/ },
923
+
924
+ /***/ 907:
925
+ /***/ function(module, exports, __webpack_require__) {
926
+
927
+ var createRange = __webpack_require__(908);
928
+
929
+ /**
930
+ * Creates an array of numbers (positive and/or negative) progressing from
931
+ * `start` up to, but not including, `end`. A step of `-1` is used if a negative
932
+ * `start` is specified without an `end` or `step`. If `end` is not specified,
933
+ * it's set to `start` with `start` then set to `0`.
934
+ *
935
+ * **Note:** JavaScript follows the IEEE-754 standard for resolving
936
+ * floating-point values which can produce unexpected results.
937
+ *
938
+ * @static
939
+ * @since 0.1.0
940
+ * @memberOf _
941
+ * @category Util
942
+ * @param {number} [start=0] The start of the range.
943
+ * @param {number} end The end of the range.
944
+ * @param {number} [step=1] The value to increment or decrement by.
945
+ * @returns {Array} Returns the new array of numbers.
946
+ * @example
947
+ *
948
+ * _.range(4);
949
+ * // => [0, 1, 2, 3]
950
+ *
951
+ * _.range(-4);
952
+ * // => [0, -1, -2, -3]
953
+ *
954
+ * _.range(1, 5);
955
+ * // => [1, 2, 3, 4]
956
+ *
957
+ * _.range(0, 20, 5);
958
+ * // => [0, 5, 10, 15]
959
+ *
960
+ * _.range(0, -4, -1);
961
+ * // => [0, -1, -2, -3]
962
+ *
963
+ * _.range(1, 4, 0);
964
+ * // => [1, 1, 1]
965
+ *
966
+ * _.range(0);
967
+ * // => []
968
+ */
969
+ var range = createRange();
970
+
971
+ module.exports = range;
972
+
973
+
974
+ /***/ },
975
+
976
+ /***/ 908:
977
+ /***/ function(module, exports, __webpack_require__) {
978
+
979
+ var baseRange = __webpack_require__(909),
980
+ isIterateeCall = __webpack_require__(347),
981
+ toNumber = __webpack_require__(305);
982
+
983
+ /**
984
+ * Creates a `_.range` or `_.rangeRight` function.
985
+ *
986
+ * @private
987
+ * @param {boolean} [fromRight] Specify iterating from right to left.
988
+ * @returns {Function} Returns the new range function.
989
+ */
990
+ function createRange(fromRight) {
991
+ return function(start, end, step) {
992
+ if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
993
+ end = step = undefined;
994
+ }
995
+ // Ensure the sign of `-0` is preserved.
996
+ start = toNumber(start);
997
+ start = start === start ? start : 0;
998
+ if (end === undefined) {
999
+ end = start;
1000
+ start = 0;
1001
+ } else {
1002
+ end = toNumber(end) || 0;
1003
+ }
1004
+ step = step === undefined ? (start < end ? 1 : -1) : (toNumber(step) || 0);
1005
+ return baseRange(start, end, step, fromRight);
1006
+ };
1007
+ }
1008
+
1009
+ module.exports = createRange;
1010
+
1011
+
1012
+ /***/ },
1013
+
1014
+ /***/ 909:
1015
+ /***/ function(module, exports) {
1016
+
1017
+ /* Built-in method references for those with the same name as other `lodash` methods. */
1018
+ var nativeCeil = Math.ceil,
1019
+ nativeMax = Math.max;
1020
+
1021
+ /**
1022
+ * The base implementation of `_.range` and `_.rangeRight` which doesn't
1023
+ * coerce arguments to numbers.
1024
+ *
1025
+ * @private
1026
+ * @param {number} start The start of the range.
1027
+ * @param {number} end The end of the range.
1028
+ * @param {number} step The value to increment or decrement by.
1029
+ * @param {boolean} [fromRight] Specify iterating from right to left.
1030
+ * @returns {Array} Returns the new array of numbers.
1031
+ */
1032
+ function baseRange(start, end, step, fromRight) {
1033
+ var index = -1,
1034
+ length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
1035
+ result = Array(length);
1036
+
1037
+ while (length--) {
1038
+ result[fromRight ? length : ++index] = start;
1039
+ start += step;
1040
+ }
1041
+ return result;
1042
+ }
1043
+
1044
+ module.exports = baseRange;
1045
+
1046
+
1047
+ /***/ },
1048
+
1049
+ /***/ 910:
1050
+ /***/ function(module, exports, __webpack_require__) {
1051
+
1052
+ 'use strict';
1053
+
1054
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
1055
+
1056
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1057
+
1058
+ var Event = __webpack_require__(911);
1059
+ var Emitter = __webpack_require__(912);
1060
+ var _each = __webpack_require__(897);
1061
+ var assign = __webpack_require__(341);
1062
+ var sortBy = __webpack_require__(913);
1063
+
1064
+ function lengthCompare(event) {
1065
+ return event.attributes.range.start.diff(event.attributes.range.end);
1066
+ }
1067
+
1068
+ var EventsCollection = function () {
1069
+ function EventsCollection() {
1070
+ var events = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
1071
+
1072
+ _classCallCheck(this, EventsCollection);
1073
+
1074
+ this.events = [];
1075
+ for (var i = 0, length = events.length; i < length; i++) {
1076
+ this.add(events[i]);
1077
+ }
1078
+ }
1079
+
1080
+ _createClass(EventsCollection, [{
1081
+ key: 'add',
1082
+ value: function add(event) {
1083
+ if (!event.isEvent) {
1084
+ event = new Event(event);
1085
+ }
1086
+ event.collection = this;
1087
+ this.events.push(event);
1088
+ this.emit('change');
1089
+ return event;
1090
+ }
1091
+ }, {
1092
+ key: 'each',
1093
+ value: function each(fn, scope) {
1094
+ var sorted = sortBy(this.events, lengthCompare);
1095
+ _each(sorted, fn, scope);
1096
+ }
1097
+ }, {
1098
+ key: 'length',
1099
+ value: function length() {
1100
+ return this.events.length;
1101
+ }
1102
+ }, {
1103
+ key: 'remove',
1104
+ value: function remove(event) {
1105
+ var index = this.events.indexOf(event);
1106
+ if (-1 !== index) {
1107
+ this.events.splice(index, 1);
1108
+ this.emit('change');
1109
+ }
1110
+ }
1111
+ }]);
1112
+
1113
+ return EventsCollection;
1114
+ }();
1115
+
1116
+ EventsCollection.Event = Event;
1117
+
1118
+
1119
+ assign(EventsCollection.prototype, Emitter.prototype);
1120
+
1121
+ module.exports = EventsCollection;
1122
+
1123
+ /***/ },
1124
+
1125
+ /***/ 911:
1126
+ /***/ function(module, exports, __webpack_require__) {
1127
+
1128
+ 'use strict';
1129
+
1130
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
1131
+
1132
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1133
+
1134
+ var React = __webpack_require__(66);
1135
+ var assign = __webpack_require__(341);
1136
+ var each = __webpack_require__(897);
1137
+ var Emitter = __webpack_require__(912);
1138
+
1139
+ var EVENT_COUNTER = 1;
1140
+
1141
+ var Event = function () {
1142
+ function Event(attributes) {
1143
+ _classCallCheck(this, Event);
1144
+
1145
+ this.attributes = attributes;
1146
+ this.isEvent = true;
1147
+ this.key = EVENT_COUNTER++;
1148
+ if (!this.attributes.range) {
1149
+ throw new Error("Must provide range");
1150
+ }
1151
+ }
1152
+
1153
+ _createClass(Event, [{
1154
+ key: 'render',
1155
+ value: function render(date, layout) {
1156
+ if (this.attributes.render) {
1157
+ return this.attributes.render(date, layout);
1158
+ } else {
1159
+ return this.defaultRenderImplementation(date, layout);
1160
+ }
1161
+ }
1162
+ }, {
1163
+ key: 'defaultRenderImplementation',
1164
+ value: function defaultRenderImplementation() {
1165
+ return React.createElement('div', {}, this.attributes.content || this.attributes.range.start.format('MMM DD YYYY'));
1166
+ }
1167
+ }, {
1168
+ key: 'get',
1169
+ value: function get(key) {
1170
+ return this.attributes[key];
1171
+ }
1172
+ }, {
1173
+ key: 'set',
1174
+ value: function set(attributes, options) {
1175
+ var _this = this;
1176
+
1177
+ var changed = false;
1178
+ each(attributes, function (value, key) {
1179
+ if (_this.attributes[key] !== value) {
1180
+ changed = true;
1181
+ return false;
1182
+ }
1183
+ });
1184
+ if (!changed) {
1185
+ return;
1186
+ }
1187
+ assign(this.attributes, attributes);
1188
+ this._emitChangeEvent(options);
1189
+ }
1190
+ }, {
1191
+ key: 'isEditing',
1192
+ value: function isEditing() {
1193
+ return !!this.attributes.editing;
1194
+ }
1195
+ }, {
1196
+ key: 'setEditing',
1197
+ value: function setEditing(isEditing) {
1198
+ var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
1199
+
1200
+ if (isEditing !== this.isEditing()) {
1201
+ this.attributes.editing = isEditing;
1202
+ }
1203
+ this._emitChangeEvent(options);
1204
+ }
1205
+ }, {
1206
+ key: '_emitChangeEvent',
1207
+ value: function _emitChangeEvent() {
1208
+ var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
1209
+
1210
+ if (this.collection) {
1211
+ this.collection.emit('change', this);
1212
+ }
1213
+ if (!options || !options.silent) {
1214
+ this.emit('change', this);
1215
+ }
1216
+ }
1217
+ }, {
1218
+ key: 'range',
1219
+ value: function range() {
1220
+ return this.attributes.range.clone();
1221
+ }
1222
+ }, {
1223
+ key: 'isSingleDay',
1224
+ value: function isSingleDay() {
1225
+ return this.attributes.range.end.diff(this.attributes.range.start, 'hours') <= 24;
1226
+ }
1227
+ }, {
1228
+ key: 'daysMinuteRange',
1229
+ value: function daysMinuteRange() {
1230
+ var startOfDay = this.attributes.range.start.clone().startOf('day');
1231
+ return { start: this.attributes.range.start.diff(startOfDay, 'minute'),
1232
+ end: this.attributes.range.end.diff(startOfDay, 'minute') };
1233
+ }
1234
+ }, {
1235
+ key: 'content',
1236
+ value: function content() {
1237
+ return this.attributes.content;
1238
+ }
1239
+ }, {
1240
+ key: 'start',
1241
+ value: function start() {
1242
+ return this.attributes.range.start;
1243
+ }
1244
+ }, {
1245
+ key: 'end',
1246
+ value: function end() {
1247
+ return this.attributes.range.end;
1248
+ }
1249
+ }, {
1250
+ key: 'colorIndex',
1251
+ value: function colorIndex() {
1252
+ return this.attributes.colorIndex;
1253
+ }
1254
+ }, {
1255
+ key: 'remove',
1256
+ value: function remove() {
1257
+ this.collection.remove(this);
1258
+ this.isDeleted = true;
1259
+ this.emit('change');
1260
+ }
1261
+ }]);
1262
+
1263
+ return Event;
1264
+ }();
1265
+
1266
+ assign(Event.prototype, Emitter.prototype);
1267
+
1268
+ module.exports = Event;
1269
+
1270
+ /***/ },
1271
+
1272
+ /***/ 912:
1273
+ /***/ function(module, exports) {
1274
+
1275
+ function E () {
1276
+ // Keep this empty so it's easier to inherit from
1277
+ // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
1278
+ }
1279
+
1280
+ E.prototype = {
1281
+ on: function (name, callback, ctx) {
1282
+ var e = this.e || (this.e = {});
1283
+
1284
+ (e[name] || (e[name] = [])).push({
1285
+ fn: callback,
1286
+ ctx: ctx
1287
+ });
1288
+
1289
+ return this;
1290
+ },
1291
+
1292
+ once: function (name, callback, ctx) {
1293
+ var self = this;
1294
+ function listener () {
1295
+ self.off(name, listener);
1296
+ callback.apply(ctx, arguments);
1297
+ };
1298
+
1299
+ listener._ = callback
1300
+ return this.on(name, listener, ctx);
1301
+ },
1302
+
1303
+ emit: function (name) {
1304
+ var data = [].slice.call(arguments, 1);
1305
+ var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
1306
+ var i = 0;
1307
+ var len = evtArr.length;
1308
+
1309
+ for (i; i < len; i++) {
1310
+ evtArr[i].fn.apply(evtArr[i].ctx, data);
1311
+ }
1312
+
1313
+ return this;
1314
+ },
1315
+
1316
+ off: function (name, callback) {
1317
+ var e = this.e || (this.e = {});
1318
+ var evts = e[name];
1319
+ var liveEvents = [];
1320
+
1321
+ if (evts && callback) {
1322
+ for (var i = 0, len = evts.length; i < len; i++) {
1323
+ if (evts[i].fn !== callback && evts[i].fn._ !== callback)
1324
+ liveEvents.push(evts[i]);
1325
+ }
1326
+ }
1327
+
1328
+ // Remove event from queue to prevent memory leak
1329
+ // Suggested by https://github.com/lazd
1330
+ // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
1331
+
1332
+ (liveEvents.length)
1333
+ ? e[name] = liveEvents
1334
+ : delete e[name];
1335
+
1336
+ return this;
1337
+ }
1338
+ };
1339
+
1340
+ module.exports = E;
1341
+
1342
+
1343
+ /***/ },
1344
+
1345
+ /***/ 913:
1346
+ /***/ function(module, exports, __webpack_require__) {
1347
+
1348
+ var baseFlatten = __webpack_require__(914),
1349
+ baseOrderBy = __webpack_require__(917),
1350
+ isIterateeCall = __webpack_require__(347),
1351
+ rest = __webpack_require__(348);
1352
+
1353
+ /**
1354
+ * Creates an array of elements, sorted in ascending order by the results of
1355
+ * running each element in a collection thru each iteratee. This method
1356
+ * performs a stable sort, that is, it preserves the original sort order of
1357
+ * equal elements. The iteratees are invoked with one argument: (value).
1358
+ *
1359
+ * @static
1360
+ * @memberOf _
1361
+ * @since 0.1.0
1362
+ * @category Collection
1363
+ * @param {Array|Object} collection The collection to iterate over.
1364
+ * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
1365
+ * [iteratees=[_.identity]] The iteratees to sort by, specified individually
1366
+ * or in arrays.
1367
+ * @returns {Array} Returns the new sorted array.
1368
+ * @example
1369
+ *
1370
+ * var users = [
1371
+ * { 'user': 'fred', 'age': 48 },
1372
+ * { 'user': 'barney', 'age': 36 },
1373
+ * { 'user': 'fred', 'age': 40 },
1374
+ * { 'user': 'barney', 'age': 34 }
1375
+ * ];
1376
+ *
1377
+ * _.sortBy(users, function(o) { return o.user; });
1378
+ * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
1379
+ *
1380
+ * _.sortBy(users, ['user', 'age']);
1381
+ * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
1382
+ *
1383
+ * _.sortBy(users, 'user', function(o) {
1384
+ * return Math.floor(o.age / 10);
1385
+ * });
1386
+ * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
1387
+ */
1388
+ var sortBy = rest(function(collection, iteratees) {
1389
+ if (collection == null) {
1390
+ return [];
1391
+ }
1392
+ var length = iteratees.length;
1393
+ if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
1394
+ iteratees = [];
1395
+ } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
1396
+ iteratees.length = 1;
1397
+ }
1398
+ return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
1399
+ });
1400
+
1401
+ module.exports = sortBy;
1402
+
1403
+
1404
+ /***/ },
1405
+
1406
+ /***/ 914:
1407
+ /***/ function(module, exports, __webpack_require__) {
1408
+
1409
+ var arrayPush = __webpack_require__(915),
1410
+ isFlattenable = __webpack_require__(916);
1411
+
1412
+ /**
1413
+ * The base implementation of `_.flatten` with support for restricting flattening.
1414
+ *
1415
+ * @private
1416
+ * @param {Array} array The array to flatten.
1417
+ * @param {number} depth The maximum recursion depth.
1418
+ * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
1419
+ * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
1420
+ * @param {Array} [result=[]] The initial result value.
1421
+ * @returns {Array} Returns the new flattened array.
1422
+ */
1423
+ function baseFlatten(array, depth, predicate, isStrict, result) {
1424
+ var index = -1,
1425
+ length = array.length;
1426
+
1427
+ predicate || (predicate = isFlattenable);
1428
+ result || (result = []);
1429
+
1430
+ while (++index < length) {
1431
+ var value = array[index];
1432
+ if (depth > 0 && predicate(value)) {
1433
+ if (depth > 1) {
1434
+ // Recursively flatten arrays (susceptible to call stack limits).
1435
+ baseFlatten(value, depth - 1, predicate, isStrict, result);
1436
+ } else {
1437
+ arrayPush(result, value);
1438
+ }
1439
+ } else if (!isStrict) {
1440
+ result[result.length] = value;
1441
+ }
1442
+ }
1443
+ return result;
1444
+ }
1445
+
1446
+ module.exports = baseFlatten;
1447
+
1448
+
1449
+ /***/ },
1450
+
1451
+ /***/ 915:
1452
+ /***/ function(module, exports) {
1453
+
1454
+ /**
1455
+ * Appends the elements of `values` to `array`.
1456
+ *
1457
+ * @private
1458
+ * @param {Array} array The array to modify.
1459
+ * @param {Array} values The values to append.
1460
+ * @returns {Array} Returns `array`.
1461
+ */
1462
+ function arrayPush(array, values) {
1463
+ var index = -1,
1464
+ length = values.length,
1465
+ offset = array.length;
1466
+
1467
+ while (++index < length) {
1468
+ array[offset + index] = values[index];
1469
+ }
1470
+ return array;
1471
+ }
1472
+
1473
+ module.exports = arrayPush;
1474
+
1475
+
1476
+ /***/ },
1477
+
1478
+ /***/ 916:
1479
+ /***/ function(module, exports, __webpack_require__) {
1480
+
1481
+ var isArguments = __webpack_require__(316),
1482
+ isArray = __webpack_require__(322),
1483
+ isArrayLikeObject = __webpack_require__(317);
1484
+
1485
+ /**
1486
+ * Checks if `value` is a flattenable `arguments` object or array.
1487
+ *
1488
+ * @private
1489
+ * @param {*} value The value to check.
1490
+ * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
1491
+ */
1492
+ function isFlattenable(value) {
1493
+ return isArrayLikeObject(value) && (isArray(value) || isArguments(value));
1494
+ }
1495
+
1496
+ module.exports = isFlattenable;
1497
+
1498
+
1499
+ /***/ },
1500
+
1501
+ /***/ 917:
1502
+ /***/ function(module, exports, __webpack_require__) {
1503
+
1504
+ var arrayMap = __webpack_require__(399),
1505
+ baseIteratee = __webpack_require__(357),
1506
+ baseMap = __webpack_require__(905),
1507
+ baseSortBy = __webpack_require__(918),
1508
+ compareMultiple = __webpack_require__(919),
1509
+ identity = __webpack_require__(412);
1510
+
1511
+ /**
1512
+ * The base implementation of `_.orderBy` without param guards.
1513
+ *
1514
+ * @private
1515
+ * @param {Array|Object} collection The collection to iterate over.
1516
+ * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
1517
+ * @param {string[]} orders The sort orders of `iteratees`.
1518
+ * @returns {Array} Returns the new sorted array.
1519
+ */
1520
+ function baseOrderBy(collection, iteratees, orders) {
1521
+ var index = -1;
1522
+ iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseIteratee);
1523
+
1524
+ var result = baseMap(collection, function(value, key, collection) {
1525
+ var criteria = arrayMap(iteratees, function(iteratee) {
1526
+ return iteratee(value);
1527
+ });
1528
+ return { 'criteria': criteria, 'index': ++index, 'value': value };
1529
+ });
1530
+
1531
+ return baseSortBy(result, function(object, other) {
1532
+ return compareMultiple(object, other, orders);
1533
+ });
1534
+ }
1535
+
1536
+ module.exports = baseOrderBy;
1537
+
1538
+
1539
+ /***/ },
1540
+
1541
+ /***/ 918:
1542
+ /***/ function(module, exports) {
1543
+
1544
+ /**
1545
+ * The base implementation of `_.sortBy` which uses `comparer` to define the
1546
+ * sort order of `array` and replaces criteria objects with their corresponding
1547
+ * values.
1548
+ *
1549
+ * @private
1550
+ * @param {Array} array The array to sort.
1551
+ * @param {Function} comparer The function to define sort order.
1552
+ * @returns {Array} Returns `array`.
1553
+ */
1554
+ function baseSortBy(array, comparer) {
1555
+ var length = array.length;
1556
+
1557
+ array.sort(comparer);
1558
+ while (length--) {
1559
+ array[length] = array[length].value;
1560
+ }
1561
+ return array;
1562
+ }
1563
+
1564
+ module.exports = baseSortBy;
1565
+
1566
+
1567
+ /***/ },
1568
+
1569
+ /***/ 919:
1570
+ /***/ function(module, exports, __webpack_require__) {
1571
+
1572
+ var compareAscending = __webpack_require__(920);
1573
+
1574
+ /**
1575
+ * Used by `_.orderBy` to compare multiple properties of a value to another
1576
+ * and stable sort them.
1577
+ *
1578
+ * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
1579
+ * specify an order of "desc" for descending or "asc" for ascending sort order
1580
+ * of corresponding values.
1581
+ *
1582
+ * @private
1583
+ * @param {Object} object The object to compare.
1584
+ * @param {Object} other The other object to compare.
1585
+ * @param {boolean[]|string[]} orders The order to sort by for each property.
1586
+ * @returns {number} Returns the sort order indicator for `object`.
1587
+ */
1588
+ function compareMultiple(object, other, orders) {
1589
+ var index = -1,
1590
+ objCriteria = object.criteria,
1591
+ othCriteria = other.criteria,
1592
+ length = objCriteria.length,
1593
+ ordersLength = orders.length;
1594
+
1595
+ while (++index < length) {
1596
+ var result = compareAscending(objCriteria[index], othCriteria[index]);
1597
+ if (result) {
1598
+ if (index >= ordersLength) {
1599
+ return result;
1600
+ }
1601
+ var order = orders[index];
1602
+ return result * (order == 'desc' ? -1 : 1);
1603
+ }
1604
+ }
1605
+ // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
1606
+ // that causes it, under certain circumstances, to provide the same value for
1607
+ // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
1608
+ // for more details.
1609
+ //
1610
+ // This also ensures a stable sort in V8 and other engines.
1611
+ // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
1612
+ return object.index - other.index;
1613
+ }
1614
+
1615
+ module.exports = compareMultiple;
1616
+
1617
+
1618
+ /***/ },
1619
+
1620
+ /***/ 920:
1621
+ /***/ function(module, exports) {
1622
+
1623
+ /**
1624
+ * Compares values to sort them in ascending order.
1625
+ *
1626
+ * @private
1627
+ * @param {*} value The value to compare.
1628
+ * @param {*} other The other value to compare.
1629
+ * @returns {number} Returns the sort order indicator for `value`.
1630
+ */
1631
+ function compareAscending(value, other) {
1632
+ if (value !== other) {
1633
+ var valIsNull = value === null,
1634
+ valIsUndef = value === undefined,
1635
+ valIsReflexive = value === value;
1636
+
1637
+ var othIsNull = other === null,
1638
+ othIsUndef = other === undefined,
1639
+ othIsReflexive = other === other;
1640
+
1641
+ if ((value > other && !othIsNull) || !valIsReflexive ||
1642
+ (valIsNull && !othIsUndef && othIsReflexive) ||
1643
+ (valIsUndef && othIsReflexive)) {
1644
+ return 1;
1645
+ }
1646
+ if ((value < other && !valIsNull) || !othIsReflexive ||
1647
+ (othIsNull && !valIsUndef && valIsReflexive) ||
1648
+ (othIsUndef && valIsReflexive)) {
1649
+ return -1;
1650
+ }
1651
+ }
1652
+ return 0;
1653
+ }
1654
+
1655
+ module.exports = compareAscending;
1656
+
1657
+
1658
+ /***/ },
1659
+
1660
+ /***/ 921:
1661
+ /***/ function(module, exports, __webpack_require__) {
1662
+
1663
+ module.exports = __webpack_require__.p + "calendar.scss";
1664
+
1665
+ /***/ }
1666
+
1667
+ });