nice-elements 1.6.2 → 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.
Files changed (47) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +1 -1
  3. package/bower.json +1 -1
  4. package/dist/nice.js +182 -167
  5. package/dist/nice.min.js +1 -1
  6. package/dist/style.css +239 -85
  7. package/dist/style.css.map +3 -2
  8. package/dist/style.min.css +2 -2
  9. package/package.json +1 -1
  10. package/src/components/nice-calendar/nice-calendar.html +3 -2
  11. package/src/components/nice-calendar/nice-calendar.scss +9 -5
  12. package/src/components/nice-checkbox/nice-checkbox.html +1 -3
  13. package/src/components/nice-checkbox/nice-checkbox.scss +12 -12
  14. package/src/components/nice-choice/nice-choice.html +3 -1
  15. package/src/components/nice-choice/nice-choice.scss +14 -3
  16. package/src/components/nice-date/nice-date.html +5 -4
  17. package/src/components/nice-date/nice-date.js +50 -52
  18. package/src/components/nice-date/nice-date.scss +29 -6
  19. package/src/components/nice-date-input/nice-date-input.html +3 -6
  20. package/src/components/nice-date-input/nice-date-input.js +2 -2
  21. package/src/components/nice-date-range/nice-date-range.html +3 -1
  22. package/src/components/nice-datetime-picker/nice-datetime-picker.html +5 -19
  23. package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.html +6 -1
  24. package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.html +5 -3
  25. package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.js +25 -26
  26. package/src/components/nice-dropdown/nice-dropdown.html +3 -1
  27. package/src/components/nice-dropdown/nice-dropdown.scss +1 -0
  28. package/src/components/nice-dtp/nice-dtp.html +12 -12
  29. package/src/components/nice-help/nice-help.html +2 -1
  30. package/src/components/nice-help/nice-help.scss +7 -0
  31. package/src/components/nice-input/nice-input.html +9 -42
  32. package/src/components/nice-input/nice-input.js +28 -28
  33. package/src/components/nice-input/nice-input.scss +27 -20
  34. package/src/components/nice-number/nice-number.html +6 -2
  35. package/src/components/nice-number/nice-number.scss +15 -3
  36. package/src/components/nice-quantity/nice-quantity.html +6 -2
  37. package/src/components/nice-quantity/nice-quantity.scss +11 -0
  38. package/src/components/nice-search/nice-search.html +9 -20
  39. package/src/components/nice-search2/nice-search2.html +4 -2
  40. package/src/components/nice-time-picker/nice-time-picker.html +21 -27
  41. package/src/components/nice-time-picker/nice-time-picker.scss +11 -32
  42. package/src/components/nice-yesno/nice-yesno.html +2 -2
  43. package/src/components/nice-yesno/nice-yesno.scss +13 -0
  44. package/src/styles/_nice-buttons.scss +22 -9
  45. package/src/styles/_nice-common.scss +57 -13
  46. package/src/styles/_nice.scss +2 -1
  47. 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
- border-top: 0;
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;
@@ -8,7 +8,7 @@
8
8
 
9
9
  <!------------------------- Field ------------------------->
10
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-class="{ 'has-warning': !disabled && niceDateInputForm.$invalid && niceDateInputForm.$dirty }">
11
+ <div class="input-group nice-date-input" ng-if="date" ng-class="{ 'has-warning': !disabled && niceDateInputForm.$invalid && niceDateInputForm.$dirty }">
12
12
  <input type="text" class="form-control" ng-model="modelDate" ng-blur="dateBlur()" ng-disabled="isDisabled">
13
13
  <nice-popup placement="bottom">
14
14
  <nice-popup-target>
@@ -22,7 +22,7 @@
22
22
  </nice-popup-content>
23
23
  </nice-popup>
24
24
  </div>
25
- <div class="input-group nice-time-input" ng-class="{ 'has-warning': !disabled && niceDateInputForm.$invalid && niceDateInputForm.$dirty }">
25
+ <div class="input-group nice-time-input" ng-if="time" ng-class="{ 'has-warning': !disabled && niceDateInputForm.$invalid && niceDateInputForm.$dirty }">
26
26
  <input type="text" class="form-control" ng-model="modelTime" ng-blur="timeBlur()" ng-disabled="isDisabled">
27
27
  <nice-popup placement="bottom">
28
28
  <nice-popup-target>
@@ -32,10 +32,7 @@
32
32
  </nice-popup-target>
