nice-elements 1.10.3 → 1.10.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/bower.json +1 -1
  4. package/dist/nice.js +198 -143
  5. package/dist/nice.min.js +1 -1
  6. package/dist/style.css +17 -2
  7. package/dist/style.css.map +1 -1
  8. package/dist/style.min.css +2 -2
  9. package/eslint.config.mjs +28 -0
  10. package/package.json +4 -1
  11. package/src/components/nice-button/nice-button.js +0 -1
  12. package/src/components/nice-calendar/nice-calendar.html +1 -1
  13. package/src/components/nice-calendar/nice-calendar.js +3 -1
  14. package/src/components/nice-checkbox/nice-checkbox.html +1 -1
  15. package/src/components/nice-checkbox/nice-checkbox.js +1 -0
  16. package/src/components/nice-choice/nice-choice.html +1 -1
  17. package/src/components/nice-choice/nice-choice.js +1 -0
  18. package/src/components/nice-comment/nice-comment.html +2 -2
  19. package/src/components/nice-comment/nice-comment.js +3 -1
  20. package/src/components/nice-date/nice-date.html +3 -2
  21. package/src/components/nice-date/nice-date.js +3 -1
  22. package/src/components/nice-date-input/nice-date-input.html +1 -1
  23. package/src/components/nice-date-input/nice-date-input.js +3 -1
  24. package/src/components/nice-date-range/nice-date-range.html +1 -1
  25. package/src/components/nice-date-range/nice-date-range.js +9 -7
  26. package/src/components/nice-datetime-picker/nice-datetime-picker.html +1 -1
  27. package/src/components/nice-datetime-picker/nice-datetime-picker.js +3 -1
  28. package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.html +1 -1
  29. package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.js +3 -1
  30. package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.html +1 -1
  31. package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.js +3 -1
  32. package/src/components/nice-dropdown/nice-dropdown.html +3 -2
  33. package/src/components/nice-dropdown/nice-dropdown.js +13 -6
  34. package/src/components/nice-dropdown/nice-dropdown.scss +13 -1
  35. package/src/components/nice-dropdown-date/nice-dropdown-date.html +1 -1
  36. package/src/components/nice-dropdown-date/nice-dropdown-date.js +10 -8
  37. package/src/components/nice-dropdown-old/nice-dropdown-old.html +1 -1
  38. package/src/components/nice-dropdown-old/nice-dropdown-old.js +1 -0
  39. package/src/components/nice-dtp/nice-dtp.js +3 -1
  40. package/src/components/nice-input/nice-input.html +1 -1
  41. package/src/components/nice-input/nice-input.js +1 -0
  42. package/src/components/nice-label/nice-label.html +1 -1
  43. package/src/components/nice-label/nice-label.js +3 -1
  44. package/src/components/nice-number/nice-number.html +1 -1
  45. package/src/components/nice-number/nice-number.js +1 -0
  46. package/src/components/nice-percent/nice-percent.html +1 -1
  47. package/src/components/nice-percent/nice-percent.js +1 -0
  48. package/src/components/nice-progress-bar/nice-progress-bar.html +1 -1
  49. package/src/components/nice-progress-bar/nice-progress-bar.js +1 -0
  50. package/src/components/nice-quantity/nice-quantity.html +1 -1
  51. package/src/components/nice-quantity/nice-quantity.js +2 -0
  52. package/src/components/nice-search/nice-search.html +1 -1
  53. package/src/components/nice-search/nice-search.js +1 -0
  54. package/src/components/nice-search2/nice-search2.html +1 -1
  55. package/src/components/nice-search2/nice-search2.js +1 -0
  56. package/src/components/nice-slot/nice-slot.html +1 -1
  57. package/src/components/nice-slot/nice-slot.js +3 -1
  58. package/src/components/nice-time-picker/nice-time-picker.html +1 -1
  59. package/src/components/nice-time-picker/nice-time-picker.js +3 -1
  60. package/src/components/nice-toggle/nice-toggle.html +2 -2
  61. package/src/components/nice-toggle/nice-toggle.js +4 -2
  62. package/src/components/nice-toggle/nice-toggle.scss +4 -0
  63. package/src/components/nice-upload/nice-upload.html +2 -2
  64. package/src/components/nice-upload/nice-upload.js +3 -1
  65. package/src/components/nice-wrapper/nice-wrapper.html +1 -1
  66. package/src/components/nice-wrapper/nice-wrapper.js +1 -0
  67. package/src/components/nice-yesno/nice-yesno.html +1 -1
  68. package/src/components/nice-yesno/nice-yesno.js +23 -21
  69. package/src/services/nice-service.js +5 -2
