nice-elements 1.3.15 → 1.4.1

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 (38) hide show
  1. package/CHANGELOG.md +38 -20
  2. package/LICENSE.md +3 -3
  3. package/README.md +3 -3
  4. package/bower.json +1 -1
  5. package/dist/nice.js +181 -188
  6. package/dist/nice.min.js +1 -1
  7. package/dist/style.css +463 -488
  8. package/dist/style.css.map +40 -0
  9. package/dist/style.min.css +2 -2
  10. package/package.json +12 -17
  11. package/src/components/nice-calendar/nice-calendar.html +15 -15
  12. package/src/components/nice-calendar/nice-calendar.js +4 -26
  13. package/src/components/nice-date/nice-date.js +27 -8
  14. package/src/components/nice-date-range/nice-date-range.js +6 -40
  15. package/src/components/nice-datetime-picker/nice-datetime-picker.js +6 -6
  16. package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.html +6 -6
  17. package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.js +7 -7
  18. package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.html +6 -6
  19. package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.js +2 -2
  20. package/src/components/nice-dropdown/nice-dropdown.html +2 -2
  21. package/src/components/nice-dropdown/nice-dropdown.js +43 -12
  22. package/src/components/nice-dropdown/nice-dropdown.scss +4 -0
  23. package/src/components/nice-dropdown-date/nice-dropdown-date.js +14 -14
  24. package/src/components/nice-dropdown-old/nice-dropdown-old.html +2 -2
  25. package/src/components/nice-dropdown-old/nice-dropdown-old.js +2 -2
  26. package/src/components/nice-dtp/nice-dtp.js +5 -5
  27. package/src/components/nice-help/nice-help.js +0 -6
  28. package/src/components/nice-input/nice-input.html +6 -6
  29. package/src/components/nice-loader/nice-loader.html +3 -1
  30. package/src/components/nice-loader/nice-loader.js +6 -2
  31. package/src/components/nice-loader/nice-loader.scss +25 -2
  32. package/src/components/nice-notification/nice-notification.js +1 -2
  33. package/src/components/nice-number/nice-number.html +5 -5
  34. package/src/components/nice-percent/nice-percent.html +2 -2
  35. package/src/components/nice-search/nice-search.html +1 -1
  36. package/src/components/nice-search2/nice-search2.html +1 -1
  37. package/src/components/nice-upload/nice-upload.js +5 -5
  38. package/src/components/nice-yesno/nice-yesno.js +3 -3
@@ -12,19 +12,19 @@
12
12
 
13
13
  <div class="nice-calendar-wrapper">
14
14
  <div class="header">
15
- <i class="fa fa-angle-left" ng-click="previous()" title="{{ translations.prevMonth }}"></i>
15
+ <i class="fa fa-angle-left" ng-click="previous()" title="{{ 'Previous month' | translate:'Nice' }}"></i>
16
16
  <span title="{{ month.format('M.YYYY' )}}">{{ month.format("MMMM, YYYY" )}}</span>
17
- <i class="fa fa-angle-right" ng-click="next()" title="{{ translations.nextMonth }}"></i>
17
+ <i class="fa fa-angle-right" ng-click="next()" title="{{ 'Next month' | translate:'Nice' }}"></i>
18
18
  </div>
19
19
 
20
20
  <div class="week names">
21
- <span class="day" translate>{{ translations.mon }}</span>
22
- <span class="day" translate>{{ translations.tue }}</span>
23
- <span class="day" translate>{{ translations.wed }}</span>
24
- <span class="day" translate>{{ translations.thu }}</span>
25
- <span class="day" translate>{{ translations.fri }}</span>
26
- <span class="day weekend" translate>{{ translations.sat }}</span>
27
- <span class="day weekend" translate>{{ translations.sun }}</span>
21
+ <span class="day" translate translate-context="Nice">Mon</span>
22
+ <span class="day" translate translate-context="Nice">Tue</span>
23
+ <span class="day" translate translate-context="Nice">Wed</span>
24
+ <span class="day" translate translate-context="Nice">Thu</span>
25
+ <span class="day" translate translate-context="Nice">Fri</span>
26
+ <span class="day weekend" translate translate-context="Nice">Sat</span>
27
+ <span class="day weekend" translate translate-context="Nice">Sun</span>
28
28
  </div>
29
29
 
30
30
  <div class="week" ng-repeat="week in weeks">
@@ -60,7 +60,7 @@
60
60
  <div class="nice-calendar-time" ng-if="time">
61
61
  <div class="time-picker">
62
62
  <select