33
33
 
34
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
- <div class="dates">
37
- <div class="date"></div>
38
- </div>
35
+ <nice-date is-inline="true" inline="true" time="true" date="false" on-change="timeChanged(model)" model="model"></nice-date>
39
36
  </nice-popup-content>
40
37
  </nice-popup>
41
38
  </div>
@@ -30,8 +30,8 @@ angular.module('niceElements')
30
30
  controller: function ($scope) {
31
31
  $scope.formatDate = "DD.MM.YYYY";
32
32
  $scope.formatTime = "HH:mm";
33
- $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];
34
- $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];
33
+ if ($scope.date === undefined) $scope.date = true;
34
+ if ($scope.time === undefined) $scope.time = true;
35
35
  $scope.model = moment($scope.model) || moment().set({ 'second': 0, 'millisecond': 0 });
36
36
 
37
37
  $scope.dateChanged = function (date) {
@@ -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"><i class="fa fa-calendar"></i></span>
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"><i class="fa" ng-class="{'fa-clock-o': date=='false', 'fa-calendar': date!='false'}"></i></span>
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"><i class="fa fa-calendar"></i></span>
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="{{ time }}" on-change="dateChanged(model)"></nice-date>
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="{{ time }}" on-change="dateChanged(model)"></nice-date>
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>
@@ -7,14 +7,14 @@
7
7
  * # niceDatetimerangePicker2
8
8
  */
9
9
  angular.module('niceElements')
10
- .directive('niceDatetimerangePicker2', function() {
10
+ .directive('niceDatetimerangePicker2', function () {
11
11
  return {
12
12
  scope: {
13
13
  startDate: '=', // binding model
14
14
  endDate: '=', // binding model
15
15
  formatString: '@', // default: 'D.M.YYYY • H:mm', format for input label string
16
16
  modelFormat: '@',
17
- time: '@', // default: false, is time picker enabled?
17
+ time: '=', // default: false, is time picker enabled?
18
18
  minDate: '@', // default: undefined
19
19
  maxDate: '@', // default: undefined
20
20
  title: '@', // default: ''
@@ -36,25 +36,24 @@ angular.module('niceElements')
36
36
 
37
37
 
38
38
  // Set defaults
39
- if(!$scope.time) $scope.time = false;
40
- else $scope.time = $scope.time == "true";
39
+ if ($scope.time == undefined) $scope.time = false;
41
40
 
42
41
 
43
42
  // Set format string
44
- if(!$scope.formatString) {
45
- if($scope.time) $scope.formatString = 'D.M.YYYY • H:mm';
43
+ if (!$scope.formatString) {
44
+ if ($scope.time) $scope.formatString = 'D.M.YYYY • H:mm';
46
45
  else $scope.formatString = 'D.M.YYYY';
47
46
  }
48
47
 
49
48
  // Set start date
50
- if(!$scope.startDate) {
49
+ if (!$scope.startDate) {
51
50
  $scope.startDate = moment();
52
51
  } else {
53
52
  $scope.model.innerStartDate = angular.copy($scope.startDate);
54
53
  }
55
54
 
56
55
  // Set end date
57
- if(!$scope.endDate) {
56
+ if (!$scope.endDate) {
58
57
  $scope.endDate = moment();
59
58
  } else {
60
59
  $scope.model.innerEndDate = angular.copy($scope.endDate);
@@ -63,7 +62,7 @@ angular.module('niceElements')
63
62
 
64
63
  // Setup popper
65
64
  // https://popper.js.org/docs/v2/constructors/
66
- $scope.setupPopper = function() {
65
+ $scope.setupPopper = function () {
67
66
  var button = $element[0].getElementsByClassName('nice-daterange-picker-button')[0];
68
67
  var tooltip = $element[0].getElementsByClassName('nice-daterange-picker-wrapper')[0];
69
68
  $scope.popper = Popper.createPopper(button, tooltip, {
@@ -79,18 +78,18 @@ angular.module('niceElements')
79
78
  ],
80
79
  });
81
80
  };
82
-
81
+
83
82
  $timeout(function () {
84
83
  $scope.setupPopper();
85
84
  });
86
85
 
87
86
 
88
- $scope.format = function(){
87
+ $scope.format = function () {
89
88
  $scope.modelFormat = $scope.startDate.format($scope.formatString) + " - " + $scope.endDate.format($scope.formatString);
90
89
  };
91
90
 
92
91
 
93
- $scope.open = function() {
92
+ $scope.open = function () {
94
93
  if (!$scope.isDisabled) {
95
94
  $scope.isOpen = true;
96
95
  $scope.popper.update();
@@ -98,14 +97,14 @@ angular.module('niceElements')
98
97
  };
99
98
 
100
99
 
101
- $scope.close = function() {
100
+ $scope.close = function () {
102
101
  $scope.model.innerStartDate = angular.copy($scope.startDate);
103
102
  $scope.model.innerEndDate = angular.copy($scope.endDate);
104
103
  $scope.isOpen = false;
105
104
  };
106
105
 
107
106
 
108
- $scope.confirm = function() {
107
+ $scope.confirm = function () {
109
108
  $scope.startDate = angular.copy($scope.model.innerStartDate);
110
109
  $scope.endDate = angular.copy($scope.model.innerEndDate);
111
110
  if ($scope.onChange) $scope.onChange({ startDate: $scope.startDate, endDate: $scope.endDate });
@@ -113,58 +112,58 @@ angular.module('niceElements')
113
112
  };
114
113
 
115
114
 
116
- $scope.selectToday = function(){
115
+ $scope.selectToday = function () {
117
116
  $scope.model.innerStartDate = moment().startOf('day');
118
117
  $scope.model.innerEndDate = moment().endOf('day');
119
118
  };
120
119
 
121
120
 
122
- $scope.selectLastNDays = function(days){
121
+ $scope.selectLastNDays = function (days) {
123
122
  $scope.model.innerStartDate = moment().subtract(days, 'days').startOf('day');
124
123
  $scope.model.innerEndDate = moment().endOf('day');
125
124
  };
126
125
 
127
126
 
128
- $scope.selectLastMonth = function(){
127
+ $scope.selectLastMonth = function () {
129
128
  $scope.model.innerStartDate = moment().subtract(1, 'months').startOf('month').startOf('date');
130
129
  $scope.model.innerEndDate = moment().subtract(1, 'months').endOf('month').endOf('date');
131
130
  };
132
131
 
133
132
 
134
- $scope.selectThisMonth = function(){
133
+ $scope.selectThisMonth = function () {
135
134
  $scope.model.innerStartDate = moment().startOf('month').startOf('date');
136
135
  $scope.model.innerEndDate = moment().endOf('month').endOf('date');
137
136
  };
138
137
 
139
138
 
140
139
  // ------------------ Remove time from date ------------------
141
- $scope._removeTime = function(date) {
140
+ $scope._removeTime = function (date) {
142
141
  return date.hour(0).minute(0).second(0).millisecond(0);
143
142
  };
144
143
 
145
144
 
146
- $scope.dateChanged = function() {
147
- $timeout(function() {
145
+ $scope.dateChanged = function () {
146
+ $timeout(function () {
148
147
  if ($scope.model.innerStartDate && $scope.model.innerEndDate) {
149
148
  // Check if start date is after end date
150
149
  if ($scope.model.innerStartDate.isAfter($scope.model.innerEndDate)) {
151
150
  var temp = angular.copy($scope.model.innerStartDate);
152
- $scope.model.innerStartDate = angular.copy($scope.model.innerEndDate);
153
- $scope.model.innerEndDate = temp;
151
+ $scope.model.innerStartDate = angular.copy($scope.model.innerEndDate);
152
+ $scope.model.innerEndDate = temp;
154
153
  }
155
154
 
156
155
  // Check if end date is before start date
157
156
  if ($scope.model.innerEndDate.isBefore($scope.model.innerStartDate)) {
158
157
  var temp = angular.copy($scope.model.innerStartDate);
159
- $scope.model.innerStartDate = angular.copy($scope.model.innerEndDate);
160
- $scope.model.innerEndDate = temp;
158
+ $scope.model.innerStartDate = angular.copy($scope.model.innerEndDate);
159
+ $scope.model.innerEndDate = temp;
161
160
  }
162
161
  }
163
162
  });
164
163
  }
165
164
 
166
165
 
167
- $scope.$watchGroup(["startDate", "endDate"], function() {
166
+ $scope.$watchGroup(["startDate", "endDate"], function () {
168
167
  $scope.model.innerStartDate = angular.copy($scope.startDate);
169
168
  $scope.model.innerEndDate = angular.copy($scope.endDate);
170
169
  $scope.format();