@mediafly/js-ui 51.3.3-1 → 51.4.0-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 (49) hide show
  1. package/lib/constants/constants.js +1 -2
  2. package/lib/constants/constants.js.map +1 -1
  3. package/lib/date-input/date-input.js +12 -33
  4. package/lib/date-input/date-input.js.map +1 -1
  5. package/lib/date-input/validate-date.js +8 -12
  6. package/lib/date-input/validate-date.js.map +1 -1
  7. package/lib/date-time-zone-picker/date-time-zone-factory.js +49 -62
  8. package/lib/date-time-zone-picker/date-time-zone-factory.js.map +1 -1
  9. package/lib/date-time-zone-picker/date-time-zone-picker.html +6 -6
  10. package/lib/date-time-zone-picker/date-time-zone-picker.js +59 -119
  11. package/lib/date-time-zone-picker/date-time-zone-picker.js.map +1 -1
  12. package/lib/date-time-zone-picker/datepicker.html +3 -2
  13. package/lib/date-time-zone-picker/datepicker.js +26 -79
  14. package/lib/date-time-zone-picker/datepicker.js.map +1 -1
  15. package/lib/date-time-zone-picker/time-format-filter.js +8 -8
  16. package/lib/date-time-zone-picker/time-format-filter.js.map +1 -1
  17. package/lib/date-time-zone-picker/time-zone-picker.js +1 -1
  18. package/lib/date-time-zone-picker/timepicker.html +2 -1
  19. package/lib/date-time-zone-picker/timepicker.js +40 -35
  20. package/lib/date-time-zone-picker/timepicker.js.map +1 -1
  21. package/lib/feedback/feedback.component.html +17 -7
  22. package/lib/styles.css +10 -22
  23. package/lib/time-input/time-input.js +23 -27
  24. package/lib/time-input/time-input.js.map +1 -1
  25. package/lib/time-input/validate-time.js +3 -6
  26. package/lib/time-input/validate-time.js.map +1 -1
  27. package/lib/tsconfig.deploy.tsbuildinfo +25 -163
  28. package/package.json +4 -4
  29. package/src/components/constants/constants.js +1 -2
  30. package/src/components/date-input/date-input.js +12 -31
  31. package/src/components/date-input/validate-date.js +10 -14
  32. package/src/components/date-time-zone-picker/date-time-zone-factory.ts +49 -62
  33. package/src/components/date-time-zone-picker/date-time-zone-picker.html +6 -6
  34. package/src/components/date-time-zone-picker/date-time-zone-picker.ts +70 -131
  35. package/src/components/date-time-zone-picker/datepicker.html +3 -2
  36. package/src/components/date-time-zone-picker/datepicker.ts +26 -83
  37. package/src/components/date-time-zone-picker/time-format-filter.ts +8 -8
  38. package/src/components/date-time-zone-picker/time-zone-picker.js +1 -1
  39. package/src/components/date-time-zone-picker/timepicker.html +2 -1
  40. package/src/components/date-time-zone-picker/timepicker.js +47 -46
  41. package/src/components/feedback/feedback.component.html +17 -7
  42. package/src/components/feedback/feedback.less +24 -13
  43. package/src/components/less/objects/containers.less +15 -17
  44. package/src/components/less/variables/colors.less +8 -0
  45. package/src/components/time-input/time-input.js +24 -27
  46. package/src/components/time-input/validate-time.js +3 -6
  47. package/src/index.spec.js +1 -1
  48. package/tsconfig.tsbuildinfo +7221 -0
  49. package/webpack.config.js +0 -6
@@ -1,6 +1,6 @@
1
1
  import angular from 'angular'
2
2
  import template from './time-input.html'
3
- const { DateTime } = require('luxon')
3
+ import moment from 'moment'
4
4
 
5
5
 