@@ -0,0 +1,28 @@
1
+ import globals from "globals";
2
+ import pluginJs from "@eslint/js";
3
+
4
+ export default [
5
+ {
6
+ files: ["**/*.js"],
7
+ languageOptions: {
8
+ sourceType: "script"
9
+ }
10
+ },
11
+ {
12
+ languageOptions: {
13
+ globals: {
14
+ ...globals.browser,
15
+ angular: true,
16
+ moment: true,
17
+ Popper: true
18
+ }
19
+ }
20
+ },
21
+ pluginJs.configs.recommended,
22
+ {
23
+ rules: {
24
+ "no-unused-vars": "warn",
25
+ "no-vars": "warn"
26
+ }
27
+ }
28
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nice-elements",
3
- "version": "1.10.3",
3
+ "version": "1.10.5",
4
4
  "description": "Nice elements used in olaii angular 1.x webapps.",
5
5
  "main": "dist/nice.js",
6
6
  "license": "MIT",
@@ -27,6 +27,9 @@
27
27
  "ng-dialog": "0.5.6"
28
28
  },
29
29
  "devDependencies": {
30
+ "@eslint/js": "8.0.0",
31
+ "eslint": "8.0.0",
32
+ "globals": "15.2.0",
30
33
  "express": "4.17.1",
31
34
  "grunt": "1.6.1",
32
35
  "grunt-angular-templates": "1.2.0",
@@ -13,7 +13,6 @@ angular.module('niceElements')
13
13
  transclude: true,
14
14
  replace: true,
15
15
  scope: {
16
- title: '@',
17
16
  icon: '@?',
18
17
  noMargin: '=',
19
18
  niceClick: '&',
@@ -1,7 +1,7 @@
1
1
  <div class="nice-component nice-calendar" ng-form="formCalendar" ng-class="{ 'margin-bottom-0': noMargin, 'nice-component-inline': isInline }">
2
2
  <div class="row">
3
3
  <!------------------------- Title ------------------------->
4
- <nice-title text="title" help="help" required="required" label-width="labelWidth"></nice-title>
4
+ <nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
5
5
 
6
6
  <!------------------------- Field ------------------------->
7
7
  <div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
@@ -12,6 +12,7 @@ angular.module('niceElements')
12
12
  restrict: "E",
13
13
  templateUrl: "src/components/nice-calendar/nice-calendar.html",
14
14
  scope: {
15
+ niceTitle: '@',
15
16
  title: '@',
16
17
  fieldWidth: '@',
17
18
  labelWidth: '@',
@@ -26,7 +27,8 @@ angular.module('niceElements')
26
27
  isDisabled: '=',
27
28
  help: '@',
28
29
  isInline: '=',
29
- onChange: '&?'
30
+ onChange: '&?',
31
+ required: '='
30
32
  },
31
33
  link: function (scope, element) {
32
34
  // ------------------ Init default values ------------------
@@ -2,5 +2,5 @@
2
2
  <button type="button" class="btn nice-checkbox-checkbox" ng-disabled="isDisabled">
3
3
  <nice-icon class="nice-checkbox-check" icon="icon-check"></nice-icon>
4
4
  </button>
5
- <div ng-if="title" class="nice-checkbox-message" ng-class="{ 'nice-disabled': isDisabled }">{{ title }}</div>
5
+ <div ng-if="title || niceTitle" class="nice-checkbox-message" ng-class="{ 'nice-disabled': isDisabled }">{{ title || niceTitle }}</div>
6
6
  </div>
@@ -13,6 +13,7 @@ angular.module('niceElements')
13
13
  restrict: 'E',
14
14
  scope: {
15
15
  model: '=',
16
+ niceTitle: '@',
16
17
  title: '@',
17
18
  titleOnLeft: '=',
18
19
  noMargin: '@',
@@ -1,7 +1,7 @@
1
1
  <div class="nice-component nice-choice" ng-class="{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }" ng-form="formChoice">
2
2
  <div class="row">
3
3
  <!------------------------- Title ------------------------->
4
- <nice-title text="title" help="help" required="required" label-width="labelWidth"></nice-title>
4
+ <nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
5
5
 
6
6
  <!------------------------- Field ------------------------->
7
7
  <div class="nice-field col-xs-12" ng-class="fieldWidth ? fieldWidth : 'col-sm-8'">
@@ -13,6 +13,7 @@ angular.module('niceElements')
13
13
  templateUrl: 'src/components/nice-choice/nice-choice.html',
14
14
  restrict: 'E',
15
15
  scope: {
16
+ niceTitle: '@',
16
17
  title: '@',
17
18
  model: '=',
18
19
  list: '=',
@@ -1,11 +1,11 @@
1
1
  <div class="nice-component nice-comment" ng-class="{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }">
2
2
  <div class="row">
3
3
  <!------------------------- Title ------------------------->
4
- <nice-title text="title" help="help" required="required" label-width="labelWidth"></nice-title>
4
+ <nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
5
5
 
6
6
  <!------------------------- Field ------------------------->
7
7
  <div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]" ng-click="edit()">
8
- <textarea ng-class="{'editing': editing}" class="form-control" ng-model="model" placeholder="{{placeholder}}" rows="{{rows}}" ng-blur="save()" ng-disabled="isDisabled"></textarea>
8
+ <textarea ng-class="{'editing': editing}" class="form-control" ng-model="model" placeholder="{{placeholder}}" rows="{{rows}}" ng-blur="save()" ng-required="required" ng-disabled="isDisabled"></textarea>
9
9
  </div>
10
10
  </div>
11
11
  </div>
@@ -14,6 +14,7 @@ angular.module('niceElements')
14
14
  scope: {
15
15
  model: '=',
16
16
  title: '@?',
17
+ niceTitle: '@?',
17
18
  isDisabled: '=',
18
19
  placeholder: '@',
19
20
  noTextLabel: '@',
@@ -22,7 +23,8 @@ angular.module('niceElements')
22
23
  labelWidth: '@',
23
24
  help: '@',
24
25
  isInline: '=',
25
- rows: '@'
26
+ rows: '@',
27
+ required: '='
26
28
  },
27
29
  link: function postLink(scope, element, attrs) {
28
30
  if (scope.model == null) { scope.model = ''; }
@@ -3,7 +3,7 @@
3
3
 
4
4
  <div class="row">
5
5
  <!------------------------- Title ------------------------->
6
- <nice-title text="title" help="help" required="required" label-width="labelWidth"></nice-title>
6
+ <nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
7
7
 
8
8
  <!------------------------- Field ------------------------->
9
9
  <div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
@@ -27,7 +27,8 @@
27
27
  <div class="nice-date-header">
28
28
  <span>
29
29
  <select class="year-picker" ng-model="innerDate.year" ng-change="handleDateChange()" ng-options="year for year in years" ng-disabled="isDisabled">
30
- </select>,
30
+ </select>
31
+ <span>,</span>
31
32
  <select class="month-picker" ng-model="innerDate.month" ng-change="handleDateChange()" ng-options="month.value as month.name for month in months" ng-disabled="isDisabled">
32
33
  </select>
33
34
  </span>
@@ -14,6 +14,7 @@ angular.module('niceElements')
14
14
  transclude: true,
15
15
  templateUrl: 'src/components/nice-date/nice-date.html',
16
16
  scope: {
17
+ niceTitle: '@',
17
18
  title: '@', // default: ''
18
19
  noMargin: '@', // default: false, if noMargin==true then entire directive can be injected inside other divs
19
20
  fieldWidth: '@', // default: 'col-sm-8', bootstrap classes that defines width of field
@@ -28,7 +29,8 @@ angular.module('niceElements')
28
29
  nextDate: '=',
29
30
  isDisabled: '=',
30
31
  isInline: '=',
31
- onChange: '&?'
32
+ onChange: '&?',
33
+ required: '='
32
34
  },
33
35
  controller: function ($scope, $element, $timeout, gettextCatalog) {
34
36
  $scope.isOpen = false;
@@ -1,7 +1,7 @@
1
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
2
  <div class="row">
3
3
  <!------------------------- Title ------------------------->
4
- <nice-title text="title" help="help" required="required" label-width="labelWidth"></nice-title>
4
+ <nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
5
5
 
6
6
  <!------------------------- Field ------------------------->
7
7
  <div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
@@ -18,6 +18,7 @@ angular.module('niceElements')
18
18
  time: '=?', // default: false, is time picker enabled?
19
19
  minDate: '@', // default: undefined
20
20
  maxDate: '@', // default: undefined
21
+ niceTitle: '@',
21
22
  title: '@', // default: ''
22
23
  noMargin: '@', // default: false, if noMargin==true then entire directive can be injected inside other divs
23
24
  fieldWidth: '@', // default: 'col-sm-8', bootstrap classes that defines width of field
@@ -25,7 +26,8 @@ angular.module('niceElements')
25
26
  isDisabled: '=',
26
27
  help: '@',
27
28
  isInline: '=',
28
- onChange: '&?'
29
+ onChange: '&?',
30
+ required: '='
29
31
  },
30
32
  controller: function ($scope, $timeout) {
31
33
  $scope.formatDate = "DD.MM.YYYY";
@@ -1,7 +1,7 @@
1
1
  <ng-form class="nice-component nice-date-range" ng-class="{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }" name="form">
2
2
  <div class="row">
3
3
  <!------------------------- Title ------------------------->
4
- <nice-title text="title" help="help" required="required" label-width="labelWidth"></nice-title>
4
+ <nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
5
5
 
6
6
  <!------------------------- Field ------------------------->
7
7
  <div class="nice-field col-xs-12" ng-class="fieldWidth ? fieldWidth : 'col-sm-8'">
@@ -8,13 +8,14 @@
8
8
  */
9
9
  angular.module('niceElements')
10
10
 
11
- .directive('niceDateRange', function() {
11
+ .directive('niceDateRange', function () {
12
12
  return {
13
13
  restrict: 'E',
14
14
  transclude: true,
15
15
  templateUrl: 'src/components/nice-date-range/nice-date-range.html',
16
16
  scope: {
17
17
  model: '=',
18
+ niceTitle: '@',
18
19
  title: '@',
19
20
  fieldWidth: '@',
20
21
  format: '@',
@@ -25,19 +26,20 @@ angular.module('niceElements')
25
26
  startOfTheYear: '@',
26
27
  help: '@',
27
28
  isInline: '=',
28
- onChange: '&?'
29
+ onChange: '&?',
30
+ required: '='
29
31
  },
30
32
 
31
- link: function(scope, attrs){
33
+ link: function (scope, attrs) {
32
34
  if (!attrs.title) { attrs.title = ''; }
33
35
  if (!attrs.fieldWidth) { attrs.fieldWidth = 'col-sm-8'; }
34
36
  if (!attrs.labelWidth) { attrs.labelWidth = 'col-sm-4'; }
35
37
  if (!attrs.format) { attrs.format = 'dd.MM.yyyy'; }
36
38
  attrs.noMargin = angular.isDefined(attrs.noMargin);
37
39
 
38
- if(!angular.isDefined(scope.model)) {
40
+ if (!angular.isDefined(scope.model)) {
39
41
  var model = null;
40
- if(!angular.isDefined(scope.startOfTheYear)){
42
+ if (!angular.isDefined(scope.startOfTheYear)) {
41
43
  model = {
42
44
  startDate: moment().format(),
43
45
  endDate: moment().format()
@@ -53,7 +55,7 @@ angular.module('niceElements')
53
55
  }
54
56
  },
55
57
 
56
- controller: function($scope) {
58
+ controller: function ($scope) {
57
59
  $scope.opts = {
58
60
  locale: {
59
61
  applyClass: 'btn-green',
@@ -69,7 +71,7 @@ angular.module('niceElements')
69
71
  $scope.opts.ranges[gettextCatalog.getString("Last 30 days", null, "Nice")] = [moment().subtract(30, 'days'), moment()];
70
72
  $scope.opts.ranges[gettextCatalog.getString("This month", null, "Nice")] = [moment().startOf('month'), moment().endOf('month')];
71
73
 
72
- if(angular.isDefined($scope.format)) $scope.opts.format = format;
74
+ if (angular.isDefined($scope.format)) $scope.opts.format = format;
73
75
  }
74
76
 
75
77
  };
@@ -3,7 +3,7 @@
3
3
 
4
4
  <div class="row">
5
5
  <!------------------------- Title ------------------------->
6
- <nice-title text="title" help="help" required="required" label-width="labelWidth"></nice-title>
6
+ <nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
7
7
 
8
8
  <!------------------------- Field ------------------------->
9
9
  <div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
@@ -25,6 +25,7 @@ angular.module('niceElements').directive('niceDatetimePicker', function () {
25
25
  okText: '@',
26
26
  cancelText: '@',
27
27
  shortTime: '@', // default: false,
28
+ niceTitle: '@',
28
29
  title: '@', // default: ''
29
30
  noMargin: '@', // default: false, if noMargin==true then entire directive can be injected inside other divs
30
31
  fieldWidth: '@', // default: 'col-sm-8', bootstrap classes that defines width of field
@@ -32,7 +33,8 @@ angular.module('niceElements').directive('niceDatetimePicker', function () {
32
33
  isDisabled: '=',
33
34
  help: '@',
34
35
  isInline: '=',
35
- onChange: '&?'
36
+ onChange: '&?',
37
+ required: '='
36
38
  },
37
39
  controller: function ($scope, gettextCatalog) {
38
40
  console.warn("[NICE ELEMENTS] nice-datetime-picker component is deprecated!");
@@ -3,7 +3,7 @@
3
3
 
4
4
  <div class="row">
5
5
  <!------------------------- Title ------------------------->
6
- <nice-title text="title" help="help" required="required" label-width="labelWidth"></nice-title>
6
+ <nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
7
7
 
8
8
  <!------------------------- Field ------------------------->
9
9
  <div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
@@ -25,6 +25,7 @@ angular.module('niceElements')
25
25
  okText: '@',
26
26
  cancelText: '@',
27
27
  shortTime: '@', // default: false,
28
+ niceTitle: '@',
28
29
  title: '@', // default: ''
29
30
  noMargin: '@', // default: false, if noMargin==true then entire directive can be injected inside other divs
30
31
  fieldWidth: '@', // default: 'col-sm-8', bootstrap classes that defines width of field
@@ -33,7 +34,8 @@ angular.module('niceElements')
33
34
  isDisabled: '=',
34
35
  help: '@',
35
36
  isInline: '=',
36
- onChange: '&?'
37
+ onChange: '&?',
38
+ required: '='
37
39
  },
38
40
  templateUrl: 'src/components/nice-datetimerange-picker/nice-datetimerange-picker.html',
39
41
  link: {
@@ -3,7 +3,7 @@
3
3
 
4
4
  <div class="row">
5
5
  <!------------------------- Title ------------------------->
6
- <nice-title text="title" help="help" required="required" label-width="labelWidth"></nice-title>
6
+ <nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
7
7
 
8
8
  <!------------------------- Field ------------------------->
9
9
  <div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
@@ -17,6 +17,7 @@ angular.module('niceElements')
17
17
  time: '=?', // default: false, is time picker enabled?
18
18
  minDate: '@', // default: undefined
19
19
  maxDate: '@', // default: undefined
20
+ niceTitle: '@',
20
21
  title: '@', // default: ''
21
22
  noMargin: '@', // default: false, if noMargin==true then entire directive can be injected inside other divs
22
23
  fieldWidth: '@', // default: 'col-sm-8', bootstrap classes that defines width of field
@@ -24,7 +25,8 @@ angular.module('niceElements')
24
25
  isDisabled: '=',
25
26
  help: '@',
26
27
  isInline: '=',
27
- onChange: '&?'
28
+ onChange: '&?',
29
+ required: '='
28
30
  },
29
31
  templateUrl: 'src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.html',
30
32
  controller: function ($element, $timeout, $scope) {
@@ -1,13 +1,14 @@
1
1
  <div class="nice-component nice-dropdown" ng-class="{ 'margin-bottom-0': noMargin, 'nice-component-inline': isInline }" ng-form="formDropdown">
2
2
  <div class="row">
3
3
  <!------------------------- Title ------------------------->
4
- <nice-title text="title" help="help" required="required" label-width="labelWidth"></nice-title>
4
+ <nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
5
5
 
6
6
  <!------------------------- Field ------------------------->
7
7
  <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 }}">
8
8
  <div class="nice-field-wrapper">
9
9
  <!------------------------- Button ------------------------->
10
10
  <button type="button" class="btn btn-dropdown" type="button" ng-ref="dropdown-button" ng-click="toggle()" ng-disabled="isDisabled || emptyList" aria-expanded="{{ isOpen }}" aria-haspopup="true" aria-controls="menu" id="nice-dropdown-{{ id }}">
11
+ <input class="hidden-input" ng-model="model" ng-required="required" ng-disabled="disabled" tabindex="-1" />
11
12
  <div class="btn-dropdown-inside" ng-transclude="button" ng-if="selected != null">
12
13
  <span ng-if="!multiple">{{ selected[objValue] }}</span>
13
14
  <span ng-if="multiple">
@@ -28,7 +29,7 @@
28
29
  <div class="nice-dropdown-menu-wrapper">
29
30
  <div class="nice-dropdown-menu" ng-if="isOpen">
30
31
  <div class="search-bar" ng-if="!noSearch && searchFunction">
31
- <input ng-model="internal.search" ng-model-options="{ debounce: 500 }" ng-change="handleSearch()" placeholder="{{ searchText }}" />
32
+ <input class="search-bar-input" ng-model="internal.search" ng-model-options="{ debounce: 500 }" ng-change="handleSearch()" placeholder="{{ searchText }}" />
32
33
  <div class="count" ng-if="internalList && internalList._metadata && enableLoadMore">{{ internalList.length }}/{{ internalList._metadata.count }}</div>
33
34
  <nice-icon ng-if="!internal.search" class="icon" icon="icon-search"></nice-icon>
34
35
  <nice-icon ng-if="internal.search" class="icon" icon="icon-x" ng-click="clearSearch()"></nice-icon>
@@ -16,6 +16,7 @@ angular.module('niceElements')
16
16
  'option': '?niceDropdownOption'
17
17
  },
18
18
  scope: {
19
+ niceTitle: '@',
19
20
  title: '@', // Title of the field
20
21
  model: '=', // Aka model
21
22
  list: '=', // List of options
@@ -196,15 +197,21 @@ angular.module('niceElements')
196
197
 
197
198
  // ----------------------------------- Focus input -----------------------------------
198
199
  $scope.focusInput = function () {
199
- var input = $element[0].getElementsByTagName('input')[0];
200
- if (input) {
201
- $timeout(function () {
202
- input.focus();
203
- });
204
- }
200
+ $timeout(function () {
201
+ const input = $element[0].getElementsByClassName("search-bar-input")[0];
202
+ if (input) input.focus();
203
+ });
205
204
  };
206
205
 
207
206
 
207
+ // $scope.onInputFocus = function () {
208
+ // $timeout(function () {
209
+ // const input = $element[0].getElementsByClassName("btn-dropdown")[0];
210
+ // if (input) input.focus();
211
+ // });
212
+ // }
213
+
214
+
208
215
  // ------------------- On blur -------------------
209
216
  $scope.onBlur = function () {
210
217
  $scope.close();
@@ -7,6 +7,17 @@
7
7
  position: fixed !important;
8
8
  }
9
9
 
10
+ .hidden-input {
11
+ height: 0;
12
+ width: 100%;
13
+ position: absolute;
14
+ bottom: 0;
15
+ left: 0;
16
+ padding: 0;
17
+ background: transparent;
18
+ opacity: 0;
19
+ }
20
+
10
21
  .open {
11
22
  .btn-dropdown {
12
23
  background: $nice-focus-bg !important;
@@ -240,7 +251,8 @@
240
251
  }
241
252
 
242
253
  &:active,
243
- &:focus {
254
+ &:focus,
255
+ &:focus-within {
244
256
  background: $nice-focus-bg !important;
245
257
  color: $nice-focus-color !important;
246
258
  border-color: var(--nice-border-color);
@@ -1,7 +1,7 @@
1
1
  <div class="nice-component nice-dropdown-date" ng-form="dropdownDateForm" ng-class="{ 'margin-bottom-0': noMargin, 'nice-component-inline': isInline }">
2
2
  <div class="row">
3
3
  <!------------------------- Title ------------------------->
4
- <nice-title text="title" help="help" required="required" label-width="labelWidth"></nice-title>
4
+ <nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
5
5
 
6
6
  <!------------------------- Field ------------------------->
7
7
  <div class="nice-field col-xs-12" ng-class="[
@@ -14,6 +14,7 @@ angular.module('niceElements')
14
14
  templateUrl: "src/components/nice-dropdown-date/nice-dropdown-date.html",
15
15
  scope: {
16
16
  model: '=',
17
+ niceTitle: '@',
17
18
  title: '@',
18
19
  fieldWidth: '@',
19
20
  labelWidth: '@',
@@ -24,7 +25,8 @@ angular.module('niceElements')
24
25
  mature: '@',
25
26
  help: '@',
26
27
  isInline: '=',
27
- onChange: '&?'
28
+ onChange: '&?',
29
+ required: '='
28
30
  },
29
31
  link: function ($scope) {
30
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];
@@ -45,10 +47,10 @@ angular.module('niceElements')
45
47
 
46
48
 
47
49
  // Set the years drop down from attributes or defaults
48
- var currentYear = parseInt($scope.startingYear, 10) || new Date().getFullYear();
49
- var numYears = parseInt($scope.numYears, 10) || 100;
50
- var oldestYear = currentYear - numYears;
51
- var newestYear = currentYear;
50
+ const currentYear = parseInt($scope.startingYear, 10) || new Date().getFullYear();
51
+ const numYears = parseInt($scope.numYears, 10) || 100;
52
+ const oldestYear = currentYear - numYears;
53
+ let newestYear = currentYear;
52
54
 
53
55
 
54
56
  // If mature
@@ -82,7 +84,7 @@ angular.module('niceElements')
82
84
 
83
85
  // validate that the date selected is accurate
84
86
  $scope.checkDate = function () {
85
- var date = moment($scope.dateFields.day + "." + ($scope.dateFields.month + 1) + "." + $scope.dateFields.year, "D.M.YYYY");
87
+ const date = moment($scope.dateFields.day + "." + ($scope.dateFields.month + 1) + "." + $scope.dateFields.year, "D.M.YYYY");
86
88
 
87
89
  if (date.isValid()) {
88
90
  // Format
@@ -109,14 +111,14 @@ angular.module('niceElements')
109
111
 
110
112
  // Set current date
111
113
  if (!$scope.model) {
112
- var date = moment();
114
+ const date = moment();
113
115
  $scope.dateFields.day = date.get('date');
114
116
  $scope.dateFields.month = date.get('month');
115
117
  $scope.dateFields.year = date.get('year');
116
118
  if ($scope.mature) $scope.dateFields.year -= 18;
117
119
  $scope.checkDate();
118
120
  } else {
119
- var date = moment($scope.model);
121
+ const date = moment($scope.model);
120
122
  $scope.dateFields.day = date.get('date');
121
123
  $scope.dateFields.month = date.get('month');
122
124
  $scope.dateFields.year = date.get('year');
@@ -1,7 +1,7 @@
1
1
  <div class="nice-component nice-dropdown-old" ng-class="{ 'margin-bottom-0': noMargin, 'nice-component-inline': isInline }">
2
2
  <div class="row">
3
3
  <!------------------------- Title ------------------------->
4
- <nice-title text="title" help="help" required="required" label-width="labelWidth"></nice-title>
4
+ <nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
5
5
 
6
6
  <!------------------------- Field ------------------------->
7
7
  <div class="nice-field col-xs-12" ng-class="fieldWidth ? fieldWidth : 'col-sm-8'">
@@ -13,6 +13,7 @@ angular.module('niceElements')
13
13
  restrict: 'E',
14
14
  transclude: true,
15
15
  scope: {
16
+ niceTitle: '@',
16
17
  title: '@', // Title of the field
17
18
  model: '=', // Aka model
18
19
  list: '=', // List of options
@@ -28,11 +28,13 @@ angular.module('niceElements')
28
28
  okText: '@',
29
29
  cancelText: '@',
30
30
  shortTime: '@', // default: false,
31
+ niceTitle: '@',
31
32
  title: '@', // default: ''
32
33
  noMargin: '@', // default: false, if noMargin==true then entire directive can be injected inside other divs
33
34
  fieldWidth: '@', // default: 'col-sm-8', bootstrap classes that defines width of field
34
35
  labelWidth: '@', // default: 'col-sm-4', bootstrap classes that defines width of label
35
- closed: '='
36
+ closed: '=',
37
+ required: '='
36
38
  },
37
39
  templateUrl: 'src/components/nice-dtp/nice-dtp.html',
38
40
  controller: function ($scope, $element, $attrs, gettextCatalog) {
@@ -1,7 +1,7 @@
1
1
  <ng-form class="nice-component nice-input" ng-class="{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }" name="forma">
2
2
  <div class="row">
3
3
  <!------------------------- Title ------------------------->
4
- <nice-title text="title" help="help" required="required" label-width="labelWidth"></nice-title>
4
+ <nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
5
5
 
6
6
  <!------------------------- Field ------------------------->
7
7
  <div class="nice-field col-xs-12" ng-class="fieldWidth ? fieldWidth : 'col-sm-8'">
@@ -10,6 +10,7 @@ angular.module('niceElements')
10
10
  isDisabled: '=',
11
11
  type: '@',
12
12
  title: '@?',
13
+ niceTitle: '@?',
13
14
  regex: '@?',
14
15
  regexRaw: '@?',
15
16
  regexError: '@?',
@@ -1,7 +1,7 @@
1
1
  <div class="nice-component nice-label" ng-class="{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }">
2
2
  <div class="row">
3
3
  <!------------------------- Title ------------------------->
4
- <nice-title text="title" help="help" required="required" label-width="labelWidth"></nice-title>
4
+ <nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
5
5
 
6
6
  <!------------------------- Field ------------------------->
7
7
  <div class="nice-field col-xs-12" ng-class="fieldWidth ? fieldWidth : 'col-xs-8'">
@@ -15,10 +15,12 @@ angular.module('niceElements')
15
15
  fieldWidth: '@',
16
16
  labelWidth: '@',
17
17
  value: '@',
18
+ niceTitle: '@',
18
19
  title: '@',
19
20
  noMargin: '@',
20
21
  isInline: '=',
21
- help: '@'
22
+ help: '@',
23
+ required: '='
22
24
  },
23
25
  link: function postLink(scope, element, attrs) {
24
26
  if (!attrs.fieldWidth) { attrs.fieldWidth = 'col-sm-8'; }