63
- title="{{ translations.selectStartTime }}"
63
+ title="{{ 'Select start time' | translate:'Nice' }}"
64
64
  class="time-picker-hour"
65
65
  ng-model="startDateHour"
66
66
  ng-change="startHourChange(startDateHour)"
@@ -70,7 +70,7 @@
70
70
 
71
71
  <div class="time-picker">
72
72
  <select
73
- title="{{ translations.selectStartTime }}"
73
+ title="{{ 'Select start time' | translate:'Nice' }}"
74
74
  class="time-picker-minute"
75
75
  ng-model="startDateMinute"
76
76
  ng-change="startMinuteChange(startDateMinute)"
@@ -84,7 +84,7 @@
84
84
 
85
85
  <div class="time-picker">
86
86
  <select
87
- title="{{ translations.selectEndTime }}"
87
+ title="{{ 'Select end time' | translate:'Nice' }}"
88
88
  class="time-picker-hour"
89
89
  ng-model="endDateHour"
90
90
  ng-change="endHourChange(endDateHour)"
@@ -94,7 +94,7 @@
94
94
 
95
95
  <div class="time-picker no-border-right">
96
96
  <select
97
- title="{{ translations.selectEndTime }}"
97
+ title="{{ 'Select end time' | translate:'Nice' }}"
98
98
  class="time-picker-minute"
99
99
  ng-model="endDateMinute"
100
100
  ng-change="endMinuteChange(endDateMinute)"
@@ -105,11 +105,11 @@
105
105
 
106
106
  <div class="nice-selected-dates">
107
107
  <div class="nice-start-date">
108
- <label>{{ translations.start }}</label>
108
+ <label translate translate-context="Nice">Start</label>
109
109
  <div ng-class="startTimeClass">{{ formatDate(startDate) }}</div>
110
110
  </div>
111
111
  <div class="nice-end-date">
112
- <label>{{ translations.end }}</label>
112
+ <label translate translate-context="Nice">End</label>
113
113
  <div ng-class="endTimeClass">{{ formatDate(endDate) }}</div>
114
114
  </div>
115
115
  <div class="clearfix"></div>
@@ -7,7 +7,7 @@
7
7
  * # niceCalendar
8
8
  */
9
9
  angular.module('niceElements')