6
6
  angular.module('app').directive('mflyTimeInput', [
@@ -28,6 +28,13 @@ angular.module('app').directive('mflyTimeInput', [
28
28
  // ----------------------------------------
29
29
  $scope.vm = {};
30
30
 
31
+ // See: https://momentjs.com/docs/#/parsing/string-format/
32
+ var validTimeFormats = [
33
+ 'H:mm',
34
+ 'h:mm A',
35
+ 'h:mmA'
36
+ ];
37
+
31
38
  // Format the ng-model value as a time string.
32
39
  // The result of this function is assigned to `ngModelCtrl.$viewValue`.
33
40
  ngModelCtrl.$formatters.push(function (nativeDate) {
@@ -36,7 +43,7 @@ angular.module('app').directive('mflyTimeInput', [
36
43
  return '';
37
44
  }
38
45
 
39
- return DateTime.fromJSDate(nativeDate).toFormat('h:mm a');
46
+ return moment(nativeDate).format('h:mm A');
40
47
  });
41
48
 
42
49
  // Display the time string in the UI.
@@ -60,25 +67,15 @@ angular.module('app').directive('mflyTimeInput', [
60
67
  // component of "today". If a model value exists, we need to set the
61
68
  // outgoing date object's date part back to the original model value
62
69
  // since the user did not intend to change that part.
63
- let targetDateTime;
64
- const luxonFormats = ['H:mm', 'h:mm a', 'h:mma'];
65
-
66
- // Try each format until one works
67
- for (const format of luxonFormats) {
68
- targetDateTime = DateTime.fromFormat(viewValue, format);
69
- if (targetDateTime.isValid) break;
70
- }
70
+ var targetMoment = moment(viewValue, validTimeFormats, true);
71
71
 
72
72
  if (ngModelCtrl.$modelValue) {
73
- const modelDateTime = DateTime.fromJSDate(ngModelCtrl.$modelValue);
74
- targetDateTime = targetDateTime.set({
75
- year: modelDateTime.year,
76
- month: modelDateTime.month,
77
- day: modelDateTime.day
78
- });
73
+ var modelMoment = moment(ngModelCtrl.$modelValue);
74
+ targetMoment.year(modelMoment.year());
75
+ targetMoment.dayOfYear(modelMoment.dayOfYear());
79
76
  }
80
77
 
81
- return targetDateTime.toJSDate();
78
+ return targetMoment.toDate();
82
79
  });
83
80
 
84
81
  // When the user input changes the scope model, push it through the
@@ -94,15 +91,15 @@ angular.module('app').directive('mflyTimeInput', [
94
91
 
95
92
  // Time dropdown
96
93
  // ----------------------------------------
97
- const beginningOfToday = DateTime.now().startOf('day');
98
- let timeCursor = beginningOfToday;
94
+ var beginningOfToday = moment().hour(0).minute(0).second(0);
95
+ var timeCursor = moment(beginningOfToday);
99
96
  $scope.dropdownEntries = [];
100
97
 
101
98
  // Populate time entries for all 30-min intervals on today's date
102
99
  do {
103
- $scope.dropdownEntries.push(timeCursor.toFormat('h:mm a'));
104
- timeCursor = timeCursor.plus({ minutes: 30 });
105
- } while (timeCursor.day === beginningOfToday.day);
100
+ $scope.dropdownEntries.push(timeCursor.format('h:mm A'));
101
+ timeCursor.add(30, 'minutes');
102
+ } while (timeCursor.date() === beginningOfToday.date());
106
103
 
107
104
  // When a time is clicked, update the view model
108
105
  $scope.setTime = function (timeString) {
@@ -126,15 +123,15 @@ angular.module('app').directive('mflyTimeInput', [
126
123
  function entriesForTime (time) {
127
124
 
128
125
  // Find the number of minutes until our target time.
129
- const target = DateTime.fromJSDate(time);
130
- const midnight = target.startOf('day');
131
- const minutesFromMidnight = target.diff(midnight, 'minutes').minutes;
126
+ var target = moment(time);
127
+ var midnight = moment(target).hour(0).minute(0).second(0);
128
+ var minutesFromMidnight = target.diff(midnight, 'minutes');
132
129
 
133
130
  // Round up to the next 30 minute interval.
134
- const roundedMinutes = Math.ceil((minutesFromMidnight + 1) / 30) * 30;
131
+ minutesFromMidnight = Math.ceil((minutesFromMidnight + 1) / 30) * 30;
135
132
 
136
133
  // Divide by 30 to get number of places we should scroll down.
137
- return roundedMinutes / 30;
134
+ return minutesFromMidnight / 30;
138
135
  }
139
136
 
140
137
  // If `dropdownDefault` is specified by the consumer, we should
@@ -1,5 +1,5 @@
1
1
  import angular from 'angular'
2
- const { DateTime } = require('luxon')
2
+ import moment from 'moment'
3
3
 
4
4
  angular.module('app').directive('mflyValidateTime', function mflyValidateTime () {
5
5
 
@@ -7,6 +7,7 @@ angular.module('app').directive('mflyValidateTime', function mflyValidateTime ()
7
7
 
8
8
  $ctrl.$validators.timeFormat = function (modelValue, viewValue) {
9
9
 
10
+ // https://momentjs.com/docs/#/parsing/string-format/
10
11
  var validTimeFormats = [
11
12
  'H:mm',
12
13
  'h:mm A',
@@ -18,11 +19,7 @@ angular.module('app').directive('mflyValidateTime', function mflyValidateTime ()
18
19
  return true;
19
20
  }
20
21
 
21
- // Check if the time is valid according to the given formats
22
- return validTimeFormats.some(format => {
23
- const parsed = DateTime.fromFormat(viewValue, format === 'H:mm' ? 'H:mm' : 'h:mm a')
24
- return parsed.isValid
25
- })
22
+ return moment(viewValue, validTimeFormats, true).isValid();
26
23
  };
27
24
  }
28
25
 
package/src/index.spec.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import './index'
2
2
 
3
- import './app/canary.spec.ts'
3
+ import './app/canary.spec'
4
4
  import './components/auto-complete/tests/auto-complete-match-renderer.spec'
5
5
  import './components/auto-complete/tests/auto-complete.spec'
6
6
  import './components/auto-focus/tests/auto-focus.spec'