nice-elements 1.10.14 → 1.10.16

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 (48) hide show
  1. package/.vscode/settings.json +0 -1
  2. package/CHANGELOG.md +16 -0
  3. package/README.md +1 -1
  4. package/bower.json +1 -1
  5. package/dist/nice.js +371 -302
  6. package/dist/nice.min.js +1 -1
  7. package/dist/style.css +65 -10
  8. package/dist/style.css.map +2 -1
  9. package/dist/style.min.css +2 -2
  10. package/eslint.config.mjs +6 -2
  11. package/package.json +4 -4
  12. package/src/components/nice-calendar/nice-calendar.js +16 -16
  13. package/src/components/nice-choice/nice-choice.js +6 -6
  14. package/src/components/nice-click-outside/nice-click-outside.js +7 -7
  15. package/src/components/nice-comment/nice-comment.js +2 -2
  16. package/src/components/nice-date/nice-date.js +6 -4
  17. package/src/components/nice-date-input/nice-date-input.js +3 -3
  18. package/src/components/nice-date-range/nice-date-range.js +2 -2
  19. package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.js +21 -21
  20. package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.js +8 -7
  21. package/src/components/nice-dropdown/nice-dropdown.js +29 -22
  22. package/src/components/nice-dropdown/nice-dropdown.scss +1 -1
  23. package/src/components/nice-dropdown-date/nice-dropdown-date.js +9 -5
  24. package/src/components/nice-dropdown-date/nice-dropdown-date.scss +5 -1
  25. package/src/components/nice-dropdown-old/nice-dropdown-old.js +26 -27
  26. package/src/components/nice-dtp/nice-dtp.js +85 -85
  27. package/src/components/nice-help/nice-help.js +7 -4
  28. package/src/components/nice-input/nice-input.js +8 -8
  29. package/src/components/nice-no-data/nice-no-data.scss +4 -9
  30. package/src/components/nice-notification/nice-notification.js +42 -42
  31. package/src/components/nice-number/nice-number.js +3 -3
  32. package/src/components/nice-percent/nice-percent.js +1 -1
  33. package/src/components/nice-popup/nice-popup.js +2 -2
  34. package/src/components/nice-search/nice-search.js +12 -9
  35. package/src/components/nice-search2/nice-search2.js +15 -13
  36. package/src/components/nice-table/nice-table.scss +3 -3
  37. package/src/components/nice-time-picker/nice-time-picker.js +1 -1
  38. package/src/components/nice-toast/nice-toast.js +2 -2
  39. package/src/components/nice-upload/nice-upload.js +4 -4
  40. package/src/components/nice-view/_nice-view.scss +62 -0
  41. package/src/components/nice-view/nice-view.html +13 -0
  42. package/src/components/nice-view/nice-view.js +30 -0
  43. package/src/components/nice-wrapper/nice-wrapper.js +1 -1
  44. package/src/filters/nice-date.js +1 -1
  45. package/src/filters/nice-highlight.js +2 -2
  46. package/src/services/nice-service.js +2 -2
  47. package/src/styles/_nice.scss +2 -1
  48. package/src/styles/_variables.scss +2 -1
@@ -28,7 +28,7 @@ angular.module('niceElements')
28
28
  onChange: '&?',
29
29
  required: '='
30
30
  },