10
- .directive("niceCalendar", function($timeout) {
10
+ .directive("niceCalendar", function($timeout, gettextCatalog) {
11
11
  return {
12
12
  restrict: "E",
13
13
  templateUrl: "src/components/nice-calendar/nice-calendar.html",
@@ -24,36 +24,14 @@ angular.module('niceElements')
24
24
  endDate: '=',
25
25
  startDate: '=',
26
26
  isDisabled: '=',
27
- translations: '@',
28
27
  help: '@',
29
28
  isInline: '=',
30
29
  onChange: '&?'
31
30
  },
32
31
  link: function(scope, element) {
33
- scope.translations = {
34
- selectStartDate: "Select start date",
35
- selectStartTime: "Select start time",
36
- selectEndDate: "Select end date",
37
- selectEndTime: "Select end time",
38
- nextMonth: "Next month",
39
- prevMonth: "Previous month",
40
- start: "Start",
41
- end: "End",
42
- mon: "Mon",
43
- tue: "Tue",
44
- wed: "Wed",
45
- thu: "Thu",
46
- fri: "Fri",
47
- sat: "Sat",
48
- sun: "Sun",
49
- january: "January",
50
- february: "February",
51
-
52
- };
53
-
54
32
  // ------------------ Init default values ------------------
55
33
  scope.selectStart = true;
56
- scope.popupText = scope.translations.selectStartDate;
34
+ scope.popupText = gettextCatalog.getString("Select start date", null, "Nice");
57
35
 
58
36
  scope.hours = [
59
37
  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23
@@ -118,7 +96,7 @@ angular.module('niceElements')
118
96
  // Set start date
119
97
  scope.startDate = selectedDate;
120
98
  scope.selectStart = false;
121
- scope.popupText = scope.translations.selectEndDate;
99
+ scope.popupText = gettextCatalog.getString("Select end date", null, "Nice");
122
100
  scope.formCalendar.$setDirty();
123
101
  scope.displayStartChange();
124
102
 
@@ -133,7 +111,7 @@ angular.module('niceElements')
133
111
  // Set end date
134
112
  scope.endDate = selectedDate;
135
113
  scope.selectStart = true;
136
- scope.popupText = scope.translations.selectStartDate;
114
+ scope.popupText = gettextCatalog.getString("Select start date", null, "Nice");
137
115
  scope.formCalendar.$setDirty();
138
116
  scope.displayEndChange();
139
117
 
@@ -30,13 +30,13 @@ angular.module('niceElements')
30
30
  isInline: '=',
31
31
  onChange: '&?'
32
32
  },
33
- controller: function($scope) {
33
+ controller: function($scope, 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];
37
37
  $scope.translations = {
38
- nextMonth: "Next month",
39
- prevMonth: "Previous month",
38
+ nextMonth: gettextCatalog.getString("Next month", null, "Nice"),
39
+ prevMonth: gettextCatalog.getString("Previous month", null, "Nice"),
40
40
  };
41
41
  $scope.innerDate = {
42
42
  month: 0,
@@ -49,7 +49,15 @@ angular.module('niceElements')
49
49
  $scope.days = [];
50
50
 
51
51
  // $scope.weekdays = moment.weekdaysShort(false);
52
- $scope.weekdays = ["Pon", "Tor", "Sre", "Čet", "Pet", "Sob", "Ned"];
52
+ $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"),
59
+ gettextCatalog.getString("Sun", null, "Nice")
60
+ ];
53
61
 
54
62
  $scope.years = [];
55
63
  var year = moment().year()-100;
@@ -57,10 +65,21 @@ angular.module('niceElements')
57
65
  $scope.years.push(year + i);
58
66
  }
59
67
 
60
- $scope.months = [];
61
- angular.forEach(moment.months(), function(month, index) {
62
- $scope.months.push({ value: index, name: month });
63
- });
68
+ $scope.months = [
69
+ { value: 0, name: gettextCatalog.getString("January", null, "Nice") },
70
+ { value: 1, name: gettextCatalog.getString("February", null, "Nice") },
71
+ { value: 2, name: gettextCatalog.getString("March", null, "Nice") },
72
+ { value: 3, name: gettextCatalog.getString("April", null, "Nice") },
73
+ { value: 4, name: gettextCatalog.getString("May", null, "Nice") },
74
+ { value: 5, name: gettextCatalog.getString("June", null, "Nice") },
75
+ { value: 6, name: gettextCatalog.getString("July", null, "Nice") },
76
+ { value: 7, name: gettextCatalog.getString("August", null, "Nice") },
77
+ { value: 8, name: gettextCatalog.getString("September", null, "Nice") },
78
+ { value: 9, name: gettextCatalog.getString("October", null, "Nice") },
79
+ { value: 10, name: gettextCatalog.getString("November", null, "Nice") },
80
+ { value: 11, name: gettextCatalog.getString("December", null, "Nice") }
81
+ ]
82
+
64
83
 
65
84
  if(!$scope.model) $scope.model = moment();
66
85
 
@@ -28,7 +28,7 @@ angular.module('niceElements')
28
28
  onChange: '&?'
29
29
  },
30
30
 
31
- link: function(scope, iElement, attrs, ctrl){
31
+ link: function(scope, attrs){
32
32
  if (!attrs.title) { attrs.title = ''; }
33
33
  if (!attrs.fieldWidth) { attrs.fieldWidth = 'col-sm-8'; }
34
34
  if (!attrs.labelWidth) { attrs.labelWidth = 'col-sm-4'; }
@@ -53,55 +53,21 @@ angular.module('niceElements')
53
53
  }
54
54
  },
55
55
 
56
- controller: function($scope, $filter) { //gettextCatalog
56
+ controller: function($scope) {
57
57
  $scope.opts = {
58
- //format: 'DD.MM.YYYY',
59
58
  locale: {
60
59
  applyClass: 'btn-green',
61
- //applyLabel: gettextCatalog.getString("Apply"),
62
- //fromLabel: gettextCatalog.getString("From"),
63
- //toLabel: gettextCatalog.getString("To"),
64
- //cancelLabel: gettextCatalog.getString("Cancel"),
65
- //customRangeLabel: gettextCatalog.getString("Custom range"),
66
60
  firstDay: 1
67
- //daysOfWeek: [
68
- // gettextCatalog.getString("Sun"),
69
- // gettextCatalog.getString("Mon"),
70
- // gettextCatalog.getString("Tue"),
71
- // gettextCatalog.getString("Wed"),
72
- // gettextCatalog.getString("Thu"),
73
- // gettextCatalog.getString("Fri"),
74
- // gettextCatalog.getString("Sat")
75
- //],
76
- //monthNames: [
77
- // gettextCatalog.getString("January"),
78
- // gettextCatalog.getString("February"),
79
- // gettextCatalog.getString("March"),
80
- // gettextCatalog.getString("April"),
81
- // gettextCatalog.getString("May"),
82
- // gettextCatalog.getString("June"),
83
- // gettextCatalog.getString("July"),
84
- // gettextCatalog.getString("August"),
85
- // gettextCatalog.getString("September"),
86
- // gettextCatalog.getString("October"),
87
- // gettextCatalog.getString("November"),
88
- // gettextCatalog.getString("December")
89
- //]
90
61
  },
91
62
  ranges: {},
92
63
  min: $scope.min,
93
64
  max: $scope.max
94
65
  };
95
66
 
96
- //$scope.opts.ranges[gettextCatalog.getString("Today")] = [moment(), moment()];
97
- //$scope.opts.ranges[gettextCatalog.getString("Last 7 days")] = [moment().subtract(7, 'days'), moment()];
98
- //$scope.opts.ranges[gettextCatalog.getString("Last 30 days")] = [moment().subtract(30, 'days'), moment()];
99
- //$scope.opts.ranges[gettextCatalog.getString("This month")] = [moment().startOf('month'), moment().endOf('month')];
100
-
101
- $scope.opts.ranges["Today"] = [moment(), moment()];
102
- $scope.opts.ranges["Last 7 days"] = [moment().subtract(7, 'days'), moment()];
103
- $scope.opts.ranges["Last 30 days"] = [moment().subtract(30, 'days'), moment()];
104
- $scope.opts.ranges["This month"] = [moment().startOf('month'), moment().endOf('month')];
67
+ $scope.opts.ranges[gettextCatalog.getString("Today", null, "Nice")] = [moment(), moment()];
68
+ $scope.opts.ranges[gettextCatalog.getString("Last 7 days", null, "Nice")] = [moment().subtract(7, 'days'), moment()];
69
+ $scope.opts.ranges[gettextCatalog.getString("Last 30 days", null, "Nice")] = [moment().subtract(30, 'days'), moment()];
70
+ $scope.opts.ranges[gettextCatalog.getString("This month", null, "Nice")] = [moment().startOf('month'), moment().endOf('month')];
105
71
 
106
72
  if(angular.isDefined($scope.format)) $scope.opts.format = format;
107
73
  }
@@ -13,7 +13,7 @@ angular.module('niceElements').directive('niceDatetimePicker', function () {
13
13
  templateUrl: 'src/components/nice-datetime-picker/nice-datetime-picker.html',
14
14
  scope: {
15
15
  model: '=', // binding model
16
- format: '@', // default: 'DD.MM.YYYY HH:mm', format for input label string
16
+ format: '@', // default: 'D.M.YYYY • H:mm', format for input label string
17
17
  date: '@', // default: true, is date picker enabled?
18
18
  time: '@', // default: false, is time picker enabled?
19
19
  width: '@', // default: 300, width of entire dtp-picker in px
@@ -34,14 +34,14 @@ angular.module('niceElements').directive('niceDatetimePicker', function () {
34
34
  isInline: '=',
35
35
  onChange: '&?'
36
36
  },
37
- controller: function ($scope) {
37
+ controller: function ($scope, gettextCatalog) {
38
38
  $scope.date = $scope.date == 'true' || $scope.date == true;
39
39
  $scope.time = $scope.time == 'true' || $scope.time == true;
40
40
  $scope.noMargin === 'true' || $scope.noMargin === true;
41
41
  $scope.enableOkButtons === 'true' || $scope.enableOkButtons === true;
42
42
  $scope.lang = $scope.lang || 'en';
43
- $scope.okText = $scope.okText || 'OK';
44
- $scope.cancelText = $scope.cancelText || 'Cancel';
43
+ $scope.okText = $scope.okText || gettextCatalog.getString('OK', null, 'Nice');
44
+ $scope.cancelText = $scope.cancelText || gettextCatalog.getString('Cancel', null, 'Nice');
45
45
  $scope.weekStart = parseInt($scope.weekStart) || 1;
46
46
  $scope.width = parseInt($scope.width) || 300;
47
47
  $scope.isOpen = false;
@@ -49,11 +49,11 @@ angular.module('niceElements').directive('niceDatetimePicker', function () {
49
49
 
50
50
  if (!$scope.format) {
51
51
  if ($scope.date && !$scope.time) {
52
- $scope.format = 'DD.MM.YYYY';
52
+ $scope.format = 'D.M.YYYY';
53
53
  } else if (!$scope.date && $scope.time) {
54
54
  $scope.format = 'HH:mm';
55
55
  } else {
56
- $scope.format = 'DD.MM.YYYY HH:mm';
56
+ $scope.format = 'D.M.YYYY • H:mm';
57
57
  }
58
58
  }
59
59
 
@@ -26,10 +26,10 @@
26
26
 
27
27
  <div class="dtp-layer">
28
28
  <div class="dtp-buttons-left">
29
- <a class="btn btn-primary btn-block" ng-click="selectLastNDays(1)">Last 24 hours</a>
30
- <a class="btn btn-primary btn-block" ng-click="selectLastNDays(7)">Last 7 days</a>
31
- <a class="btn btn-primary btn-block" ng-click="selectLastMonth()">Last month</a>
32
- <a class="btn btn-primary btn-block" ng-click="selectThisMonth()">This month</a>
29
+ <a class="btn btn-primary btn-block" ng-click="selectLastNDays(1)" translate translate-context="Nice">Last 24 hours</a>
30
+ <a class="btn btn-primary btn-block" ng-click="selectLastNDays(7)" translate translate-context="Nice">Last 7 days</a>
31
+ <a class="btn btn-primary btn-block" ng-click="selectLastMonth()" translate translate-context="Nice">Last month</a>
32
+ <a class="btn btn-primary btn-block" ng-click="selectThisMonth()" translate translate-context="Nice">This month</a>
33
33
  </div>
34
34
 
35
35
 
@@ -73,8 +73,8 @@
73
73
  </div>
74
74
 
75
75
  <div class="dtp-buttons-bottom">
76
- <a class="btn btn-danger btn-block margin-right-20" ng-click="cancelClick()">Cancel</a>
77
- <a class="btn btn-success btn-block" ng-click="okClick()">OK</a>
76
+ <a class="btn btn-danger btn-block margin-right-20" ng-click="cancelClick()" translate translate-context="Nice">Cancel</a>
77
+ <a class="btn btn-success btn-block" ng-click="okClick()" translate translate-context="Nice">OK</a>
78
78
  </div>
79
79
  </div>
80
80
  </div>
@@ -7,12 +7,12 @@
7
7
  * # niceDatetimerangePicker
8
8
  */
9
9
  angular.module('niceElements')
10
- .directive('niceDatetimerangePicker', ['$window', '$timeout', function($window, $timeout) {
10
+ .directive('niceDatetimerangePicker', function(gettextCatalog) {
11
11
  return {
12
12
  scope: {
13
13
  modelStart: '=', // binding model
14
14
  modelEnd: '=', // binding model
15
- format: '@', // default: 'DD.MM.YYYY HH:mm', format for input label string
15
+ format: '@', // default: 'D.M.YYYY • H:mm', format for input label string
16
16
  modelFormat: '@',
17
17
  date: '@', // default: true, is date picker enabled?
18
18
  time: '@', // default: false, is time picker enabled?
@@ -37,22 +37,22 @@ angular.module('niceElements')
37
37
  },
38
38
  templateUrl: 'src/components/nice-datetimerange-picker/nice-datetimerange-picker.html',
39
39
  link: {
40
- pre: function($scope, $element, $attrs) {
40
+ pre: function($scope) {
41
41
  // Default parameters
42
42
  var params = {
43
43
  title: '',
44
44
  noMargin: false,
45
45
  fieldWidth: 'col-sm-8',
46
46
  labelWidth: 'col-sm-4',
47
- format: 'D.M.YYYY H:mm',
47
+ format: 'D.M.YYYY • H:mm',
48
48
  modelFormat: 'YYYY-MM-DDTHH:mm:ss.SSS',
49
49
  minDate: null,
50
50
  maxDate: null,
51
51
  lang: 'en',
52
52
  weekStart: 1,
53
53
  shortTime: false,
54
- cancelText: 'Cancel',
55
- okText: 'OK',
54
+ cancelText: gettextCatalog.getString('Cancel', null, 'Nice'),
55
+ okText: gettextCatalog.getString('OK', null, 'Nice'),
56
56
  date: true,
57
57
  time: false,
58
58
  width: 300,
@@ -243,4 +243,4 @@ angular.module('niceElements')
243
243
  }
244
244
  };
245
245
 
246
- }]);
246
+ });
@@ -19,15 +19,15 @@
19
19
  <div class="dtp-wrapper" ng-show="isOpen">
20
20
  <div class="dtp-buttons-left">
21
21
  <div class="dtp-buttons-top">
22
- <a class="btn btn-primary btn-block" ng-click="selectToday()">Last 24 hours</a>
23
- <a class="btn btn-primary btn-block" ng-click="selectLastNDays(7)">Last 7 days</a>
24
- <a class="btn btn-primary btn-block" ng-click="selectLastMonth()">Last month</a>
25
- <a class="btn btn-primary btn-block" ng-click="selectThisMonth()">This month</a>
22
+ <a class="btn btn-primary btn-block" ng-click="selectToday()" translate translate-context="Nice">Last 24 hours</a>
23
+ <a class="btn btn-primary btn-block" ng-click="selectLastNDays(7)" translate translate-context="Nice">Last 7 days</a>
24
+ <a class="btn btn-primary btn-block" ng-click="selectLastMonth()" translate translate-context="Nice">Last month</a>
25
+ <a class="btn btn-primary btn-block" ng-click="selectThisMonth()" translate translate-context="Nice">This month</a>
26
26
  </div>
27
27
 
28
28
  <div class="dtp-buttons-bottom">
29
- <a class="btn btn-danger btn-block" ng-click="close()">Cancel</a>
30
- <a class="btn btn-success btn-block" ng-click="confirm()">OK</a>
29
+ <a class="btn btn-danger btn-block" ng-click="close()" translate translate-context="Nice">Cancel</a>
30
+ <a class="btn btn-success btn-block" ng-click="confirm()" translate translate-context="Nice">OK</a>
31
31
  </div>
32
32
  </div>
33
33
 
@@ -12,7 +12,7 @@ angular.module('niceElements')
12
12
  scope: {
13
13
  startDate: '=', // binding model
14
14
  endDate: '=', // binding model
15
- formatString: '@', // default: 'DD.MM.YYYY HH:mm', format for input label string
15
+ formatString: '@', // default: 'D.M.YYYY • H:mm', format for input label string
16
16
  modelFormat: '@',
17
17
  time: '@', // default: false, is time picker enabled?
18
18
  minDate: '@', // default: undefined
@@ -38,7 +38,7 @@ angular.module('niceElements')
38
38
 
39
39
  // Set format string
40
40
  if(!$scope.formatString) {
41
- if($scope.time) $scope.formatString = 'D.M.YYYY H:mm';
41
+ if($scope.time) $scope.formatString = 'D.M.YYYY • H:mm';
42
42
  else $scope.formatString = 'D.M.YYYY';
43
43
  }
44
44
 
@@ -11,7 +11,7 @@
11
11
  <div class="nice-field col-xs-12" ng-class="[ fieldWidth ? fieldWidth : 'col-sm-8', { 'open': isOpen, 'nice-disabled': isDisabled || emptyList } ]" click-outside="close()" is-open="{{ isOpen }}">
12
12
  <div class="nice-field-wrapper">
13
13
  <!------------------------- Button ------------------------->
14
- <button type="button" class="btn btn-dropdown" ng-click="toggle()" ng-disabled="isDisabled || emptyList">
14
+ <button type="button" class="btn btn-dropdown" ng-ref="dropdown-button" ng-click="toggle()" ng-disabled="isDisabled || emptyList">
15
15
  <div class="btn-dropdown-inside" ng-transclude="button" ng-if="selected != null">
16
16
  <span ng-if="!multiple">{{ selected[objValue] }}</span>
17
17
  <span ng-if="multiple">
@@ -29,7 +29,7 @@
29
29
 
30
30
 
31
31
  <!------------------------- Dropdown menu ------------------------->
32
- <div class="dropdown-menu">
32
+ <div class="dropdown-menu" ng-class="{ 'dropdown-menu-fixed': positionFixed }">
33
33
  <div class="search-bar" ng-if="searchFunction">
34
34
  <input ng-model="internal.search" ng-model-options="{ debounce: 500 }" ng-change="handleSearch()" placeholder="{{ searchText }}" />
35
35
  <span class="icon"><i class="fa fa-search"></i></span>
@@ -7,7 +7,7 @@
7
7
  * # nice-dropdown
8
8
  */
9
9
  angular.module('niceElements')
10
- .directive('niceDropdown', function () {
10
+ .directive('niceDropdown', function ($window) {
11
11
  return {
12
12
  templateUrl: 'src/components/nice-dropdown/nice-dropdown.html',
13
13
  restrict: 'E',
@@ -41,17 +41,18 @@ angular.module('niceElements')
41
41
  selectedText: '@',
42
42
  searchFunction: '=?',
43
43
  isInline: '=',
44
- clearOnSelect: '@'
44
+ clearOnSelect: '@',
45
+ positionFixed: '=' // Dropdown menu will be fixed to page
45
46
  },
46
- controller: function ($scope, $element, $timeout) {
47
+ controller: function ($scope, $element, $timeout, gettextCatalog) {
47
48
  if (!$scope.objValue) { $scope.objValue = 'value'; }
48
49
  if (!$scope.objKey) { $scope.objKey = 'id'; }
49
- if (!$scope.noOptionsText) { $scope.noOptionsText = "No options"; }
50
- if (!$scope.noDataText) { $scope.noDataText = "No options"; }
51
- if (!$scope.searchText) { $scope.searchText = "Search..."; }
52
- if (!$scope.nullableText) { $scope.nullableText = "None"; }
53
- if (!$scope.selectText) { $scope.selectText = "None"; }
54
- if (!$scope.selectedText) { $scope.selectedText = "selected"; }
50
+ if (!$scope.noOptionsText) { $scope.noOptionsText = gettextCatalog.getString("No options", null, "Nice"); }
51
+ if (!$scope.noDataText) { $scope.noDataText = gettextCatalog.getString("No options", null, "Nice"); }
52
+ if (!$scope.searchText) { $scope.searchText = gettextCatalog.getString("Search...", null, "Nice"); }
53
+ if (!$scope.nullableText) { $scope.nullableText = gettextCatalog.getString("None", null, "Nice"); }
54
+ if (!$scope.selectText) { $scope.selectText = gettextCatalog.getString("None", null, "Nice"); }
55
+ if (!$scope.selectedText) { $scope.selectedText = gettextCatalog.getString("selected", null, "Nice"); }
55
56
  if (!$scope.addButtonFunction) { $scope.addButtonFunction = null; }
56
57
  $scope.nullable = $scope.nullable === 'true' || $scope.nullable === true;
57
58
  $scope.required = $scope.required === 'true' || $scope.required === true;
@@ -83,6 +84,7 @@ angular.module('niceElements')
83
84
  $scope.open = function () {
84
85
  $scope.focusInput();
85
86
  $scope.isOpen = true;
87
+ if($scope.positionFixed) $scope.updateStyle();
86
88
  $timeout(function() {
87
89
  $scope.scrollToHover(true);
88
90
  }, 100);
@@ -213,7 +215,8 @@ angular.module('niceElements')
213
215
 
214
216
  // ----------------------------------- Handle default -----------------------------------
215
217
  $scope.handleDefault = function() {
216
- if (!$scope.nullable && !$scope.model && $scope.internalList && $scope.internalList.length > 0) {
218
+ if ($scope.model) $scope.handleModelChange();
219
+ if (!$scope.nullable && !$scope.model && !$scope.clearOnSelect && $scope.internalList && $scope.internalList.length > 0) {
217
220
  $scope.handleSelected($scope.internalList[0], 0);
218
221
  }
219
222
  };
@@ -227,6 +230,10 @@ angular.module('niceElements')
227
230
 
228
231
  // ----------------------------------- Watch for model change -----------------------------------
229
232
  $scope.$watch('model', function (value_new, value_old) {
233
+ $scope.handleModelChange();
234
+ });
235
+
236
+ $scope.handleModelChange = function() {
230
237
  $scope.selected = angular.copy($scope.model);
231
238
  angular.forEach($scope.internalList, function(i, index) {
232
239
  i._selected = false;
@@ -250,7 +257,7 @@ angular.module('niceElements')
250
257
  $scope.selectedIndex = index;
251
258
  $scope.scrollToHover();
252
259
  }
253
- }
260
+ }
254
261
  } else {
255
262
  // Is object
256
263
  if ($scope.multiple) {
@@ -273,7 +280,31 @@ angular.module('niceElements')
273
280
  }
274
281
  }
275
282
  });
276
- });
283
+ }
284
+
285
+ // ----------------------------------- Handle fixed position -----------------------------------
286
+ if ($scope.positionFixed) {
287
+ $scope.dropdownButton = $element[0].getElementsByClassName('btn-dropdown')[0]
288
+ $scope.dropdownMenu = $element[0].getElementsByClassName('dropdown-menu')[0]
289
+ $scope.updateStyle = function () {
290
+ if (this.isOpen) {
291
+ var buttonPos = $scope.dropdownButton.getBoundingClientRect();
292
+ $scope.dropdownMenu.style.top = (buttonPos.top + buttonPos.height) + "px";
293
+ $scope.dropdownMenu.style.left = buttonPos.left + "px";
294
+ $scope.dropdownMenu.style.width = buttonPos.width + "px";
295
+ }
296
+ }
297
+
298
+ $scope.updateStyle();
299
+
300
+ angular.element($window).on("resize", function () {
301
+ $scope.updateStyle();
302
+ })
303
+
304
+ angular.element($window).on("scroll", function () {
305
+ $scope.updateStyle();
306
+ })
307
+ }
277
308
 
278
309
 
279
310
  // ----------------------------------- Watch for keydown and keypress -----------------------------------
@@ -3,6 +3,10 @@
3
3
  cursor: not-allowed !important;
4
4
  }
5
5
 
6
+ .dropdown-menu-fixed {
7
+ position: fixed !important;
8
+ }
9
+
6
10
  .open {
7
11
  .btn-dropdown {
8
12
  background: $nice-focus-bg !important;
@@ -7,7 +7,7 @@
7
7
  * # niceDropdownDate
8
8
  */
9
9
  angular.module('niceElements')
10
- .directive('niceDropdownDate', function (){
10
+ .directive('niceDropdownDate', function (gettextCatalog) {
11
11
  return {
12
12
  restrict: 'E',
13
13
  replace: true,
@@ -29,18 +29,18 @@ angular.module('niceElements')
29
29
  link: function ($scope) {
30
30
  $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];
31
31
  $scope.months = [
32
- { value: 0, name: 'Jan' },
33
- { value: 1, name: 'Feb' },
34
- { value: 2, name: 'Mar' },
35
- { value: 3, name: 'Apr' },
36
- { value: 4, name: 'May' },
37
- { value: 5, name: 'Jun' },
38
- { value: 6, name: 'Jul' },
39
- { value: 7, name: 'Aug' },
40
- { value: 8, name: 'Sep' },
41
- { value: 9, name: 'Oct' },
42
- { value: 10, name: 'Nov' },
43
- { value: 11, name: 'Dec' }
32
+ { value: 0, name: gettextCatalog.getString('Jan', null, 'Nice') },
33
+ { value: 1, name: gettextCatalog.getString('Feb', null, 'Nice') },
34
+ { value: 2, name: gettextCatalog.getString('Mar', null, 'Nice') },
35
+ { value: 3, name: gettextCatalog.getString('Apr', null, 'Nice') },
36
+ { value: 4, name: gettextCatalog.getString('May', null, 'Nice') },
37
+ { value: 5, name: gettextCatalog.getString('Jun', null, 'Nice') },
38
+ { value: 6, name: gettextCatalog.getString('Jul', null, 'Nice') },
39
+ { value: 7, name: gettextCatalog.getString('Aug', null, 'Nice') },
40
+ { value: 8, name: gettextCatalog.getString('Sep', null, 'Nice') },
41
+ { value: 9, name: gettextCatalog.getString('Oct', null, 'Nice') },
42
+ { value: 10, name: gettextCatalog.getString('Nov', null, 'Nice') },
43
+ { value: 11, name: gettextCatalog.getString('Dec', null, 'Nice') }
44
44
  ];
45
45
 
46
46
 
@@ -82,7 +82,7 @@ angular.module('niceElements')
82
82
 
83
83
  // validate that the date selected is accurate
84
84
  $scope.checkDate = function(){
85
- var date = moment($scope.dateFields.day + "." + ($scope.dateFields.month + 1) + "." + $scope.dateFields.year, "DD.MM.YYYY");
85
+ var date = moment($scope.dateFields.day + "." + ($scope.dateFields.month + 1) + "." + $scope.dateFields.year, "D.M.YYYY");
86
86
 
87
87
  if(date.isValid()){
88
88
  // Format
@@ -23,9 +23,9 @@
23
23
 
24
24
  <span ng-if="multiple">
25
25
  <!--<span ng-repeat="item in internalSelected"><span ng-if="$index > 0">, </span>{{ getLabel(item) }}</span>-->
26
- <span ng-if="internalSelected.length > 1">{{ internalSelected.length }} <translate>selected</translate></span>
26
+ <span ng-if="internalSelected.length > 1">{{ internalSelected.length }} <translate translate-context="Nice">selected</translate></span>
27
27
  <span ng-if="internalSelected.length == 1">{{ getLabel(internalSelected[0]) }}</span>
28
- <span ng-if="internalSelected.length == 0" translate>None</span>
28
+ <span ng-if="internalSelected.length == 0" translate translate-context="Nice">None</span>
29
29
  </span>
30
30
 
31
31
  <!--<span ng-if="showTax && internalSelected.value">{{ internalSelected.value * 100 }}%</span>-->