@mediafly/js-ui 51.3.3-2 → 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.
- package/lib/constants/constants.js +1 -2
- package/lib/constants/constants.js.map +1 -1
- package/lib/date-input/date-input.js +12 -33
- package/lib/date-input/date-input.js.map +1 -1
- package/lib/date-input/validate-date.js +8 -12
- package/lib/date-input/validate-date.js.map +1 -1
- package/lib/date-time-zone-picker/date-time-zone-factory.js +49 -62
- package/lib/date-time-zone-picker/date-time-zone-factory.js.map +1 -1
- package/lib/date-time-zone-picker/date-time-zone-picker.html +6 -6
- package/lib/date-time-zone-picker/date-time-zone-picker.js +59 -119
- package/lib/date-time-zone-picker/date-time-zone-picker.js.map +1 -1
- package/lib/date-time-zone-picker/datepicker.html +3 -2
- package/lib/date-time-zone-picker/datepicker.js +26 -79
- package/lib/date-time-zone-picker/datepicker.js.map +1 -1
- package/lib/date-time-zone-picker/time-format-filter.js +8 -8
- package/lib/date-time-zone-picker/time-format-filter.js.map +1 -1
- package/lib/date-time-zone-picker/time-zone-picker.js +1 -1
- package/lib/date-time-zone-picker/timepicker.html +2 -1
- package/lib/date-time-zone-picker/timepicker.js +40 -35
- package/lib/date-time-zone-picker/timepicker.js.map +1 -1
- package/lib/feedback/feedback.component.html +17 -7
- package/lib/styles.css +10 -22
- package/lib/time-input/time-input.js +23 -27
- package/lib/time-input/time-input.js.map +1 -1
- package/lib/time-input/validate-time.js +3 -6
- package/lib/time-input/validate-time.js.map +1 -1
- package/lib/tsconfig.deploy.tsbuildinfo +25 -163
- package/package.json +4 -4
- package/src/components/constants/constants.js +1 -2
- package/src/components/date-input/date-input.js +12 -31
- package/src/components/date-input/validate-date.js +10 -14
- package/src/components/date-time-zone-picker/date-time-zone-factory.ts +49 -62
- package/src/components/date-time-zone-picker/date-time-zone-picker.html +6 -6
- package/src/components/date-time-zone-picker/date-time-zone-picker.ts +70 -131
- package/src/components/date-time-zone-picker/datepicker.html +3 -2
- package/src/components/date-time-zone-picker/datepicker.ts +26 -83
- package/src/components/date-time-zone-picker/time-format-filter.ts +8 -8
- package/src/components/date-time-zone-picker/time-zone-picker.js +1 -1
- package/src/components/date-time-zone-picker/timepicker.html +2 -1
- package/src/components/date-time-zone-picker/timepicker.js +47 -46
- package/src/components/feedback/feedback.component.html +17 -7
- package/src/components/feedback/feedback.less +24 -13
- package/src/components/less/objects/containers.less +15 -17
- package/src/components/less/variables/colors.less +8 -0
- package/src/components/time-input/time-input.js +24 -27
- package/src/components/time-input/validate-time.js +3 -6
- package/src/index.spec.js +1 -1
- package/tsconfig.tsbuildinfo +7221 -0
- 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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
|
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
|
-
|
|
98
|
-
|
|
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.
|
|
104
|
-
timeCursor
|
|
105
|
-
} while (timeCursor.
|
|
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
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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'
|