31
- link: function ($scope) {
31
+ controller: function ($scope, $timeout) {
32
32
  $scope.days = [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];
33
33
  $scope.months = [
34
34
  { value: 0, name: gettextCatalog.getString('Jan', null, 'Nice') },
@@ -59,7 +59,7 @@ angular.module('niceElements')
59
59
 
60
60
  // Create years array
61
61
  $scope.years = [];
62
- for (var i = currentYear; i >= oldestYear; i--) {
62
+ for (let i = currentYear; i >= oldestYear; i--) {
63
63
  if (i <= newestYear) {
64
64
  $scope.years.push(i);
65
65
  }
@@ -73,7 +73,7 @@ angular.module('niceElements')
73
73
  // Watch for model change
74
74
  $scope.$watch('model', function (newDate, oldDate) {
75
75
  if (newDate && newDate != oldDate) {
76
- var date = moment(newDate);
76
+ const date = moment(newDate);
77
77
  $scope.dateFields.day = date.get('date');
78
78
  $scope.dateFields.month = date.get('month');
79
79
  $scope.dateFields.year = date.get('year');
@@ -89,11 +89,15 @@ angular.module('niceElements')
89
89
  if (date.isValid()) {
90
90
  // Format
91
91
  $scope.model = date.format();
92
- if ($scope.onChange) $scope.onChange({ model: $scope.model });
92
+ if ($scope.onChange) {
93
+ $timeout(function () {
94
+ $scope.onChange({ model: $scope.model });
95
+ })
96
+ }
93
97
 
94
98
  // Change dates
95
99
  $scope.days = [];
96
- for (i = 1; i <= date.daysInMonth(); i++) {
100
+ for (let i = 1; i <= date.daysInMonth(); i++) {
97
101
  $scope.days.push(i);
98
102
  }
99
103
 
@@ -55,6 +55,10 @@
55
55
  z-index: 2;
56
56
  background: transparent;
57
57
 
58
+ // option {
59
+ // background: var(--nice-primary-color);
60
+ // }
61
+
58
62
  &:disabled {
59
63
  cursor: not-allowed;
60
64
  background: $nice-dropdown-disabled-bg !important;
@@ -80,4 +84,4 @@
80
84
  @extend .nice-focus;
81
85
  }
82
86
  }
83
- }
87
+ }
@@ -65,9 +65,9 @@ angular.module('niceElements')
65
65
 
66
66
 
67
67
  // ----------------------------------- Get filter -----------------------------------
68
- var getFilter = function (item) {
68
+ const getFilter = function (item) {
69
69
  // Create filter for finding object by objValue with _.where()
70
- var filter = {};
70
+ const filter = {};
71
71
  if (item.hasOwnProperty($scope.objKey))
72
72
  filter[$scope.objKey] = item[$scope.objKey];
73
73
  else
@@ -77,15 +77,15 @@ angular.module('niceElements')
77
77
 
78
78
 
79
79
  // ----------------------------------- Set internal list -----------------------------------
80
- var _set_internal_list = function () {
80
+ const _set_internal_list = function () {
81
81
  $scope.internalList = angular.copy($scope.list);
82
82
  };
83
83
 
84
84
 
85
85
  // ----------------------------------- Add null object to internal list -----------------------------------
86
- var _add_null_object_to_internal = function () {
86
+ const _add_null_object_to_internal = function () {
87
87
  if ($scope.nullable && !$scope.multiple) {
88
- var nullObj = {};
88
+ const nullObj = {};
89
89
  nullObj[$scope.objKey] = null;
90
90
  nullObj[$scope.objValue] = '-';
91
91
  $scope.internalList = [nullObj].concat($scope.internalList);
@@ -94,7 +94,7 @@ angular.module('niceElements')
94
94
 
95
95
 
96
96
  // ----------------------------------- Get selected object -----------------------------------
97
- var _get_selected_object = function (selected) {
97
+ const _get_selected_object = function (selected) {
98
98
  if (!selected) return null;
99
99
  if ($scope.selectedIsObj) {
100
100
  return selected;
@@ -105,10 +105,10 @@ angular.module('niceElements')
105
105
 
106
106
 
107
107
  // ----------------------------------- Init -----------------------------------
108
- var _set_internal_selected_one = function (selected) {
109
- var obj = {};
108
+ const _set_internal_selected_one = function (selected) {
109
+ let obj = {};
110
110
 
111
- var selectedObj = _get_selected_object(selected);
111
+ const selectedObj = _get_selected_object(selected);
112
112
  // console.log('_set_internal_selected_one', selected, selectedObj);
113
113
  if (selectedObj && _.find($scope.internalList, getFilter(selected))) {
114
114
  obj = selectedObj;
@@ -121,13 +121,12 @@ angular.module('niceElements')
121
121
 
122
122
 
123
123
  // ----------------------------------- Get selected objects -----------------------------------
124
- var _get_selected_objects = function (selected) {
125
- if (!selected)
126
- return null;
124
+ const _get_selected_objects = function (selected) {
125
+ if (!selected) return null;
127
126
 
128
- if ($scope.selectedIsObj)
127
+ if ($scope.selectedIsObj) {
129
128
  return selected;
130
- else {
129
+ } else {
131
130
  // from [1,2,3] get list of objects [{}, {}, {}]
132
131
  return _.map(selected, function (val) {
133
132
  return _.find($scope.internalList, getFilter(val));
@@ -137,8 +136,8 @@ angular.module('niceElements')
137
136
 
138
137
 
139
138
  // ----------------------------------- Set internal selected multiple -----------------------------------
140
- var _set_internal_selected_multiple = function (item) {
141
- var _selected_objects = _get_selected_objects(item);
139
+ const _set_internal_selected_multiple = function (item) {
140
+ const _selected_objects = _get_selected_objects(item);
142
141
  if (_selected_objects) {
143
142
  $scope.internalSelected = _selected_objects;
144
143
  _set_model($scope.internalSelected);
@@ -150,8 +149,8 @@ angular.module('niceElements')
150
149
 
151
150
 
152
151
  // ----------------------------------- Set model -----------------------------------
153
- var _set_model = function (value) {
154
- var _new = angular.copy($scope.model);
152
+ const _set_model = function (value) {
153
+ let _new = angular.copy($scope.model);
155
154
 
156
155
  if (!$scope.multiple) {
157
156
  if (value[$scope.objKey] == null) {
@@ -182,7 +181,7 @@ angular.module('niceElements')
182
181
 
183
182
 
184
183
  // ----------------------------------- Init -----------------------------------
185
- var init = function () {
184
+ const init = function () {
186
185
  _set_internal_list();
187
186
  _add_null_object_to_internal();
188
187
 
@@ -213,7 +212,7 @@ angular.module('niceElements')
213
212
  } else {
214
213
  // Disable dropdown button if list of items is empty
215
214
  $scope.emptyList = true;
216
- var sel = {};
215
+ const sel = {};
217
216
  sel[$scope.objKey] = null;
218
217
  sel[$scope.objValue] = $scope.noOptionsText;
219
218
  $scope.internalList = [sel];
@@ -249,7 +248,7 @@ angular.module('niceElements')
249
248
  $scope.formDropdown.$setDirty();
250
249
  if ($scope.multiple) {
251
250
  // This actually toggles selection
252
- var _current = angular.copy($scope.internalSelected);
251
+ let _current = angular.copy($scope.internalSelected);
253
252
  if (!_.find(_current, getFilter(item))) {
254
253
  _current.push(item);
255
254
  } else {
@@ -282,10 +281,11 @@ angular.module('niceElements')
282
281
 
283
282
  // ----------------------------------- Watch for model change -----------------------------------
284
283
  $scope.$watch('model', function (value_new, value_old) {
284
+ let _new_model_object = null;
285
285
  if ($scope.multiple) {
286
- var _new_model_object = _get_selected_object(value_new);
286
+ _new_model_object = _get_selected_object(value_new);
287
287
  } else {
288
- var _new_model_object = _get_selected_objects(value_new);
288
+ _new_model_object = _get_selected_objects(value_new);
289
289
  }
290
290
 
291
291
  if (!_.isEqual(_new_model_object, $scope.internalSelected)) {
@@ -300,11 +300,11 @@ angular.module('niceElements')
300
300
  $element.bind('keyup', function (e) {
301
301
  // bind to keypress events if dropdown list is opened
302
302
  if ($scope.isOpen) {
303
- var char = String.fromCharCode(e.which).toLowerCase();
303
+ const char = String.fromCharCode(e.which).toLowerCase();
304
304
 
305
305
  // find first element with value starting on selected char
306
- var index = _.findIndex($scope.internalList, function (item) {
307
- var _name = item[$scope.objValue].toLowerCase();
306
+ const index = _.findIndex($scope.internalList, function (item) {
307
+ const _name = item[$scope.objValue].toLowerCase();
308
308
  return _name.indexOf(char) === 0;
309
309
  });
310
310
 
@@ -325,7 +325,6 @@ angular.module('niceElements')
325
325
  $scope.unbindKeypress = function () {
326
326
  $element.off('keyup', function (e) { });
327
327
  };
328
-
329
328
  }
330
329
  };
331
330
  });
@@ -41,7 +41,7 @@ angular.module('niceElements')
41
41
  console.warn("[NICE ELEMENTS] nice-dtp component is deprecated!");
42
42
 
43
43
  // default parameters
44
- var params = {
44
+ const params = {
45
45
  title: '',
46
46
  noMargin: false,
47
47
  fieldWidth: 'col-sm-8',
@@ -61,7 +61,7 @@ angular.module('niceElements')
61
61
  enableOkButtons: false
62
62
  };
63
63
 
64
- var prepareAttrs = function () {
64
+ const prepareAttrs = function () {
65
65
  // prepare attributes
66
66
  params.date = $attrs.date === 'true' || $attrs.date === true;
67
67
  params.time = $attrs.time === 'true' || $attrs.time === true;
@@ -100,8 +100,8 @@ angular.module('niceElements')
100
100
  $scope.date = $attrs.date === 'true' || $attrs.date === true;
101
101
  $scope.time = $attrs.time === 'true' || $attrs.time === true;
102
102
 
103
- // functions are defined in a variable 'var that', not in $scope
104
- var that = {
103
+ // functions are defined in a variable 'const that', not in $scope
104
+ const that = {
105
105
  init: function () {
106
106
  //console.log('init', $scope);
107
107
 
@@ -112,7 +112,7 @@ angular.module('niceElements')
112
112
  initDays: function () {
113
113
  //console.log('initDays');
114
114
  $scope.days = [];
115
- for (var i = params.weekStart; $scope.days.length < 7; i++) {
115
+ for (let i = params.weekStart; $scope.days.length < 7; i++) {
116
116
  if (i > 6) {
117
117
  i = 0;
118
118
  }
@@ -174,7 +174,7 @@ angular.module('niceElements')
174
174
  $scope.showCalendar = true;
175
175
  $scope.showTime = false;
176
176
 
177
- var _date = ((typeof ($scope.currentDate) !== 'undefined' && $scope.currentDate !== null) ? $scope.currentDate : null);
177
+ const _date = ((typeof ($scope.currentDate) !== 'undefined' && $scope.currentDate !== null) ? $scope.currentDate : null);
178
178
  $scope.calendar = that.generateCalendar($scope.currentDate);
179
179
 
180
180
  if (typeof ($scope.calendar.week) !== 'undefined' && typeof ($scope.calendar.days) !== 'undefined') {
@@ -195,24 +195,24 @@ angular.module('niceElements')
195
195
 
196
196
  that.showTime($scope.currentDate);
197
197
 
198
- var pL = 10;
199
- var pT = 10;
200
- var mL = 20;
201
- var mT = 10;
202
- var r = 100;
198
+ const pL = 10;
199
+ const pT = 10;
200
+ const mL = 20;
201
+ const mT = 10;
202
+ const r = 100;
203
203
 
204
- var j = r / 1.55;
205
- var j_pm = r / 1.15;
204
+ const j = r / 1.55;
205
+ const j_pm = r / 1.15;
206
206
 
207
- var _hours = [];
207
+ const _hours = [];
208
208
 
209
209
  // AM hours
210
- for (var h = 0; h < 12; ++h) {
211
- var cH = (($scope.currentDate.format('HH') == 24) ? 0 : $scope.currentDate.format('HH'));
212
- var x = j * Math.sin(Math.PI * 2 * (h / 12));
213
- var y = j * Math.cos(Math.PI * 2 * (h / 12));
210
+ for (let h = 0; h < 12; ++h) {
211
+ const cH = (($scope.currentDate.format('HH') == 24) ? 0 : $scope.currentDate.format('HH'));
212
+ const x = j * Math.sin(Math.PI * 2 * (h / 12));
213
+ const y = j * Math.cos(Math.PI * 2 * (h / 12));
214
214
 
215
- var _hour = {
215
+ const _hour = {
216
216
  style: {
217
217
  x: x,
218
218
  y: y,
@@ -227,12 +227,12 @@ angular.module('niceElements')
227
227
  }
228
228
 
229
229
  // PM hours
230
- for (var h = 0; h < 12; ++h) {
231
- var cH = (($scope.currentDate.format('HH') == 24) ? 0 : $scope.currentDate.format('HH'));
232
- var x = j_pm * Math.sin(Math.PI * 2 * (h / 12));
233
- var y = j_pm * Math.cos(Math.PI * 2 * (h / 12));
230
+ for (let h = 0; h < 12; ++h) {
231
+ const cH = (($scope.currentDate.format('HH') == 24) ? 0 : $scope.currentDate.format('HH'));
232
+ const x = j_pm * Math.sin(Math.PI * 2 * (h / 12));
233
+ const y = j_pm * Math.cos(Math.PI * 2 * (h / 12));
234
234
 
235
- var _hour = {
235
+ const _hour = {
236
236
  style: {
237
237
  x: x,
238
238
  y: y,
@@ -260,20 +260,20 @@ angular.module('niceElements')
260
260
 
261
261
  that.showTime($scope.currentDate);
262
262
 
263
- var pL = 10;
264
- var pT = 10;
265
- var mL = 20;
266
- var mT = 10;
267
- var w = 200;
268
- var r = w / 2;
269
- var j = r / 1.2;
270
- var _minutes = [];
263
+ const pL = 10;
264
+ const pT = 10;
265
+ const mL = 20;
266
+ const mT = 10;
267
+ const w = 200;
268
+ const r = w / 2;
269
+ const j = r / 1.2;
270
+ const _minutes = [];
271
271
 
272
- for (var m = 0; m < 60; m += 5) {
273
- var x = j * Math.sin(Math.PI * 2 * (m / 60));
274
- var y = j * Math.cos(Math.PI * 2 * (m / 60));
272
+ for (let m = 0; m < 60; m += 5) {
273
+ const x = j * Math.sin(Math.PI * 2 * (m / 60));
274
+ const y = j * Math.cos(Math.PI * 2 * (m / 60));
275
275
 
276
- var _minute = {
276
+ const _minute = {
277
277
  style: {
278
278
  x: x,
279
279
  y: y,
@@ -292,27 +292,27 @@ angular.module('niceElements')
292
292
  that._centerBox();
293
293
  },
294
294
  initHands: function (t) {
295
- var pL = 10;
296
- var mL = 20;
297
- var w = 7.5;
298
- var h = 7.5;
299
- var r = 100;
300
- var _hL = r / 1.7;
301
- var _mL = r / 1.5;
302
-
303
- var dtpHourHand = $element[0].getElementsByClassName('dtp-hour-hand')[0];
295
+ const pL = 10;
296
+ const mL = 20;
297
+ const w = 7.5;
298
+ const h = 7.5;
299
+ const r = 100;
300
+ const _hL = r / 1.7;
301
+ const _mL = r / 1.5;
302
+
303
+ const dtpHourHand = $element[0].getElementsByClassName('dtp-hour-hand')[0];
304
304
  dtpHourHand.style.left = r + (parseInt(mL) * 1.5) + 'px';
305
305
  dtpHourHand.style.height = _hL + 'px';
306
306
  dtpHourHand.style.marginTop = (r - _hL - parseInt(pL)) + 'px';
307
307
  if (t) dtpHourHand.classList.add("on");
308
308
 
309
- var dtpMinuteHand = $element[0].getElementsByClassName('dtp-minute-hand')[0];
309
+ const dtpMinuteHand = $element[0].getElementsByClassName('dtp-minute-hand')[0];
310
310
  dtpMinuteHand.style.left = r + (parseInt(mL) * 1.5) + 'px';
311
311
  dtpMinuteHand.style.height = _mL + 'px';
312
312
  dtpMinuteHand.style.marginTop = (r - _mL - parseInt(pL)) + 'px';
313
313
  if (t) dtpMinuteHand.classList.add("on");
314
314
 
315
- var dtpClockCenter = $element[0].getElementsByClassName('dtp-clock-center')[0];
315
+ const dtpClockCenter = $element[0].getElementsByClassName('dtp-clock-center')[0];
316
316
  dtpClockCenter.style.left = r + parseInt(pL) + parseInt(mL) - w + 'px';
317
317
  dtpClockCenter.style.marginTop = (r - (parseInt(mL) / 2)) - h + 'px';
318
318
 
@@ -321,20 +321,20 @@ angular.module('niceElements')
321
321
  that._centerBox();
322
322
  },
323
323
  animateHands: function () {
324
- var h = $scope.currentDate.hour();
325
- var m = $scope.currentDate.minute();
324
+ const h = $scope.currentDate.hour();
325
+ const m = $scope.currentDate.minute();
326
326
 
327
- var dtpHourHand = $element[0].getElementsByClassName('dtp-hour-hand')[0];
328
- var dtpMinuteHand = $element[0].getElementsByClassName('dtp-minute-hand')[0];
327
+ const dtpHourHand = $element[0].getElementsByClassName('dtp-hour-hand')[0];
328
+ const dtpMinuteHand = $element[0].getElementsByClassName('dtp-minute-hand')[0];
329
329
  that.rotateElement(dtpHourHand, (360 / 12) * h);
330
330
  that.rotateElement(dtpMinuteHand, ((360 / 60) * (5 * Math.round(m / 5))));
331
331
  },
332
332
  isAfterMinDate: function (date, checkHour, checkMinute) {
333
- var _return = true;
333
+ let _return = true;
334
334
 
335
335
  if (typeof ($scope.minDate) !== 'undefined' && $scope.minDate !== null) {
336
- var _minDate = moment($scope.minDate);
337
- var _date = moment(date);
336
+ const _minDate = moment($scope.minDate);
337
+ const _date = moment(date);
338
338
 
339
339
  if (!checkHour && !checkMinute) {
340
340
  _minDate.hour(0);
@@ -362,11 +362,11 @@ angular.module('niceElements')
362
362
  return _return;
363
363
  },
364
364
  isBeforeMaxDate: function (date, checkTime, checkMinute) {
365
- var _return = true;
365
+ let _return = true;
366
366
 
367
367
  if (typeof ($scope.maxDate) !== 'undefined' && $scope.maxDate !== null) {
368
- var _maxDate = moment($scope.maxDate);
369
- var _date = moment(date);
368
+ const _maxDate = moment($scope.maxDate);
369
+ const _date = moment(date);
370
370
 
371
371
  if (!checkTime && !checkMinute) {
372
372
  _maxDate.hour(0);
@@ -410,8 +410,8 @@ angular.module('niceElements')
410
410
  showTime: function (date) {
411
411
  //console.log('showTime', date);
412
412
  if (date) {
413
- var _minutes = (5 * Math.round(date.minute() / 5));
414
- var _time = {
413
+ const _minutes = (5 * Math.round(date.minute() / 5));
414
+ const _time = {
415
415
  hours: date.format('HH'),
416
416
  minutes: ((_minutes.toString().length == 2) ? _minutes : '0' + _minutes)
417
417
  };
@@ -442,22 +442,22 @@ angular.module('niceElements')
442
442
  },
443
443
  generateCalendar: function (date) {
444
444
  //console.log('generateCalendar');
445
- var _calendar = {};
445
+ const _calendar = {};
446
446
 
447
447
  if (date !== null) {
448
- var startOfMonth = moment(date).locale(params.lang).startOf('month');
449
- var endOfMonth = moment(date).locale(params.lang).endOf('month');
448
+ const startOfMonth = moment(date).locale(params.lang).startOf('month');
449
+ const endOfMonth = moment(date).locale(params.lang).endOf('month');
450
450
 
451
- var iNumDay = startOfMonth.format('d');
451
+ const iNumDay = startOfMonth.format('d');
452
452
 
453
453
  _calendar.week = $scope.days;
454
454
  _calendar.days = [];
455
455
 
456
- for (var i = startOfMonth.date(); i <= endOfMonth.date(); i++) {
456
+ for (let i = startOfMonth.date(); i <= endOfMonth.date(); i++) {
457
457
  if (i === startOfMonth.date()) {
458
- var iWeek = _calendar.week.indexOf(iNumDay.toString());
458
+ const iWeek = _calendar.week.indexOf(iNumDay.toString());
459
459
  if (iWeek > 0) {
460
- for (var x = 0; x < iWeek; x++) {
460
+ for (let x = 0; x < iWeek; x++) {
461
461
  _calendar.days.push(0);
462
462
  }
463
463
  }
@@ -471,24 +471,24 @@ angular.module('niceElements')
471
471
  constructHTMLCalendar: function (date, calendar) {
472
472
  $scope.monthAndYear = date.locale(params.lang).format('MMMM YYYY');
473
473
 
474
- var _weekDays = [];
475
- for (var i = 0; i < calendar.week.length; i++) {
474
+ const _weekDays = [];
475
+ for (let i = 0; i < calendar.week.length; i++) {
476
476
  _weekDays.push(moment(parseInt(calendar.week[i]), "d").locale(params.lang).format("dd").substring(0, 1));
477
477
  }
478
478
  $scope.weekDays = _weekDays;
479
479
 
480
- var _weeks = [];
480
+ const _weeks = [];
481
481
 
482
- var _week = [];
483
- for (var i = 0; i < calendar.days.length; i++) {
482
+ let _week = [];
483
+ for (let i = 0; i < calendar.days.length; i++) {
484
484
  if (i % 7 == 0) {
485
485
  if (i != 0) {
486
486
  _weeks.push(_week);
487
487
  }
488
- var _week = [];
488
+ _week = [];
489
489
  }
490
490
 
491
- var _day = {
491
+ const _day = {
492
492
  label: null,
493
493
  selected: false,
494
494
  disabled: true,
@@ -520,10 +520,10 @@ angular.module('niceElements')
520
520
  //console.log('$scope.weekDays', $scope.weekDays);
521
521
  },
522
522
  setName: function () {
523
- var text = "";
524
- var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
523
+ let text = "";
524
+ const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
525
525
 
526
- for (var i = 0; i < 5; i++) {
526
+ for (let i = 0; i < 5; i++) {
527
527
  text += possible.charAt(Math.floor(Math.random() * possible.length));
528
528
  }
529
529
 
@@ -548,14 +548,14 @@ angular.module('niceElements')
548
548
  },
549
549
  toggleButtons: function (date) {
550
550
  if (date && date.isValid()) {
551
- var startOfMonth = moment(date).locale(params.lang).startOf('month');
552
- var endOfMonth = moment(date).locale(params.lang).endOf('month');
551
+ const startOfMonth = moment(date).locale(params.lang).startOf('month');
552
+ const endOfMonth = moment(date).locale(params.lang).endOf('month');
553
553
 
554
554
  $scope.btnMonthBeforeEnabled = that.isAfterMinDate(startOfMonth, false, false);
555
555
  $scope.btnMonthAfterEnabled = that.isBeforeMaxDate(endOfMonth, false, false);
556
556
 
557
- var startOfYear = moment(date).locale(params.lang).startOf('year');
558
- var endOfYear = moment(date).locale(params.lang).endOf('year');
557
+ const startOfYear = moment(date).locale(params.lang).startOf('year');
558
+ const endOfYear = moment(date).locale(params.lang).endOf('year');
559
559
 
560
560
  $scope.btnYearBeforeEnabled = that.isAfterMinDate(startOfYear, false, false);
561
561
  $scope.btnYearAfterEnabled = that.isBeforeMaxDate(endOfYear, false, false);
@@ -564,7 +564,7 @@ angular.module('niceElements')
564
564
  toggleTime: function (isHours) {
565
565
  if (isHours) {
566
566
  angular.forEach($scope.hours, function (hour, hourKey) {
567
- var _date = moment($scope.currentDate);
567
+ const _date = moment($scope.currentDate);
568
568
  _date.hour(that.convertHours(hour.h)).minute(0).second(0);
569
569
 
570
570
  if (that.isAfterMinDate(_date, true, false) === false || that.isBeforeMaxDate(_date, true, false) === false) {
@@ -575,8 +575,8 @@ angular.module('niceElements')
575
575
  });
576
576
  } else {
577
577
  angular.forEach($scope.minutes, function (minute, minuteKey) {
578
- var _minute = minute.m;
579
- var _date = moment($scope.currentDate);
578
+ const _minute = minute.m;
579
+ const _date = moment($scope.currentDate);
580
580
  _date.minute(_minute).second(0);
581
581
 
582
582
  if (that.isAfterMinDate(_date, true, true) === false || that.isBeforeMaxDate(_date, true, true) === false) {
@@ -709,7 +709,7 @@ angular.module('niceElements')
709
709
  });
710
710
  hourSelected.selected = true;
711
711
 
712
- var dataHour = parseInt(hourSelected.h);
712
+ let dataHour = parseInt(hourSelected.h);
713
713
  if (that.isPM())
714
714
  dataHour += 12;
715
715
 
@@ -744,7 +744,7 @@ angular.module('niceElements')
744
744
  }
745
745
  },
746
746
  convertHours: function (h) {
747
- var _return = h;
747
+ let _return = h;
748
748
 
749
749
  if ((h < 12) && that.isPM())
750
750
  _return += 12;
@@ -13,17 +13,20 @@ angular.module('niceElements')
13
13
  restrict: 'E',
14
14
  replace: true,
15
15
  scope: {
16
- text: '@'
16
+ text: '@',
17
+ placement: '@', // Describes the preferred placement of the popper
17
18
  },
18
19
  controller: function ($scope, $element, $timeout) {
20
+ if (!$scope.placement) { $scope.placement = "top"; }
21
+
19
22
  // Setup popper
20
23
  // https://popper.js.org/docs/v2/constructors/
21
24
  $scope.setupPopper = function () {
22
- var button = $element[0].getElementsByClassName('nice-help-button')[0];
23
- var tooltip = $element[0].getElementsByClassName('nice-help-popup')[0];
25
+ const button = $element[0].getElementsByClassName('nice-help-button')[0];
26
+ const tooltip = $element[0].getElementsByClassName('nice-help-popup')[0];
24
27
  $scope.popper = Popper.createPopper(button, tooltip, {
25
28
  strategy: 'fixed',
26
- placement: 'top',
29
+ placement: $scope.placement,
27
30
  scroll: true,
28
31
  resize: true,
29
32
  modifiers: [
@@ -123,12 +123,12 @@ angular.module('niceElements')
123
123
  }
124
124
 
125
125
  if (angular.isDefined($scope.regexRaw) && $scope.regexRaw != '') {
126
- $scope.regexexp = regexRaw;
126
+ $scope.regexexp = $scope.regexRaw;
127
127
  }
128
128
 
129
129
  $scope.$watch('model', function (value_new, value_old) {
130
- if ($scope.type == "number" && value_old && value_old[value_old.length-1] == ".") {
131
-
130
+ if ($scope.type == "number" && value_old && value_old[value_old.length - 1] == ".") {
131
+ // IGNORE
132
132
  } else {
133
133
  $scope.internalModel = angular.copy($scope.model);
134
134
  }
@@ -155,9 +155,9 @@ angular.module('niceElements')
155
155
  }
156
156
  });
157
157
 
158
- $scope.handleChange = function() {
158
+ $scope.handleChange = function () {
159
159
  if ($scope.onChange) {
160
- $timeout(function() {
160
+ $timeout(function () {
161
161
  $scope.onChange({ model: $scope.model });
162
162
  })
163
163
  }
@@ -182,8 +182,8 @@ angular.module('niceElements')
182
182
 
183
183
  // Open multilanguage modal
184
184
  $scope.openMultilanguage = function () {
185
- var scope = $rootScope.$new(true);
186
- var dialog = ngDialog.open({
185
+ const scope = $rootScope.$new(true);
186
+ const dialog = ngDialog.open({
187
187
  template: '<nice-multilangual-modal model="model" multilanguage="multilanguage" multilanguage-field="{{ multilanguageField }}" callback="callback" dialog="dialog"></nice-multilangual-modal>',
188
188
  plain: true,
189
189
  scope: scope,
@@ -195,7 +195,7 @@ angular.module('niceElements')
195
195
  scope.multilanguage = angular.copy($scope.multilanguage);
196
196
  scope.multilanguageField = $scope.multilanguageField;
197
197
  scope.callback = function (newFields) {
198
- var filteredFields = {};
198
+ const filteredFields = {};
199
199
  angular.forEach(newFields, function (value, key) {
200
200
  if (value != '') filteredFields[key] = value;
201
201
  })