nice-elements 1.6.1 → 1.7.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/CHANGELOG.md +12 -1
- package/README.md +1 -1
- package/bower.json +1 -1
- package/dist/nice.js +318 -161
- package/dist/nice.min.js +1 -1
- package/dist/style.css +262 -114
- package/dist/style.css.map +3 -2
- package/dist/style.min.css +2 -2
- package/package.json +1 -1
- package/src/components/nice-calendar/nice-calendar.html +3 -2
- package/src/components/nice-calendar/nice-calendar.scss +9 -5
- package/src/components/nice-checkbox/nice-checkbox.html +1 -3
- package/src/components/nice-checkbox/nice-checkbox.scss +12 -12
- package/src/components/nice-choice/nice-choice.html +3 -1
- package/src/components/nice-choice/nice-choice.scss +14 -3
- package/src/components/nice-date/nice-date.html +5 -4
- package/src/components/nice-date/nice-date.js +50 -52
- package/src/components/nice-date/nice-date.scss +29 -6
- package/src/components/nice-date-input/nice-date-input.html +41 -0
- package/src/components/nice-date-input/nice-date-input.js +97 -0
- package/src/components/nice-date-input/nice-date-input.scss +49 -0
- package/src/components/nice-date-range/nice-date-range.html +3 -1
- package/src/components/nice-datetime-picker/nice-datetime-picker.html +5 -19
- package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.html +6 -1
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.html +5 -3
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.js +25 -26
- package/src/components/nice-dropdown/nice-dropdown.html +3 -1
- package/src/components/nice-dropdown/nice-dropdown.scss +1 -0
- package/src/components/nice-dtp/nice-dtp.html +12 -12
- package/src/components/nice-help/nice-help.html +2 -1
- package/src/components/nice-help/nice-help.scss +7 -0
- package/src/components/nice-input/nice-input.html +9 -42
- package/src/components/nice-input/nice-input.js +28 -28
- package/src/components/nice-input/nice-input.scss +27 -20
- package/src/components/nice-number/nice-number.html +6 -2
- package/src/components/nice-number/nice-number.scss +15 -3
- package/src/components/nice-quantity/nice-quantity.html +6 -2
- package/src/components/nice-quantity/nice-quantity.scss +11 -0
- package/src/components/nice-search/nice-search.html +9 -20
- package/src/components/nice-search2/nice-search2.html +4 -2
- package/src/components/nice-time-picker/nice-time-picker.html +21 -27
- package/src/components/nice-time-picker/nice-time-picker.scss +11 -32
- package/src/components/nice-upload/nice-upload.html +10 -7
- package/src/components/nice-upload/nice-upload.scss +26 -31
- package/src/components/nice-yesno/nice-yesno.html +2 -2
- package/src/components/nice-yesno/nice-yesno.scss +13 -0
- package/src/styles/_nice-buttons.scss +22 -9
- package/src/styles/_nice-common.scss +57 -13
- package/src/styles/_nice.scss +2 -1
- package/src/styles/_variables.scss +3 -0
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
angular.module('niceElements')
|
|
10
10
|
|
|
11
|
-
.directive('niceDate', function() {
|
|
11
|
+
.directive('niceDate', function () {
|
|
12
12
|
return {
|
|
13
13
|
restrict: 'E',
|
|
14
14
|
replace: true,
|
|
@@ -20,7 +20,8 @@ angular.module('niceElements')
|
|
|
20
20
|
fieldWidth: '@', // default: 'col-sm-8', bootstrap classes that defines width of field
|
|
21
21
|
labelWidth: '@', // default: 'col-sm-4', bootstrap classes that defines width of label
|
|
22
22
|
model: '=',
|
|
23
|
-
time: '
|
|
23
|
+
time: '=?',
|
|
24
|
+
date: '=?',
|
|
24
25
|
help: '@',
|
|
25
26
|
inline: '@',
|
|
26
27
|
maxDate: '=',
|
|
@@ -30,14 +31,17 @@ angular.module('niceElements')
|
|
|
30
31
|
isInline: '=',
|
|
31
32
|
onChange: '&?'
|
|
32
33
|
},
|
|
33
|
-
controller: function($scope, $element, $timeout, gettextCatalog) {
|
|
34
|
+
controller: function ($scope, $element, $timeout, gettextCatalog) {
|
|
34
35
|
$scope.isOpen = false;
|
|
36
|
+
if ($scope.date == undefined) $scope.date = true;
|
|
37
|
+
if ($scope.time == undefined) $scope.time = false;
|
|
35
38
|
$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
39
|
$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];
|
|
37
40
|
$scope.translations = {
|
|
38
41
|
nextMonth: gettextCatalog.getString("Next month", null, "Nice"),
|
|
39
42
|
prevMonth: gettextCatalog.getString("Previous month", null, "Nice"),
|
|
40
43
|
};
|
|
44
|
+
if (!$scope.model) $scope.model = moment();
|
|
41
45
|
$scope.innerDate = {
|
|
42
46
|
month: 0,
|
|
43
47
|
year: 0,
|
|
@@ -50,18 +54,18 @@ angular.module('niceElements')
|
|
|
50
54
|
|
|
51
55
|
// $scope.weekdays = moment.weekdaysShort(false);
|
|
52
56
|
$scope.weekdays = [
|
|
53
|
-
gettextCatalog.getString("Mon", null, "Nice"),
|
|
54
|
-
gettextCatalog.getString("Tue", null, "Nice"),
|
|
55
|
-
gettextCatalog.getString("Wed", null, "Nice"),
|
|
56
|
-
gettextCatalog.getString("Thu", null, "Nice"),
|
|
57
|
-
gettextCatalog.getString("Fri", null, "Nice"),
|
|
58
|
-
gettextCatalog.getString("Sat", null, "Nice"),
|
|
57
|
+
gettextCatalog.getString("Mon", null, "Nice"),
|
|
58
|
+
gettextCatalog.getString("Tue", null, "Nice"),
|
|
59
|
+
gettextCatalog.getString("Wed", null, "Nice"),
|
|
60
|
+
gettextCatalog.getString("Thu", null, "Nice"),
|
|
61
|
+
gettextCatalog.getString("Fri", null, "Nice"),
|
|
62
|
+
gettextCatalog.getString("Sat", null, "Nice"),
|
|
59
63
|
gettextCatalog.getString("Sun", null, "Nice")
|
|
60
64
|
];
|
|
61
65
|
|
|
62
66
|
$scope.years = [];
|
|
63
|
-
var year = moment().year()-100;
|
|
64
|
-
for(var i=0; i<200; i++) {
|
|
67
|
+
var year = moment().year() - 100;
|
|
68
|
+
for (var i = 0; i < 200; i++) {
|
|
65
69
|
$scope.years.push(year + i);
|
|
66
70
|
}
|
|
67
71
|
|
|
@@ -80,20 +84,13 @@ angular.module('niceElements')
|
|
|
80
84
|
{ value: 11, name: gettextCatalog.getString("December", null, "Nice") }
|
|
81
85
|
]
|
|
82
86
|
|
|
83
|
-
|
|
84
|
-
if(!$scope.model) $scope.model = moment();
|
|
85
|
-
|
|
86
|
-
if(!$scope.time) $scope.time = false;
|
|
87
|
-
else $scope.time = $scope.time == "true";
|
|
88
|
-
|
|
89
|
-
|
|
90
87
|
if ($scope.maxDate) $scope.maxDate = moment($scope.maxDate);
|
|
91
88
|
if ($scope.minDate) $scope.minDate = moment($scope.minDate);
|
|
92
89
|
|
|
93
|
-
|
|
90
|
+
|
|
94
91
|
// Setup popper
|
|
95
92
|
// https://popper.js.org/docs/v2/constructors/
|
|
96
|
-
$scope.setupPopper = function() {
|
|
93
|
+
$scope.setupPopper = function () {
|
|
97
94
|
var button = $element[0].getElementsByClassName('nice-date-button')[0];
|
|
98
95
|
var tooltip = $element[0].getElementsByClassName('nice-date-dropdown-wrapper')[0];
|
|
99
96
|
$scope.popper = Popper.createPopper(button, tooltip, {
|
|
@@ -116,13 +113,13 @@ angular.module('niceElements')
|
|
|
116
113
|
|
|
117
114
|
|
|
118
115
|
// ------------------ Time changes ------------------
|
|
119
|
-
$scope.timeChange = function() {
|
|
116
|
+
$scope.timeChange = function () {
|
|
120
117
|
var selectedDate = angular.copy($scope.model);
|
|
121
118
|
selectedDate = $scope._removeTime(selectedDate);
|
|
122
119
|
selectedDate.hours($scope.innerDate.hour);
|
|
123
120
|
selectedDate.minutes($scope.innerDate.minute);
|
|
124
121
|
$scope.innerDate.value = $scope.formatDate(selectedDate);
|
|
125
|
-
|
|
122
|
+
|
|
126
123
|
$scope.model = selectedDate;
|
|
127
124
|
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
128
125
|
$scope.forma.$setDirty();
|
|
@@ -130,8 +127,8 @@ angular.module('niceElements')
|
|
|
130
127
|
|
|
131
128
|
|
|
132
129
|
// ------------------ Day was selected ------------------
|
|
133
|
-
$scope.select = function(day) {
|
|
134
|
-
if(!day.isDisabled){
|
|
130
|
+
$scope.select = function (day) {
|
|
131
|
+
if (!day.isDisabled) {
|
|
135
132
|
var selectedDate = angular.copy(day.date);
|
|
136
133
|
selectedDate.hours($scope.innerDate.hour);
|
|
137
134
|
selectedDate.minutes($scope.innerDate.minute);
|
|
@@ -152,7 +149,7 @@ angular.module('niceElements')
|
|
|
152
149
|
|
|
153
150
|
|
|
154
151
|
// ------------------ Set inner date ------------------
|
|
155
|
-
$scope.setInnerDate = function(date) {
|
|
152
|
+
$scope.setInnerDate = function (date) {
|
|
156
153
|
$scope.innerDate.year = date.year();
|
|
157
154
|
$scope.innerDate.month = date.month();
|
|
158
155
|
$scope.innerDate.date = date;
|
|
@@ -160,14 +157,14 @@ angular.module('niceElements')
|
|
|
160
157
|
|
|
161
158
|
|
|
162
159
|
// ------------------ Today ------------------
|
|
163
|
-
$scope.today = function() {
|
|
160
|
+
$scope.today = function () {
|
|
164
161
|
$scope.setInnerDate(moment());
|
|
165
162
|
$scope._buildMonth();
|
|
166
163
|
};
|
|
167
164
|
|
|
168
165
|
|
|
169
166
|
// ------------------ Go to next month ------------------
|
|
170
|
-
$scope.next = function() {
|
|
167
|
+
$scope.next = function () {
|
|
171
168
|
$scope.innerDate.date.add(1, "month");
|
|
172
169
|
$scope.setInnerDate($scope.innerDate.date);
|
|
173
170
|
$scope._buildMonth();
|
|
@@ -175,7 +172,7 @@ angular.module('niceElements')
|
|
|
175
172
|
|
|
176
173
|
|
|
177
174
|
// ------------------ Go to previous month ------------------
|
|
178
|
-
$scope.previous = function() {
|
|
175
|
+
$scope.previous = function () {
|
|
179
176
|
$scope.innerDate.date.subtract(1, "month");
|
|
180
177
|
$scope.setInnerDate($scope.innerDate.date);
|
|
181
178
|
$scope._buildMonth();
|
|
@@ -183,7 +180,7 @@ angular.module('niceElements')
|
|
|
183
180
|
|
|
184
181
|
|
|
185
182
|
// ------------------ Check if dates are equal without time ------------------
|
|
186
|
-
$scope.isSameDay = function(date1, date2){
|
|
183
|
+
$scope.isSameDay = function (date1, date2) {
|
|
187
184
|
date1 = moment(date1);
|
|
188
185
|
date2 = moment(date2);
|
|
189
186
|
return (
|
|
@@ -194,7 +191,7 @@ angular.module('niceElements')
|
|
|
194
191
|
};
|
|
195
192
|
|
|
196
193
|
// ------------------ Check month ------------------
|
|
197
|
-
$scope.isSameMonth = function(date1, date2){
|
|
194
|
+
$scope.isSameMonth = function (date1, date2) {
|
|
198
195
|
date1 = moment(date1);
|
|
199
196
|
date2 = moment(date2);
|
|
200
197
|
return (
|
|
@@ -204,12 +201,12 @@ angular.module('niceElements')
|
|
|
204
201
|
};
|
|
205
202
|
|
|
206
203
|
|
|
207
|
-
$scope.isBetween = function(date1, date2, date3){
|
|
208
|
-
if(!$scope.nextDate){
|
|
204
|
+
$scope.isBetween = function (date1, date2, date3) {
|
|
205
|
+
if (!$scope.nextDate) {
|
|
209
206
|
return false;
|
|
210
|
-
} else if($scope.isSameDay(date1, date2) || $scope.isSameDay(date1, date3)){
|
|
207
|
+
} else if ($scope.isSameDay(date1, date2) || $scope.isSameDay(date1, date3)) {
|
|
211
208
|
return true;
|
|
212
|
-
} else if(date2.isBefore(date3)){
|
|
209
|
+
} else if (date2.isBefore(date3)) {
|
|
213
210
|
return $scope._removeTime(date1).isBetween(date2, date3);
|
|
214
211
|
} else {
|
|
215
212
|
return $scope._removeTime(date1).isBetween(date3, date2);
|
|
@@ -218,24 +215,25 @@ angular.module('niceElements')
|
|
|
218
215
|
|
|
219
216
|
|
|
220
217
|
// ------------------ Format date ------------------
|
|
221
|
-
$scope.formatDate = function(date) {
|
|
222
|
-
if($scope.time) return date.format('D.M.YYYY • H:mm');
|
|
218
|
+
$scope.formatDate = function (date) {
|
|
219
|
+
if ($scope.time) return date.format('D.M.YYYY • H:mm');
|
|
223
220
|
else return date.format('D.M.YYYY');
|
|
224
221
|
};
|
|
225
222
|
|
|
226
223
|
|
|
227
224
|
// ------------------ Remove time from date ------------------
|
|
228
|
-
$scope._removeTime = function(date) {
|
|
225
|
+
$scope._removeTime = function (date) {
|
|
226
|
+
if (!date) return date;
|
|
229
227
|
return date.hour(0).minute(0).second(0).millisecond(0);
|
|
230
228
|
};
|
|
231
229
|
|
|
232
|
-
$scope._removeTimeWithDate = function(date) {
|
|
230
|
+
$scope._removeTimeWithDate = function (date) {
|
|
233
231
|
return date.date(0).hour(0).minute(0).second(0).millisecond(0);
|
|
234
232
|
};
|
|
235
233
|
|
|
236
234
|
|
|
237
235
|
// ------------------ Build month ------------------
|
|
238
|
-
$scope._buildMonth = function() {
|
|
236
|
+
$scope._buildMonth = function () {
|
|
239
237
|
var done = false;
|
|
240
238
|
var date = angular.copy($scope.innerDate.date).date(0).startOf('week').isoWeekday(1);
|
|
241
239
|
var monthIndex = date.month();
|
|
@@ -254,7 +252,7 @@ angular.module('niceElements')
|
|
|
254
252
|
|
|
255
253
|
|
|
256
254
|
// ------------------ Build week ------------------
|
|
257
|
-
$scope._buildWeek = function(date) {
|
|
255
|
+
$scope._buildWeek = function (date) {
|
|
258
256
|
var days = [];
|
|
259
257
|
for (var i = 0; i < 7; i++) {
|
|
260
258
|
var day = {
|
|
@@ -267,9 +265,9 @@ angular.module('niceElements')
|
|
|
267
265
|
date: date
|
|
268
266
|
};
|
|
269
267
|
|
|
270
|
-
if($scope.minDate) day.isDisabled = date.isBefore($scope.minDate);
|
|
271
|
-
if($scope.maxDate) day.isDisabled = date.isAfter($scope.maxDate);
|
|
272
|
-
if($scope.minDate && $scope.maxDate) day.isDisabled = !date.isBetween($scope.minDate, $scope.maxDate);
|
|
268
|
+
if ($scope.minDate) day.isDisabled = date.isBefore($scope.minDate);
|
|
269
|
+
if ($scope.maxDate) day.isDisabled = date.isAfter($scope.maxDate);
|
|
270
|
+
if ($scope.minDate && $scope.maxDate) day.isDisabled = !date.isBetween($scope.minDate, $scope.maxDate);
|
|
273
271
|
|
|
274
272
|
days.push(day);
|
|
275
273
|
date = date.clone();
|
|
@@ -281,13 +279,13 @@ angular.module('niceElements')
|
|
|
281
279
|
|
|
282
280
|
|
|
283
281
|
// ------------------ Watch for model change ------------------
|
|
284
|
-
$scope.$watchGroup(["model", 'minDate', 'maxDate', 'nextDate'], function(value) {
|
|
282
|
+
$scope.$watchGroup(["model", 'minDate', 'maxDate', 'nextDate'], function (value) {
|
|
285
283
|
$scope.boostrap();
|
|
286
284
|
});
|
|
287
|
-
|
|
285
|
+
|
|
288
286
|
|
|
289
287
|
// ------------------ Get time ------------------
|
|
290
|
-
$scope.getTime = function() {
|
|
288
|
+
$scope.getTime = function () {
|
|
291
289
|
if ($scope.time) {
|
|
292
290
|
$scope.innerDate.hour = moment($scope.model).hours();
|
|
293
291
|
$scope.innerDate.minute = moment($scope.model).minutes();
|
|
@@ -301,14 +299,14 @@ angular.module('niceElements')
|
|
|
301
299
|
|
|
302
300
|
|
|
303
301
|
// ------------------ Bootstrap ------------------
|
|
304
|
-
$scope.boostrap = function() {
|
|
302
|
+
$scope.boostrap = function () {
|
|
305
303
|
$scope.setInnerDate(moment($scope.model));
|
|
306
304
|
$scope.getTime();
|
|
307
|
-
|
|
308
|
-
if(!$scope.time) {
|
|
305
|
+
|
|
306
|
+
if (!$scope.time) {
|
|
309
307
|
$scope.model = $scope._removeTime($scope.model);
|
|
310
308
|
}
|
|
311
|
-
|
|
309
|
+
|
|
312
310
|
$scope.innerDate.value = $scope.formatDate(moment($scope.model));
|
|
313
311
|
$scope._buildMonth();
|
|
314
312
|
};
|
|
@@ -317,10 +315,10 @@ angular.module('niceElements')
|
|
|
317
315
|
|
|
318
316
|
|
|
319
317
|
// ------------------ Toggle open ------------------
|
|
320
|
-
$scope.toggleOpen = function() {
|
|
318
|
+
$scope.toggleOpen = function () {
|
|
321
319
|
if (!$scope.isDisabled) {
|
|
322
320
|
$scope.isOpen = !$scope.isOpen;
|
|
323
|
-
$timeout(function() {
|
|
321
|
+
$timeout(function () {
|
|
324
322
|
if ($scope.popper) $scope.popper.update();
|
|
325
323
|
})
|
|
326
324
|
}
|
|
@@ -43,6 +43,23 @@
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
.with-time {
|
|
47
|
+
.nice-date-date {
|
|
48
|
+
border-bottom-left-radius: 0;
|
|
49
|
+
border-bottom-right-radius: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.nice-date-time {
|
|
53
|
+
border-top: 0 none;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.no-date {
|
|
58
|
+
.nice-date-time {
|
|
59
|
+
border-top: 1px solid $nice-border-color;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
46
63
|
.nice-date-date {
|
|
47
64
|
border-radius: $nice-border-radius;
|
|
48
65
|
background: white;
|
|
@@ -55,11 +72,6 @@
|
|
|
55
72
|
height: 250px;
|
|
56
73
|
width: 100%;
|
|
57
74
|
|
|
58
|
-
&.with-time {
|
|
59
|
-
border-bottom-left-radius: 0;
|
|
60
|
-
border-bottom-right-radius: 0;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
75
|
.nice-date-header {
|
|
64
76
|
background: $nice-base-color;
|
|
65
77
|
line-height: 40px;
|
|
@@ -101,6 +113,7 @@
|
|
|
101
113
|
background: transparent;
|
|
102
114
|
border: 0px;
|
|
103
115
|
-webkit-appearance: none;
|
|
116
|
+
appearance: none;
|
|
104
117
|
cursor: pointer;
|
|
105
118
|
|
|
106
119
|
&:focus {
|
|
@@ -211,6 +224,10 @@
|
|
|
211
224
|
color: darken($nice-base-color, 10%);
|
|
212
225
|
min-height: 20px;
|
|
213
226
|
cursor: default;
|
|
227
|
+
|
|
228
|
+
&:hover {
|
|
229
|
+
background: white;
|
|
230
|
+
}
|
|
214
231
|
}
|
|
215
232
|
}
|
|
216
233
|
}
|
|
@@ -222,7 +239,7 @@
|
|
|
222
239
|
padding: 10px;
|
|
223
240
|
background: #ffffff;
|
|
224
241
|
border: 1px solid #cad4d9;
|
|
225
|
-
|
|
242
|
+
align-items: center;
|
|
226
243
|
|
|
227
244
|
border-bottom-left-radius: $nice-border-radius;
|
|
228
245
|
border-bottom-right-radius: $nice-border-radius;
|
|
@@ -238,6 +255,12 @@
|
|
|
238
255
|
color: $nice-border-color;
|
|
239
256
|
}
|
|
240
257
|
|
|
258
|
+
svg {
|
|
259
|
+
height: 16px;
|
|
260
|
+
width: 16px;
|
|
261
|
+
margin-right: 10px;
|
|
262
|
+
}
|
|
263
|
+
|
|
241
264
|
.time-picker {
|
|
242
265
|
position: relative;
|
|
243
266
|
// flex-grow: 1;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<div class="nice-component nice-date-input" ng-form="niceDateInputForm" ng-class="{ 'margin-bottom-0': noMargin, 'nice-component-inline': isInline, 'error': niceDateInputForm.$invalid }">
|
|
2
|
+
<div class="row">
|
|
3
|
+
<!------------------------- Label ------------------------->
|
|
4
|
+
<div class="nice-title col-xs-12" ng-class="labelWidth ? labelWidth : 'col-sm-4'" ng-if="title">
|
|
5
|
+
<div class="nice-title-text">{{ title }}<span ng-if="required">*</span></div>
|
|
6
|
+
<nice-help class="nice-title-help" ng-if="help" text="{{ help }}"></nice-help>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<!------------------------- Field ------------------------->
|
|
10
|
+
<div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
|
|
11
|
+
<div class="input-group nice-date-input" ng-if="date" ng-class="{ 'has-warning': !disabled && niceDateInputForm.$invalid && niceDateInputForm.$dirty }">
|
|
12
|
+
<input type="text" class="form-control" ng-model="modelDate" ng-blur="dateBlur()" ng-disabled="isDisabled">
|
|
13
|
+
<nice-popup placement="bottom">
|
|
14
|
+
<nice-popup-target>
|
|
15
|
+
<button class="input-group-addon btn btn-default" tabindex="-1">
|
|
16
|
+
<nice-icon icon="icon-calendar"></nice-icon>
|
|
17
|
+
</button>
|
|
18
|
+
</nice-popup-target>
|
|
19
|
+
|
|
20
|
+
<nice-popup-content>
|
|
21
|
+
<nice-date is-inline="true" inline="true" model="model" on-change="dateChanged(model)" no-margin="true"></nice-date>
|
|
22
|
+
</nice-popup-content>
|
|
23
|
+
</nice-popup>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="input-group nice-time-input" ng-if="time" ng-class="{ 'has-warning': !disabled && niceDateInputForm.$invalid && niceDateInputForm.$dirty }">
|
|
26
|
+
<input type="text" class="form-control" ng-model="modelTime" ng-blur="timeBlur()" ng-disabled="isDisabled">
|
|
27
|
+
<nice-popup placement="bottom">
|
|
28
|
+
<nice-popup-target>
|
|
29
|
+
<button class="input-group-addon btn btn-default" tabindex="-1">
|
|
30
|
+
<nice-icon icon="icon-clock"></nice-icon>
|
|
31
|
+
</button>
|
|
32
|
+
</nice-popup-target>
|
|
33
|
+
|
|
34
|
+
<nice-popup-content>
|
|
35
|
+
<nice-date is-inline="true" inline="true" time="true" date="false" on-change="timeChanged(model)" model="model"></nice-date>
|
|
36
|
+
</nice-popup-content>
|
|
37
|
+
</nice-popup>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @ngdoc directive
|
|
5
|
+
* @name niceElements.directive:niceDatetimePicker
|
|
6
|
+
* @description
|
|
7
|
+
* # niceDatetimePicker
|
|
8
|
+
*/
|
|
9
|
+
angular.module('niceElements')
|
|
10
|
+
.directive('niceDateInput', function () {
|
|
11
|
+
return {
|
|
12
|
+
restrict: 'E',
|
|
13
|
+
transclude: false,
|
|
14
|
+
templateUrl: 'src/components/nice-date-input/nice-date-input.html',
|
|
15
|
+
scope: {
|
|
16
|
+
model: '=', // binding model
|
|
17
|
+
date: '=?', // default: true, is date picker enabled?
|
|
18
|
+
time: '=?', // default: false, is time picker enabled?
|
|
19
|
+
minDate: '@', // default: undefined
|
|
20
|
+
maxDate: '@', // default: undefined
|
|
21
|
+
title: '@', // default: ''
|
|
22
|
+
noMargin: '@', // default: false, if noMargin==true then entire directive can be injected inside other divs
|
|
23
|
+
fieldWidth: '@', // default: 'col-sm-8', bootstrap classes that defines width of field
|
|
24
|
+
labelWidth: '@', // default: 'col-sm-4', bootstrap classes that defines width of label
|
|
25
|
+
isDisabled: '=',
|
|
26
|
+
help: '@',
|
|
27
|
+
isInline: '=',
|
|
28
|
+
onChange: '&?'
|
|
29
|
+
},
|
|
30
|
+
controller: function ($scope) {
|
|
31
|
+
$scope.formatDate = "DD.MM.YYYY";
|
|
32
|
+
$scope.formatTime = "HH:mm";
|
|
33
|
+
if ($scope.date === undefined) $scope.date = true;
|
|
34
|
+
if ($scope.time === undefined) $scope.time = true;
|
|
35
|
+
$scope.model = moment($scope.model) || moment().set({ 'second': 0, 'millisecond': 0 });
|
|
36
|
+
|
|
37
|
+
$scope.dateChanged = function (date) {
|
|
38
|
+
$scope.modelDate = date.format($scope.formatDate);
|
|
39
|
+
$scope.handleChange();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
$scope.timeChanged = function (date) {
|
|
43
|
+
$scope.modelTime = date.format($scope.formatTime);
|
|
44
|
+
$scope.handleChange();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// -------------------- On date change --------------------
|
|
48
|
+
$scope.handleChange = function () {
|
|
49
|
+
var newModel = moment($scope.modelDate + " " + $scope.modelTime, $scope.formatDate + " " + $scope.formatTime).seconds(0).milliseconds(0);
|
|
50
|
+
if (newModel.isValid()) {
|
|
51
|
+
$scope.model = newModel;
|
|
52
|
+
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
53
|
+
$scope.niceDateInputForm.$setValidity('validDate', true);
|
|
54
|
+
} else {
|
|
55
|
+
$scope.model = null;
|
|
56
|
+
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
57
|
+
$scope.niceDateInputForm.$setValidity('validDate', false);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// -------------------- Format model --------------------
|
|
62
|
+
$scope.formatModel = function () {
|
|
63
|
+
$scope.modelDate = $scope.model.format($scope.formatDate);
|
|
64
|
+
$scope.modelTime = $scope.model.format($scope.formatTime);
|
|
65
|
+
}
|
|
66
|
+
$scope.formatModel();
|
|
67
|
+
|
|
68
|
+
// -------------------- Date --------------------
|
|
69
|
+
$scope.dateBlur = function () {
|
|
70
|
+
var newDate = moment($scope.modelDate, $scope.formatDate);
|
|
71
|
+
if (newDate.isValid()) {
|
|
72
|
+
$scope.niceDateInputForm.$setValidity('validDate', true);
|
|
73
|
+
$scope.handleChange();
|
|
74
|
+
} else {
|
|
75
|
+
$scope.niceDateInputForm.$setValidity('validDate', false);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// -------------------- Time --------------------
|
|
80
|
+
$scope.timeBlur = function () {
|
|
81
|
+
var newTime = moment($scope.modelTime, $scope.formatTime);
|
|
82
|
+
if (newTime.isValid()) {
|
|
83
|
+
$scope.niceDateInputForm.$setValidity('validDate', true);
|
|
84
|
+
$scope.handleChange();
|
|
85
|
+
} else {
|
|
86
|
+
$scope.niceDateInputForm.$setValidity('validDate', false);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// -------------------- Watch model --------------------
|
|
91
|
+
$scope.$watch('model', function () {
|
|
92
|
+
$scope.formatModel();
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
.nice-date-input {
|
|
2
|
+
.nice-field {
|
|
3
|
+
display: flex;
|
|
4
|
+
gap: 1rem;
|
|
5
|
+
|
|
6
|
+
.input-group {
|
|
7
|
+
display: flex;
|
|
8
|
+
|
|
9
|
+
.form-control {
|
|
10
|
+
border-right: 0 none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.input-group-addon {
|
|
14
|
+
flex-shrink: 0;
|
|
15
|
+
width: 34px;
|
|
16
|
+
|
|
17
|
+
&:focus {
|
|
18
|
+
outline: 0 none;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.form-control {
|
|
23
|
+
z-index: unset;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.nice-date-input {
|
|
27
|
+
flex-grow: 1;
|
|
28
|
+
|
|
29
|
+
.nice-popup-content {
|
|
30
|
+
.nice-date-date {
|
|
31
|
+
width: 250px;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&.nice-time-input {
|
|
37
|
+
width: 100px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.nice-popup-content {
|
|
41
|
+
z-index: 10;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.nice-date {
|
|
45
|
+
width: 250px;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
<div class="nice-field col-xs-12" ng-class="fieldWidth ? fieldWidth : 'col-sm-8'">
|
|
11
11
|
<div class="input-group">
|
|
12
12
|
<input date-range-picker class="form-control date-picker" type="text" options="opts" ng-model="model" />
|
|
13
|
-
<span date-range-picker options="opts" ng-model="model" class="input-group-addon"
|
|
13
|
+
<span date-range-picker options="opts" ng-model="model" class="input-group-addon">
|
|
14
|
+
<nice-icon icon="icon-calendar"></nice-icon>
|
|
15
|
+
</span>
|
|
14
16
|
</div>
|
|
15
17
|
</div>
|
|
16
18
|
</div>
|
|
@@ -16,30 +16,16 @@
|
|
|
16
16
|
<div class="input-group" id="dropdown{{randNum}}">
|
|
17
17
|
<input type="text" class="form-control" value="{{ value }}" ng-click="openDtp()" ng-disabled="isDisabled">
|
|
18
18
|
<span class="input-group-addon clickable" ng-click="openDtp()">
|
|
19
|
-
<i class="fa" ng-class="date == 'true' ? 'fa-calendar' : 'fa-clock-o'"></i>
|
|
19
|
+
<!-- <i class="fa" ng-class="date == 'true' ? 'fa-calendar' : 'fa-clock-o'"></i> -->
|
|
20
|
+
<nice-icon ng-if="date == 'true'" icon="icon-calendar"></nice-icon>
|
|
21
|
+
<nice-icon ng-if="date != 'true'" icon="icon-clock"></nice-icon>
|
|
20
22
|
</span>
|
|
21
23
|
</div>
|
|
22
24
|
|
|
23
25
|
<!-- inject nice-dtp here -->
|
|
24
26
|
<div ng-show="isOpen">
|
|
25
|
-
<nice-dtp
|
|
26
|
-
model="internalDate"
|
|
27
|
-
format="{{ format }}"
|
|
28
|
-
model-format="{{ modelFormat }}"
|
|
29
|
-
date="{{ date == 'true' }}"
|
|
30
|
-
time="{{ time == 'true' }}"
|
|
31
|
-
width="{{ width }}"
|
|
32
|
-
enable-ok-buttons="{{ enableOkButtons }}"
|
|
33
|
-
lang="{{ lang }}"
|
|
34
|
-
min-date="{{ minDate }}"
|
|
35
|
-
max-date="{{ maxDate }}"
|
|
36
|
-
week-start="{{ weekStart }}"
|
|
37
|
-
ok-text="{{ okText }}"
|
|
38
|
-
cancel-text="{{ cancelText }}"
|
|
39
|
-
closed="closeDtp"
|
|
40
|
-
></nice-dtp>
|
|
27
|
+
<nice-dtp model="internalDate" format="{{ format }}" model-format="{{ modelFormat }}" date="{{ date == 'true' }}" time="{{ time == 'true' }}" width="{{ width }}" enable-ok-buttons="{{ enableOkButtons }}" lang="{{ lang }}" min-date="{{ minDate }}" max-date="{{ maxDate }}" week-start="{{ weekStart }}" ok-text="{{ okText }}" cancel-text="{{ cancelText }}" closed="closeDtp"></nice-dtp>
|
|
41
28
|
</div>
|
|
42
29
|
</div>
|
|
43
30
|
</div>
|
|
44
|
-
</div>
|
|
45
|
-
|
|
31
|
+
</div>
|
|
@@ -17,7 +17,12 @@
|
|
|
17
17
|
<div class="dropdown-toggle" id="dropdown{{randNum}}" role="button" ng-click="openDtpRange()">
|
|
18
18
|
<div class="input-group">
|
|
19
19
|
<input type="text" class="form-control" value="{{value}}" ng-click="openDtpRange()">
|
|
20
|
-
<span class="input-group-addon clickable"
|
|
20
|
+
<span class="input-group-addon clickable">
|
|
21
|
+
<!-- <i class="fa" ng-class="{'fa-clock-o': date=='false', 'fa-calendar': date!='false'}"></i> -->
|
|
22
|
+
<nice-icon ng-if="date != 'false'" icon="icon-calendar"></nice-icon>
|
|
23
|
+
<nice-icon ng-if="date == 'false'" icon="icon-clock"></nice-icon>
|
|
24
|
+
</span>
|
|
25
|
+
|
|
21
26
|
</div>
|
|
22
27
|
</div>
|
|
23
28
|
</div>
|
|
@@ -13,7 +13,9 @@
|
|
|
13
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
|
-
<span class="input-group-addon clickable"
|
|
16
|
+
<span class="input-group-addon clickable">
|
|
17
|
+
<nice-icon icon="icon-calendar"></nice-icon>
|
|
18
|
+
</span>
|
|
17
19
|
</div>
|
|
18
20
|
|
|
19
21
|
<div class="nice-daterange-picker-wrapper">
|
|
@@ -33,11 +35,11 @@
|
|
|
33
35
|
</div>
|
|
34
36
|
|
|
35
37
|
<div class="dtp-left">
|
|
36
|
-
<nice-date model="model.innerStartDate" next-date="model.innerEndDate" is-inline="true" no-margin="true" inline="true" time="
|
|
38
|
+
<nice-date model="model.innerStartDate" next-date="model.innerEndDate" is-inline="true" no-margin="true" inline="true" time="time" on-change="dateChanged(model)"></nice-date>
|
|
37
39
|
</div>
|
|
38
40
|
|
|
39
41
|
<div class="dtp-right">
|
|
40
|
-
<nice-date model="model.innerEndDate" next-date="model.innerStartDate" is-inline="true" no-margin="true" inline="true" time="
|
|
42
|
+
<nice-date model="model.innerEndDate" next-date="model.innerStartDate" is-inline="true" no-margin="true" inline="true" time="time" on-change="dateChanged(model)"></nice-date>
|
|
41
43
|
</div>
|
|
42
44
|
</div>
|
|
43
45
|
</div>
|