nice-elements 1.4.2 → 1.4.5
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/.vscode/settings.json +3 -2
- package/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/bower.json +11 -3
- package/dist/nice.js +290 -152
- package/dist/nice.min.js +1 -1
- package/dist/style.css +54 -61
- package/dist/style.css.map +1 -1
- package/dist/style.min.css +2 -2
- package/package.json +2 -1
- package/src/components/nice-calendar/nice-calendar.html +42 -42
- package/src/components/nice-calendar/nice-calendar.js +91 -53
- package/src/components/nice-calendar/nice-calendar.scss +12 -14
- package/src/components/nice-date/nice-date.html +63 -61
- package/src/components/nice-date/nice-date.js +23 -1
- package/src/components/nice-date/nice-date.scss +4 -4
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.html +20 -18
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.js +23 -1
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.scss +5 -6
- package/src/components/nice-dropdown/nice-dropdown.html +18 -16
- package/src/components/nice-dropdown/nice-dropdown.js +72 -62
- package/src/components/nice-dropdown/nice-dropdown.scss +10 -12
- package/src/components/nice-search2/nice-search2.html +4 -2
- package/src/components/nice-search2/nice-search2.js +38 -0
- package/src/components/nice-search2/nice-search2.scss +4 -8
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* # niceCalendar
|
|
8
8
|
*/
|
|
9
9
|
angular.module('niceElements')
|
|
10
|
-
.directive("niceCalendar", function($timeout, gettextCatalog) {
|
|
10
|
+
.directive("niceCalendar", function ($timeout, gettextCatalog) {
|
|
11
11
|
return {
|
|
12
12
|
restrict: "E",
|
|
13
13
|
templateUrl: "src/components/nice-calendar/nice-calendar.html",
|
|
@@ -18,7 +18,7 @@ angular.module('niceElements')
|
|
|
18
18
|
minDate: '=',
|
|
19
19
|
maxDate: '=',
|
|
20
20
|
hideHover: '=',
|
|
21
|
-
time: '
|
|
21
|
+
time: '=',
|
|
22
22
|
noMargin: '@',
|
|
23
23
|
color: '@',
|
|
24
24
|
endDate: '=',
|
|
@@ -28,7 +28,7 @@ angular.module('niceElements')
|
|
|
28
28
|
isInline: '=',
|
|
29
29
|
onChange: '&?'
|
|
30
30
|
},
|
|
31
|
-
link: function(scope, element) {
|
|
31
|
+
link: function (scope, element) {
|
|
32
32
|
// ------------------ Init default values ------------------
|
|
33
33
|
scope.selectStart = true;
|
|
34
34
|
scope.popupText = gettextCatalog.getString("Select start date", null, "Nice");
|
|
@@ -43,37 +43,52 @@ angular.module('niceElements')
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
// ------------------ Check if attributes are set ------------------
|
|
46
|
-
if(!scope.startDate) scope.startDate = moment().minutes(0).second(0).millisecond(0);
|
|
47
|
-
if(!scope.endDate) scope.endDate = moment().minutes(0).second(0).millisecond(0);
|
|
46
|
+
if (!scope.startDate) scope.startDate = moment().minutes(0).second(0).millisecond(0);
|
|
47
|
+
if (!scope.endDate) scope.endDate = moment().minutes(0).second(0).millisecond(0);
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
// ------------------ Look for model changes ------------------
|
|
51
|
-
scope.$watch("startDate", function(value, valueOld){
|
|
51
|
+
scope.$watch("startDate", function (value, valueOld) {
|
|
52
52
|
bootstrap();
|
|
53
53
|
});
|
|
54
54
|
|
|
55
|
-
scope.$watch("endDate", function(value, valueOld){
|
|
55
|
+
scope.$watch("endDate", function (value, valueOld) {
|
|
56
56
|
bootstrap();
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
-
scope.$watch("minDate", function(value, valueOld){
|
|
59
|
+
scope.$watch("minDate", function (value, valueOld) {
|
|
60
60
|
bootstrap();
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
scope.$watch("maxDate", function(value, valueOld){
|
|
63
|
+
scope.$watch("maxDate", function (value, valueOld) {
|
|
64
64
|
bootstrap();
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
// ------------------ Bootstrap calendar ------------------
|
|
69
69
|
function bootstrap() {
|
|
70
|
-
//scope.startDate = moment(scope.startDate.second(0).millisecond(0));
|
|
71
|
-
//scope.endDate = moment(scope.endDate.second(0).millisecond(0));
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
// scope.startDate = moment(scope.startDate.second(0).millisecond(0));
|
|
71
|
+
// scope.endDate = moment(scope.endDate.second(0).millisecond(0));
|
|
72
|
+
|
|
73
|
+
if (!scope.time) {
|
|
74
|
+
scope.startDateHour = 0;
|
|
75
|
+
scope.startDateMinute = 0;
|
|
76
|
+
scope.startDate.hours(0);
|
|
77
|
+
scope.startDate.minutes(0);
|
|
78
|
+
scope.startDate.seconds(0);
|
|
79
|
+
scope.startDate.millisecond(0);
|
|
80
|
+
scope.endDateHour = 0;
|
|
81
|
+
scope.endDateMinut = 0;
|
|
82
|
+
scope.endDate.hours(23);
|
|
83
|
+
scope.endDate.minutes(59);
|
|
84
|
+
scope.endDate.seconds(59);
|
|
85
|
+
scope.endDate.millisecond(999);
|
|
86
|
+
} else {
|
|
87
|
+
scope.startDateHour = moment(scope.startDate).hours();
|
|
88
|
+
scope.startDateMinute = moment(scope.startDate).minutes();
|
|
89
|
+
scope.endDateHour = moment(scope.endDate).hours();
|
|
90
|
+
scope.endDateMinute = moment(scope.endDate).minutes();
|
|
91
|
+
}
|
|
77
92
|
|
|
78
93
|
scope.month = angular.copy(moment(scope.startDate));
|
|
79
94
|
var start = angular.copy(moment(scope.startDate));
|
|
@@ -85,13 +100,20 @@ angular.module('niceElements')
|
|
|
85
100
|
|
|
86
101
|
|
|
87
102
|
// ------------------ Day was selected ------------------
|
|
88
|
-
scope.select = function(day) {
|
|
89
|
-
if(!day.isDisabled){
|
|
103
|
+
scope.select = function (day) {
|
|
104
|
+
if (!day.isDisabled) {
|
|
90
105
|
var selectedDate = angular.copy(day.date);
|
|
91
106
|
|
|
92
|
-
if(scope.selectStart){
|
|
93
|
-
|
|
94
|
-
|
|
107
|
+
if (scope.selectStart) {
|
|
108
|
+
if (!scope.time) {
|
|
109
|
+
selectedDate.hours(0);
|
|
110
|
+
selectedDate.minutes(0);
|
|
111
|
+
selectedDate.seconds(0);
|
|
112
|
+
selectedDate.millisecond(0);
|
|
113
|
+
} else {
|
|
114
|
+
selectedDate.hours(scope.startDateHour);
|
|
115
|
+
selectedDate.minutes(scope.startDateMinute);
|
|
116
|
+
}
|
|
95
117
|
|
|
96
118
|
// Set start date
|
|
97
119
|
scope.startDate = selectedDate;
|
|
@@ -101,12 +123,19 @@ angular.module('niceElements')
|
|
|
101
123
|
scope.displayStartChange();
|
|
102
124
|
|
|
103
125
|
// If start date is after end date
|
|
104
|
-
if(scope.startDate.isAfter(scope.endDate)){
|
|
126
|
+
if (scope.startDate.isAfter(scope.endDate)) {
|
|
105
127
|
scope.endDate = angular.copy(scope.startDate);
|
|
106
128
|
}
|
|
107
129
|
} else {
|
|
108
|
-
|
|
109
|
-
|
|
130
|
+
if (!scope.time) {
|
|
131
|
+
selectedDate.hours(23);
|
|
132
|
+
selectedDate.minutes(59);
|
|
133
|
+
selectedDate.seconds(59);
|
|
134
|
+
selectedDate.millisecond(999);
|
|
135
|
+
} else {
|
|
136
|
+
selectedDate.hours(scope.endDateHour);
|
|
137
|
+
selectedDate.minutes(scope.endDateMinute);
|
|
138
|
+
}
|
|
110
139
|
|
|
111
140
|
// Set end date
|
|
112
141
|
scope.endDate = selectedDate;
|
|
@@ -116,85 +145,94 @@ angular.module('niceElements')
|
|
|
116
145
|
scope.displayEndChange();
|
|
117
146
|
|
|
118
147
|
// If end date is before start date
|
|
119
|
-
if(scope.endDate.isBefore(scope.startDate)){
|
|
148
|
+
if (scope.endDate.isBefore(scope.startDate)) {
|
|
120
149
|
scope.startDate = angular.copy(scope.endDate);
|
|
121
150
|
}
|
|
122
151
|
}
|
|
123
152
|
|
|
124
|
-
if (scope.onChange) scope.onChange({ model: {startDate: scope.startDate, endDate: scope.endDate}, element: element });
|
|
153
|
+
if (scope.onChange) scope.onChange({ model: { startDate: scope.startDate, endDate: scope.endDate }, element: element });
|
|
125
154
|
}
|
|
126
155
|
};
|
|
127
156
|
|
|
128
157
|
|
|
129
158
|
// ------------------ Display date changes ------------------
|
|
130
|
-
scope.displayStartChange = function(){
|
|
159
|
+
scope.displayStartChange = function () {
|
|
131
160
|
scope.startTimeClass = "change";
|
|
132
|
-
$timeout(function(){
|
|
161
|
+
$timeout(function () {
|
|
133
162
|
scope.startTimeClass = "";
|
|
134
163
|
}, 1000);
|
|
135
164
|
};
|
|
136
165
|
|
|
137
|
-
scope.displayEndChange = function(){
|
|
166
|
+
scope.displayEndChange = function () {
|
|
138
167
|
scope.endTimeClass = "change";
|
|
139
|
-
$timeout(function(){
|
|
168
|
+
$timeout(function () {
|
|
140
169
|
scope.endTimeClass = "";
|
|
141
170
|
}, 1000);
|
|
142
171
|
};
|
|
143
172
|
|
|
144
173
|
|
|
145
174
|
// ------------------ Time changes ------------------
|
|
146
|
-
scope.startHourChange = function(value){
|
|
175
|
+
scope.startHourChange = function (value) {
|
|
147
176
|
scope.startDateHour = value;
|
|
148
177
|
scope.startDate = moment(scope.startDate).hours(scope.startDateHour);
|
|
149
178
|
scope.formCalendar.$setDirty();
|
|
150
179
|
scope.displayStartChange();
|
|
180
|
+
scope.handleUpdate();
|
|
151
181
|
};
|
|
152
182
|
|
|
153
183
|
|
|
154
|
-
scope.startMinuteChange = function(value) {
|
|
184
|
+
scope.startMinuteChange = function (value) {
|
|
155
185
|
scope.startDateMinute = value;
|
|
156
186
|
scope.startDate = moment(scope.startDate).minutes(scope.startDateMinute);
|
|
157
187
|
scope.formCalendar.$setDirty();
|
|
158
188
|
scope.displayStartChange();
|
|
189
|
+
scope.handleUpdate();
|
|
159
190
|
};
|
|
160
191
|
|
|
161
192
|
|
|
162
|
-
scope.endHourChange = function(value){
|
|
193
|
+
scope.endHourChange = function (value) {
|
|
163
194
|
scope.endDateHour = value;
|
|
164
195
|
scope.endDate = moment(scope.endDate).hours(scope.endDateHour);
|
|
165
196
|
scope.formCalendar.$setDirty();
|
|
166
197
|
scope.displayEndChange();
|
|
198
|
+
scope.handleUpdate();
|
|
167
199
|
};
|
|
168
200
|
|
|
169
201
|
|
|
170
|
-
scope.endMinuteChange = function(value) {
|
|
202
|
+
scope.endMinuteChange = function (value) {
|
|
171
203
|
scope.endDateMinute = value;
|
|
172
204
|
scope.endDate = moment(scope.endDate).minutes(scope.endDateMinute);
|
|
173
205
|
scope.formCalendar.$setDirty();
|
|
174
206
|
scope.displayEndChange();
|
|
207
|
+
scope.handleUpdate();
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
scope.handleUpdate = function () {
|
|
212
|
+
if (scope.onChange) scope.onChange({ model: { startDate: scope.startDate, endDate: scope.endDate }, element: element });
|
|
175
213
|
};
|
|
176
214
|
|
|
177
215
|
|
|
178
216
|
// ------------------ Go to next month ------------------
|
|
179
|
-
scope.next = function() {
|
|
217
|
+
scope.next = function () {
|
|
180
218
|
var next = angular.copy(scope.month);
|
|
181
|
-
_removeTimeWithDate(next.month(next.month()+1).date(0));
|
|
182
|
-
scope.month.month(scope.month.month()+1);
|
|
219
|
+
_removeTimeWithDate(next.month(next.month() + 1).date(0));
|
|
220
|
+
scope.month.month(scope.month.month() + 1);
|
|
183
221
|
_buildMonth(scope, next, scope.month);
|
|
184
222
|
};
|
|
185
223
|
|
|
186
224
|
|
|
187
225
|
// ------------------ Go to previous month ------------------
|
|
188
|
-
scope.previous = function() {
|
|
226
|
+
scope.previous = function () {
|
|
189
227
|
var previous = angular.copy(scope.month);
|
|
190
|
-
_removeTimeWithDate(previous.month(previous.month()-1).date(0));
|
|
191
|
-
scope.month.month(scope.month.month()-1);
|
|
228
|
+
_removeTimeWithDate(previous.month(previous.month() - 1).date(0));
|
|
229
|
+
scope.month.month(scope.month.month() - 1);
|
|
192
230
|
_buildMonth(scope, previous, scope.month);
|
|
193
231
|
};
|
|
194
232
|
|
|
195
233
|
|
|
196
234
|
// ------------------ Check if dates are equal without time ------------------
|
|
197
|
-
scope.isSameDay = function(date1, date2){
|
|
235
|
+
scope.isSameDay = function (date1, date2) {
|
|
198
236
|
var d1 = _removeTime(angular.copy(date1));
|
|
199
237
|
var d2 = _removeTime(angular.copy(date2));
|
|
200
238
|
return d1.isSame(d2);
|
|
@@ -202,20 +240,20 @@ angular.module('niceElements')
|
|
|
202
240
|
|
|
203
241
|
|
|
204
242
|
// ------------------ Check if date is between start and end date ------------------
|
|
205
|
-
scope.isBetweenRange = function(date){
|
|
243
|
+
scope.isBetweenRange = function (date) {
|
|
206
244
|
return (date.isBefore(moment(scope.endDate)) && date.isAfter(moment(scope.startDate)));
|
|
207
245
|
};
|
|
208
246
|
|
|
209
247
|
|
|
210
248
|
// ------------------ Format date ------------------
|
|
211
|
-
scope.formatDate = function(date){
|
|
212
|
-
if(scope.time) return moment(date).format('D.M.YYYY • H:mm');
|
|
249
|
+
scope.formatDate = function (date) {
|
|
250
|
+
if (scope.time) return moment(date).format('D.M.YYYY • H:mm');
|
|
213
251
|
else return moment(date).format('D.M.YYYY');
|
|
214
252
|
};
|
|
215
253
|
|
|
216
254
|
|
|
217
255
|
// ------------------ Lighten color by 20% ------------------
|
|
218
|
-
scope.lighten = function(col){
|
|
256
|
+
scope.lighten = function (col) {
|
|
219
257
|
var amt = 20;
|
|
220
258
|
var usePound = false;
|
|
221
259
|
|
|
@@ -224,21 +262,21 @@ angular.module('niceElements')
|
|
|
224
262
|
usePound = true;
|
|
225
263
|
}
|
|
226
264
|
|
|
227
|
-
var num = parseInt(col,16);
|
|
265
|
+
var num = parseInt(col, 16);
|
|
228
266
|
var r = (num >> 16) + amt;
|
|
229
267
|
|
|
230
268
|
if (r > 255) r = 255;
|
|
231
|
-
else if
|
|
269
|
+
else if (r < 0) r = 0;
|
|
232
270
|
|
|
233
271
|
var b = ((num >> 8) & 0x00FF) + amt;
|
|
234
272
|
if (b > 255) b = 255;
|
|
235
|
-
else if
|
|
273
|
+
else if (b < 0) b = 0;
|
|
236
274
|
|
|
237
275
|
var g = (num & 0x0000FF) + amt;
|
|
238
276
|
if (g > 255) g = 255;
|
|
239
277
|
else if (g < 0) g = 0;
|
|
240
278
|
|
|
241
|
-
return (usePound?"#":"") + (g | (b << 8) | (r << 16)).toString(16);
|
|
279
|
+
return (usePound ? "#" : "") + (g | (b << 8) | (r << 16)).toString(16);
|
|
242
280
|
};
|
|
243
281
|
|
|
244
282
|
|
|
@@ -280,9 +318,9 @@ angular.module('niceElements')
|
|
|
280
318
|
date: date
|
|
281
319
|
};
|
|
282
320
|
|
|
283
|
-
if(scope.minDate) day.isDisabled = date.isBefore(moment(scope.minDate));
|
|
284
|
-
if(scope.maxDate) day.isDisabled = date.isAfter(moment(scope.maxDate));
|
|
285
|
-
if(scope.minDate && scope.maxDate) day.isDisabled = !date.isBetween(moment(scope.minDate), moment(scope.maxDate));
|
|
321
|
+
if (scope.minDate) day.isDisabled = date.isBefore(moment(scope.minDate));
|
|
322
|
+
if (scope.maxDate) day.isDisabled = date.isAfter(moment(scope.maxDate));
|
|
323
|
+
if (scope.minDate && scope.maxDate) day.isDisabled = !date.isBetween(moment(scope.minDate), moment(scope.maxDate));
|
|
286
324
|
|
|
287
325
|
days.push(day);
|
|
288
326
|
date = date.clone();
|
|
@@ -293,4 +331,4 @@ angular.module('niceElements')
|
|
|
293
331
|
}
|
|
294
332
|
}
|
|
295
333
|
};
|
|
296
|
-
});
|
|
334
|
+
});
|
|
@@ -2,34 +2,34 @@
|
|
|
2
2
|
display: block;
|
|
3
3
|
|
|
4
4
|
.nice-selected-dates {
|
|
5
|
-
padding: 5px 10px;
|
|
5
|
+
padding: 0 10px 5px 10px;
|
|
6
|
+
display: flex;
|
|
6
7
|
|
|
7
8
|
.nice-start-date, .nice-end-date{
|
|
8
9
|
width: 50%;
|
|
9
|
-
float: left;
|
|
10
10
|
color: $nice-font-color;
|
|
11
11
|
transition: all 0.3s ease;
|
|
12
12
|
|
|
13
13
|
label{
|
|
14
14
|
font-size: 9px;
|
|
15
15
|
font-weight: normal;
|
|
16
|
+
margin: 0;
|
|
17
|
+
line-height: 1;
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
|
|
19
|
-
.nice-
|
|
20
|
-
padding-right: 10px;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.nice-end-date{
|
|
24
|
-
padding-left: 10px;
|
|
21
|
+
.nice-end-date {
|
|
25
22
|
text-align: right;
|
|
26
23
|
}
|
|
27
24
|
}
|
|
28
25
|
|
|
26
|
+
.nice-calendar-weeks {
|
|
27
|
+
border-bottom: 1px solid $nice-border-color;
|
|
28
|
+
}
|
|
29
|
+
|
|
29
30
|
|
|
30
|
-
.nice-calendar-time{
|
|
31
|
-
|
|
32
|
-
position: relative;
|
|
31
|
+
.nice-calendar-time {
|
|
32
|
+
display: flex;
|
|
33
33
|
|
|
34
34
|
.no-border-right{
|
|
35
35
|
.time-picker-minute{
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
.time-picker{
|
|
41
41
|
position: relative;
|
|
42
42
|
width: 20%;
|
|
43
|
-
float: left;
|
|
44
43
|
height: 30px;
|
|
45
44
|
|
|
46
45
|
&:after{
|
|
@@ -145,7 +144,7 @@
|
|
|
145
144
|
}
|
|
146
145
|
|
|
147
146
|
.week {
|
|
148
|
-
|
|
147
|
+
display: flex;
|
|
149
148
|
width: 100%;
|
|
150
149
|
border-top: solid 1px $nice-border-color;
|
|
151
150
|
|
|
@@ -155,7 +154,6 @@
|
|
|
155
154
|
|
|
156
155
|
.day {
|
|
157
156
|
position: relative;
|
|
158
|
-
float: left;
|
|
159
157
|
width: $day-width;
|
|
160
158
|
height: $day-height;
|
|
161
159
|
line-height: $day-height;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<div class="disabled-shield" ng-if="isDisabled"></div>
|
|
14
14
|
|
|
15
15
|
<!------------------------------ Input ------------------------------>
|
|
16
|
-
<div class="input-group" ng-class="{ 'open': isOpen }" ng-
|
|
16
|
+
<div class="nice-date-button input-group" ng-class="{ 'open': isOpen }" ng-show="!inline" ng-click="toggleOpen()">
|
|
17
17
|
<input type="text" class="form-control" value="{{ model | niceDate:time }}" readonly="readonly" />
|
|
18
18
|
<span class="input-group-addon clickable">
|
|
19
19
|
<i class="fa fa-calendar"></i>
|
|
@@ -21,73 +21,75 @@
|
|
|
21
21
|
</div>
|
|
22
22
|
|
|
23
23
|
<!-------- Dropdown -------->
|
|
24
|
-
<div
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<div class="nice-date-
|
|
28
|
-
<
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
24
|
+
<div class="nice-date-dropdown-wrapper">
|
|
25
|
+
<div ng-class="{ 'nice-date-dropdown': !inline }" ng-if="inline || isOpen">
|
|
26
|
+
<!------------------------------ Date picker ------------------------------>
|
|
27
|
+
<div class="nice-date-date" ng-class="{ 'with-time': time }">
|
|
28
|
+
<div class="nice-date-header">
|
|
29
|
+
<span>
|
|
30
|
+
<select
|
|
31
|
+
class="year-picker"
|
|
32
|
+
ng-model="innerDate.year"
|
|
33
|
+
ng-change="handleDateChange()"
|
|
34
|
+
ng-options="year for year in years">
|
|
35
|
+
</select>,
|
|
36
|
+
<select
|
|
37
|
+
class="month-picker"
|
|
38
|
+
ng-model="innerDate.month"
|
|
39
|
+
ng-change="handleDateChange()"
|
|
40
|
+
ng-options="month.value as month.name for month in months">
|
|
41
|
+
</select>
|
|
42
|
+
</span>
|
|
43
|
+
<i class="fa fa-angle-left" ng-click="previous()"></i>
|
|
44
|
+
<i class="fa fa-circle" ng-click="today()"></i>
|
|
45
|
+
<i class="fa fa-angle-right" ng-click="next()"></i>
|
|
46
|
+
</div>
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
<div class="nice-date-week names">
|
|
49
|
+
<span class="nice-date-day" ng-class="{ 'weekend': $index == 6 || $index == 5 }" ng-repeat="day in weekdays">{{ day }}</span>
|
|
50
|
+
</div>
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
52
|
+
<div class="nice-date-week" ng-repeat="week in weeks">
|
|
53
|
+
<span
|
|
54
|
+
class="nice-date-day"
|
|
55
|
+
title="{{ day.value }}"
|
|
56
|
+
ng-class="{
|
|
57
|
+
'today': day.isToday,
|
|
58
|
+
'different-month': !day.isCurrentMonth,
|
|
59
|
+
'selected': isSameDay(model, day.date),
|
|
60
|
+
'weekend': day.isWeekday,
|
|
61
|
+
'disabled': day.isDisabled,
|
|
62
|
+
'between': isBetween(day.date, model, nextDate)
|
|
63
|
+
}"
|
|
64
|
+
ng-click="select(day)"
|
|
65
|
+
ng-repeat="day in week.days"
|
|
66
|
+
>{{ day.number }}</span>
|
|
67
|
+
</div>
|
|
66
68
|
</div>
|
|
67
|
-
</div>
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
<!------------------------------ Time picker ------------------------------>
|
|
71
|
+
<div class="nice-date-time" ng-if="time">
|
|
72
|
+
<i class="fa fa-clock-o"></i>
|
|
72
73
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
74
|
+
<div class="time-picker time-picker-hour">
|
|
75
|
+
<select
|
|
76
|
+
ng-disabled="isDisabled"
|
|
77
|
+
ng-model="innerDate.hour"
|
|
78
|
+
ng-change="timeChange()"
|
|
79
|
+
ng-options="hour as hour for hour in hours track by hour">
|
|
80
|
+
</select>
|
|
81
|
+
</div>
|
|
81
82
|
|
|
82
|
-
|
|
83
|
+
<div class="divider">:</div>
|
|
83
84
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
<div class="time-picker time-picker-minute">
|
|
86
|
+
<select
|
|
87
|
+
ng-disabled="isDisabled"
|
|
88
|
+
ng-model="innerDate.minute"
|
|
89
|
+
ng-change="timeChange()"
|
|
90
|
+
ng-options="minute as minute for minute in minutes track by minute">
|
|
91
|
+
</select>
|
|
92
|
+
</div>
|
|
91
93
|
</div>
|
|
92
94
|
</div>
|
|
93
95
|
</div>
|
|
@@ -30,7 +30,7 @@ angular.module('niceElements')
|
|
|
30
30
|
isInline: '=',
|
|
31
31
|
onChange: '&?'
|
|
32
32
|
},
|
|
33
|
-
controller: function($scope, gettextCatalog) {
|
|
33
|
+
controller: function($scope, $element, gettextCatalog) {
|
|
34
34
|
$scope.isOpen = false;
|
|
35
35
|
$scope.hours = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23];
|
|
36
36
|
$scope.minutes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59];
|
|
@@ -90,6 +90,27 @@ angular.module('niceElements')
|
|
|
90
90
|
if ($scope.maxDate) $scope.maxDate = moment($scope.maxDate);
|
|
91
91
|
if ($scope.minDate) $scope.minDate = moment($scope.minDate);
|
|
92
92
|
|
|
93
|
+
|
|
94
|
+
// Setup popper
|
|
95
|
+
// https://popper.js.org/docs/v2/constructors/
|
|
96
|
+
$scope.setupPopper = function() {
|
|
97
|
+
var button = $element[0].getElementsByClassName('nice-date-button')[0];
|
|
98
|
+
var tooltip = $element[0].getElementsByClassName('nice-date-dropdown-wrapper')[0];
|
|
99
|
+
$scope.popper = Popper.createPopper(button, tooltip, {
|
|
100
|
+
strategy: 'fixed',
|
|
101
|
+
placement: 'bottom-start',
|
|
102
|
+
modifiers: [
|
|
103
|
+
{
|
|
104
|
+
name: 'offset',
|
|
105
|
+
options: {
|
|
106
|
+
offset: [0, 5],
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
if (!$scope.inline) $scope.setupPopper();
|
|
113
|
+
|
|
93
114
|
|
|
94
115
|
// ------------------ Time changes ------------------
|
|
95
116
|
$scope.timeChange = function() {
|
|
@@ -296,6 +317,7 @@ angular.module('niceElements')
|
|
|
296
317
|
$scope.toggleOpen = function() {
|
|
297
318
|
if (!$scope.isDisabled) {
|
|
298
319
|
$scope.isOpen = !$scope.isOpen;
|
|
320
|
+
$scope.popper.update();
|
|
299
321
|
}
|
|
300
322
|
};
|
|
301
323
|
}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
$spacing: 10px;
|
|
3
3
|
$icon-width: 40px;
|
|
4
4
|
|
|
5
|
-
.nice-date-dropdown {
|
|
6
|
-
position: absolute;
|
|
7
|
-
margin-top: 0.5rem;
|
|
8
|
-
top: 100%;
|
|
5
|
+
.nice-date-dropdown-wrapper {
|
|
9
6
|
z-index: 1000;
|
|
10
7
|
width: 300px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.nice-date-dropdown {
|
|
11
11
|
box-shadow: $nice-box-shadow;
|
|
12
12
|
line-height: normal;
|
|
13
13
|
}
|
|
@@ -10,34 +10,36 @@
|
|
|
10
10
|
|
|
11
11
|
<!------------------------- Field ------------------------->
|
|
12
12
|
<div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
|
|
13
|
-
<div class="input-group" ng-class="{ 'open': isOpen }" ng-click="open()">
|
|
13
|
+
<div class="nice-daterange-picker-button input-group" ng-class="{ 'open': isOpen }" ng-click="open()">
|
|
14
14
|
<input type="text" class="form-control" value="{{ modelFormat }}" readonly="readonly" />
|
|
15
15
|
<!-- <div class="form-control" title="{{ modelFormat }}">{{ modelFormat }}</div> -->
|
|
16
16
|
<span class="input-group-addon clickable"><i class="fa fa-calendar"></i></span>
|
|
17
17
|
</div>
|
|
18
18
|
|
|
19
|
-
<div class="
|
|
20
|
-
<div class="dtp-
|
|
21
|
-
<div class="dtp-buttons-
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
<div class="nice-daterange-picker-wrapper">
|
|
20
|
+
<div class="dtp-wrapper" ng-if="isOpen">
|
|
21
|
+
<div class="dtp-buttons-left">
|
|
22
|
+
<div class="dtp-buttons-top">
|
|
23
|
+
<a class="btn btn-primary btn-block" ng-click="selectToday()" translate translate-context="Nice">Last 24 hours</a>
|
|
24
|
+
<a class="btn btn-primary btn-block" ng-click="selectLastNDays(7)" translate translate-context="Nice">Last 7 days</a>
|
|
25
|
+
<a class="btn btn-primary btn-block" ng-click="selectLastMonth()" translate translate-context="Nice">Last month</a>
|
|
26
|
+
<a class="btn btn-primary btn-block" ng-click="selectThisMonth()" translate translate-context="Nice">This month</a>
|
|
27
|
+
</div>
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
<div class="dtp-buttons-bottom">
|
|
30
|
+
<a class="btn btn-danger btn-block" ng-click="close()" translate translate-context="Nice">Cancel</a>
|
|
31
|
+
<a class="btn btn-success btn-block" ng-click="confirm()" translate translate-context="Nice">OK</a>
|
|
32
|
+
</div>
|
|
31
33
|
</div>
|
|
32
|
-
</div>
|
|
33
34
|
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
<div class="dtp-left">
|
|
37
|
+
<nice-date model="innerStartDate" next-date="innerEndDate" field-width="col-xs-12" no-margin="true" inline="true" time="time"></nice-date>
|
|
38
|
+
</div>
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
<div class="dtp-right">
|
|
41
|
+
<nice-date model="innerEndDate" next-date="innerStartDate" field-width="col-xs-12" no-margin="true" inline="true" time="time"></nice-date>
|
|
42
|
+
</div>
|
|
41
43
|
</div>
|
|
42
44
|
</div>
|
|
43
45
|
</div>
|