nice-elements 1.5.0 → 1.6.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 (41) hide show
  1. package/.vscode/settings.json +3 -0
  2. package/CHANGELOG.md +26 -0
  3. package/README.md +48 -1
  4. package/bower.json +1 -1
  5. package/dist/nice.js +143 -99
  6. package/dist/nice.min.js +1 -1
  7. package/dist/style.css +1385 -227
  8. package/dist/style.css.map +3 -1
  9. package/dist/style.min.css +2 -2
  10. package/package.json +1 -1
  11. package/src/components/nice-calendar/nice-calendar.html +10 -37
  12. package/src/components/nice-calendar/nice-calendar.scss +25 -24
  13. package/src/components/nice-checkbox/nice-checkbox.html +2 -2
  14. package/src/components/nice-checkbox/nice-checkbox.scss +5 -4
  15. package/src/components/nice-choice/nice-choice.html +1 -1
  16. package/src/components/nice-choice/nice-choice.scss +22 -22
  17. package/src/components/nice-date/nice-date.html +14 -34
  18. package/src/components/nice-date/nice-date.scss +41 -17
  19. package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.html +4 -34
  20. package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.scss +18 -14
  21. package/src/components/nice-dropdown/nice-dropdown.js +5 -0
  22. package/src/components/nice-dropdown/nice-dropdown.scss +5 -4
  23. package/src/components/nice-dropdown-old/nice-dropdown-old.scss +27 -26
  24. package/src/components/nice-number/nice-number.html +2 -2
  25. package/src/components/nice-number/nice-number.scss +9 -0
  26. package/src/components/nice-popup/nice-popup.js +3 -0
  27. package/src/components/nice-popup/nice-popup.scss +4 -0
  28. package/src/components/nice-quantity/nice-quantity.html +3 -10
  29. package/src/components/nice-quantity/nice-quantity.scss +17 -10
  30. package/src/components/nice-search2/nice-search2.html +2 -12
  31. package/src/components/nice-search2/nice-search2.js +34 -27
  32. package/src/components/nice-upload/nice-upload.html +4 -5
  33. package/src/components/nice-upload/nice-upload.js +73 -41
  34. package/src/components/nice-upload/nice-upload.scss +32 -13
  35. package/src/components/nice-yesno/nice-yesno.html +1 -1
  36. package/src/components/nice-yesno/nice-yesno.scss +23 -15
  37. package/src/styles/_nice-buttons.scss +337 -0
  38. package/src/styles/_nice-common.scss +84 -47
  39. package/src/styles/_nice-spacing.scss +90 -0
  40. package/src/styles/_nice.scss +2 -0
  41. package/src/styles/_variables.scss +108 -32
@@ -1,29 +1,29 @@
1
- .nice-dropdown-old{
2
- .disabled{
1
+ .nice-dropdown-old {
2
+ .disabled {
3
3
  cursor: not-allowed !important;
4
4
  }
5
5
 
6
- .open{
7
- .btn-dropdown{
6
+ .open {
7
+ .btn-dropdown {
8
8
  background: $nice-focus-bg !important;
9
- border-color: $nice-focus-border !important;
10
9
  color: $nice-focus-color !important;
11
10
  }
12
11
  }
13
12
 
14
- .btn-group{
13
+ .btn-group {
15
14
  width: 100%;
16
15
  }
17
16
 
18
- .input-group-btn{
17
+ .input-group-btn {
19
18
  padding-left: 10px;
20
- .btn{
19
+
20
+ .btn {
21
21
  border-bottom-left-radius: $nice-border-radius;
22
22
  border-top-left-radius: $nice-border-radius;
23
23
  }
24
24
  }
25
25
 
26
- .dropdown-menu{
26
+ .dropdown-menu {
27
27
  min-width: 200px;
28
28
  width: 100%;
29
29
  padding: 0;
@@ -33,8 +33,8 @@
33
33
  -webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.175);
34
34
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.175);
35
35
 
36
- li{
37
- .choice-checkbox{
36
+ li {
37
+ .choice-checkbox {
38
38
  -webkit-transition: all 0.2s;
39
39
  -moz-transition: all 0.2s;
40
40
  -ms-transition: all 0.2s;
@@ -51,24 +51,24 @@
51
51
  border-radius: 2px;
52
52
  text-align: center;
53
53
 
54
- &.selected{
54
+ &.selected {
55
55
  border-color: $nice-choice-selected-bg;
56
56
  background: $nice-choice-selected-bg;
57
57
  color: $nice-choice-selected-color;
58
58
  }
59
59
  }
60
60
 
61
- .multiple-item{
61
+ .multiple-item {
62
62
  margin-left: 35px;
63
63
  line-height: 26px;
64
64
  }
65
65
 
66
- a{
67
- padding:10px;
66
+ a {
67
+ padding: 10px;
68
68
  }
69
69
 
70
- &:hover{
71
- a{
70
+ &:hover {
71
+ a {
72
72
  background: $nice-hover-color;
73
73
  //color: white;
74
74
  }
@@ -77,13 +77,14 @@
77
77
  }
78
78
  }
79
79
 
80
- .btn-dropdown{
80
+ .btn-dropdown {
81
81
  @extend .btn-primary;
82
82
  background: $nice-dropdown-bg;
83
83
  border-color: $nice-dropdown-border;
84
84
  color: $nice-dropdown-color;
85
85
  font-weight: $nice-font-weight;
86
86
  min-height: 34px;
87
+ justify-content: flex-start;
87
88
 
88
89
  white-space: nowrap;
89
90
  text-overflow: ellipsis;
@@ -92,38 +93,38 @@
92
93
  text-align: left;
93
94
  padding-right: 25px;
94
95
 
95
- .caret{
96
+ .caret {
96
97
  position: absolute;
97
98
  top: 15px;
98
99
  right: 10px;
99
100
  color: $nice-border-color;
100
101
  }
101
102
 
102
- &:disabled{
103
+ &:disabled {
103
104
  cursor: not-allowed;
104
105
  background: $nice-dropdown-disabled-bg !important;
105
106
  border-color: $nice-dropdown-disabled-border !important;
106
107
  }
107
108
 
108
- &:hover{
109
+ &:hover {
109
110
  background: $nice-dropdown-hover-bg;
110
111
  border-color: $nice-dropdown-hover-border;
111
112
  color: $nice-dropdown-hover-color;
112
113
  }
113
114
 
114
- &:active, &:focus{
115
+ &:active,
116
+ &:focus {
115
117
  background: $nice-focus-bg !important;
116
- border-color: $nice-focus-border !important;
117
118
  color: $nice-focus-color !important;
119
+ @extend .nice-focus;
118
120
  }
119
121
  }
120
122
 
121
- .dropdown-color{
123
+ .dropdown-color {
122
124
  width: 12px;
123
125
  height: 12px;
124
126
  margin-right: 7px;
125
127
  border-radius: 3px;
126
128
  display: inline-block;
127
129
  }
128
- }
129
-
130
+ }
@@ -10,13 +10,13 @@
10
10
  <div class="nice-field col-xs-12" ng-class="fieldWidth ? fieldWidth : 'col-sm-8'">
11
11
  <div class="input-group" ng-class="{'has-warning': !disabled && niceNumberForm.$invalid && niceNumberForm.$dirty}">
12
12
  <span class="input-group-btn">
13
- <button class="btn btn-default" type="button" ng-disabled="!canSubstract" ng-click="subtract()">-</button>
13
+ <button class="btn btn-default" type="button" ng-disabled="!canSubstract" ng-click="subtract()" tabindex="-1">-</button>
14
14
  </span>
15
15
 
16
16
  <input type="number" step="{{ step }}" ng-change="inputChanged()" class="form-control" max="{{ max }}" min="{{ min }}" ng-model="model" />
17
17
 
18
18
  <span class="input-group-btn">
19
- <button class="btn btn-default" type="button" ng-disabled="!canAdd" ng-click="add()">+</button>
19
+ <button class="btn btn-default" type="button" ng-disabled="!canAdd" ng-click="add()" tabindex="-1">+</button>
20
20
  </span>
21
21
  </div>
22
22
 
@@ -1,6 +1,7 @@
1
1
  .nice-number {
2
2
  .input-group {
3
3
  .form-control {
4
+ z-index: 0;
4
5
  text-align: center;
5
6
  padding: 0;
6
7
  min-width: 30px;
@@ -9,8 +10,16 @@
9
10
  }
10
11
 
11
12
  .input-group-btn {
13
+ z-index: 1;
14
+
12
15
  .btn {
13
16
  background: $nice-addon-bg;
17
+ height: 34px;
18
+ border: 1px solid $nice-border-color;
19
+
20
+ &:focus {
21
+ outline: 0;
22
+ }
14
23
  }
15
24
  }
16
25
 
@@ -21,6 +21,7 @@ angular.module('niceElements')
21
21
  placement: '@', // Describes the preferred placement of the popper
22
22
  strategy: '@',
23
23
  showArrow: '@',
24
+ onChange: '&?',
24
25
  },
25
26
  controller: function ($scope, $element, $timeout) {
26
27
  $scope.isOpen = false;
@@ -106,11 +107,13 @@ angular.module('niceElements')
106
107
 
107
108
  $scope.close = function () {
108
109
  $scope.isOpen = false;
110
+ if ($scope.onChange) $scope.onChange($scope.isOpen);
109
111
  };
110
112
 
111
113
  $scope.open = function () {
112
114
  $scope.popper.update();
113
115
  $scope.isOpen = true;
116
+ if ($scope.onChange) $scope.onChange($scope.isOpen);
114
117
  $timeout(function () {
115
118
  $scope.popper.update();
116
119
  });
@@ -22,6 +22,10 @@
22
22
  border: 1px solid $nice-border-color;
23
23
  }
24
24
 
25
+ .nice-popup-content {
26
+ z-index: 1;
27
+ }
28
+
25
29
  .nice-popup-content[data-popper-placement^='top']>.nice-popup-arrow {
26
30
  bottom: -4px;
27
31
  }
@@ -9,17 +9,10 @@
9
9
  <!------------------------- Field ------------------------->
10
10
  <div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
11
11
  <div class="input-group">
12
- <span class="input-group-btn">
13
- <button class="btn btn-primary btn-left" ng-click="sub()" type="button" ng-disabled="isDisabled">-</button>
14
- </span>
15
-
12
+ <button class="btn btn-default btn-left" ng-click="sub()" type="button" ng-disabled="isDisabled" tabindex="-1">-</button>
16
13
  <input class="value form-control" ng-model="model" type="number" ng-change="handleChange()" ng-disabled="isDisabled" />
17
-
18
- <span class="input-group-btn">
19
- <button class="btn btn-primary btn-right" ng-click="add()" type="button" ng-disabled="isDisabled">+</button>
20
- </span>
14
+ <button class="btn btn-default btn-right" ng-click="add()" type="button" ng-disabled="isDisabled" tabindex="-1">+</button>
21
15
  </div>
22
16
  </div>
23
17
  </div>
24
- </div>
25
-
18
+ </div>
@@ -1,35 +1,42 @@
1
- .nice-quantity{
1
+ .nice-quantity {
2
2
  $nice-quantity-height: 35px;
3
3
  width: 100%;
4
4
 
5
+ .input-group {
6
+ display: flex;
7
+ }
8
+
5
9
  .btn {
6
- height: $nice-quantity-height;
7
- width: $nice-quantity-height;
8
- line-height: $nice-quantity-height - 2;
9
- padding: 0;
10
10
  border: 1px solid $nice-border-color;
11
+ border-radius: 0;
12
+
13
+ &:focus {
14
+ outline: 0 none;
15
+ }
11
16
  }
12
17
 
13
- .btn-left{
18
+ .btn-left {
14
19
  border-bottom-left-radius: $nice-border-radius;
15
20
  border-top-left-radius: $nice-border-radius;
16
- width: 45px;
21
+ border-right: 0 none;
17
22
  }
18
23
 
19
- .btn-right{
24
+ .btn-right {
20
25
  border-bottom-right-radius: $nice-border-radius;
21
26
  border-top-right-radius: $nice-border-radius;
22
- width: 45px;
27
+ border-left: 0 none;
23
28
  }
24
29
 
25
30
  input {
26
31
  text-align: center;
32
+ flex-grow: 1;
33
+
27
34
  &:focus {
28
35
  outline: 0 none;
29
36
  }
30
37
  }
31
38
 
32
- .value{
39
+ .value {
33
40
  line-height: $nice-quantity-height - 2;
34
41
  padding: 0px 10px;
35
42
  text-align: center;
@@ -9,17 +9,7 @@
9
9
  <!------------------------- Field ------------------------->
10
10
  <div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]" click-outside="close()">
11
11
  <div class="nice-search-button input-group" ng-class="{ 'disabled': isDisabled, 'has-warning': !isDisabled && form.$invalid && form.$dirty, 'has-success': !isDisabled && form.$valid && form.$dirty}">
12
- <input
13
- class="form-control"
14
- type="text"
15
- id="{{ id }}"
16
- ng-model="model"
17
- placeholder="{{ placeholder }}"
18
- ng-disabled="isDisabled"
19
- ng-change="updateSearch()"
20
- ng-focus="onFocus()"
21
- tabindex="{{ tabIndex }}"
22
- >
12
+ <input class="form-control" type="text" id="{{ id }}" ng-model="model" placeholder="{{ placeholder }}" ng-disabled="isDisabled" ng-change="updateSearch()" ng-focus="onFocus()" tabindex="{{ tabIndex }}">
23
13
 
24
14
  <span class="input-group-addon clickable" ng-click="onFocus()">
25
15
  <i ng-show="!loading" class="fa fa-search"></i>
@@ -41,5 +31,5 @@
41
31
  </div>
42
32
  </div>
43
33
  </div>
44
- </div>
34
+ </div>
45
35
  </ng-form>
@@ -30,7 +30,7 @@ angular.module('niceElements')
30
30
  isInline: '=',
31
31
  help: '@'
32
32
  },
33
- controller: function($scope, $timeout, $element) {
33
+ controller: function ($scope, $timeout, $element) {
34
34
  $scope.loading = false;
35
35
  $scope.isOpen = false;
36
36
  $scope.debounce = null;
@@ -44,7 +44,7 @@ angular.module('niceElements')
44
44
 
45
45
  // Setup popper
46
46
  // https://popper.js.org/docs/v2/constructors/
47
- $scope.setupPopper = function() {
47
+ $scope.setupPopper = function () {
48
48
  var button = $element[0].getElementsByClassName('nice-search-button')[0];
49
49
  var tooltip = $element[0].getElementsByClassName('nice-search-dropdown-wrapper')[0];
50
50
  $scope.popper = Popper.createPopper(button, tooltip, {
@@ -62,13 +62,13 @@ angular.module('niceElements')
62
62
  enabled: true,
63
63
  phase: "beforeWrite",
64
64
  requires: ["computeStyles"],
65
- fn: function(e) {
65
+ fn: function (e) {
66
66
  var state = e.state;
67
67
  state.styles.popper.width = state.rects.reference.width + "px";
68
68
  },
69
- effect: function(e) {
69
+ effect: function (e) {
70
70
  var state = e.state;
71
- state.elements.popper.style.width = state.elements.reference.offsetWidth + "px";
71
+ state.elements.popper.style.width = state.elements.reference.offsetWidth + "px";
72
72
  }
73
73
  }
74
74
  ],
@@ -77,10 +77,11 @@ angular.module('niceElements')
77
77
 
78
78
  $timeout(function () {
79
79
  $scope.setupPopper();
80
- })
81
-
80
+ });
81
+
82
+
82
83
  // ------------------- On focus -------------------
83
- $scope.onFocus = function() {
84
+ $scope.onFocus = function () {
84
85
  if ($scope.showDropdown && $scope.results.length == 0) {
85
86
  $scope.getData($scope.model);
86
87
  }
@@ -92,23 +93,29 @@ angular.module('niceElements')
92
93
  };
93
94
 
94
95
 
96
+ // ------------------- On blur -------------------
97
+ $scope.onBlur = function () {
98
+ $scope.close();
99
+ };
100
+
101
+
95
102
  // ------------------- On focus -------------------
96
- $scope.open = function() {
103
+ $scope.open = function () {
97
104
  $scope.isOpen = true;
98
- $timeout(function() {
105
+ $timeout(function () {
99
106
  if ($scope.popper) $scope.popper.update();
100
107
  });
101
108
  };
102
109
 
103
110
 
104
111
  // ------------------- On blur -------------------
105
- $scope.close = function() {
112
+ $scope.close = function () {
106
113
  $scope.isOpen = false;
107
114
 
108
115
  var input = $element[0].getElementsByTagName('input')[0];
109
116
  if (input) input.blur();
110
117
 
111
- $timeout(function() {
118
+ $timeout(function () {
112
119
  $scope.popper.update();
113
120
  })
114
121
  };
@@ -120,7 +127,7 @@ angular.module('niceElements')
120
127
  $timeout.cancel($scope.debounce);
121
128
  }
122
129
 
123
- $scope.debounce = $timeout(function() {
130
+ $scope.debounce = $timeout(function () {
124
131
  if ($scope.onChange) $scope.onChange({ model: $scope.model });
125
132
  $scope.getData($scope.model);
126
133
  }, $scope.debounceTime);
@@ -128,14 +135,14 @@ angular.module('niceElements')
128
135
 
129
136
 
130
137
  // ------------------- Get data -------------------
131
- $scope.getData = function(keywords) {
138
+ $scope.getData = function (keywords) {
132
139
  if ($scope.refreshFunction != null) {
133
140
  $scope.loading = true;
134
141
  $scope.requestNumber += 1;
135
142
  var requestNumber = angular.copy($scope.requestNumber);
136
- $scope.refreshFunction(keywords).then(function(results) {
137
- if ($scope.requestNumber == requestNumber) {
138
- $timeout(function() {
143
+ $scope.refreshFunction(keywords).then(function (results) {
144
+ if ($scope.requestNumber == requestNumber) {
145
+ $timeout(function () {
139
146
  $scope.open();
140
147
  $scope.loading = false;
141
148
 
@@ -147,7 +154,7 @@ angular.module('niceElements')
147
154
  }
148
155
  });
149
156
  }
150
- }, function(error) {
157
+ }, function (error) {
151
158
  $scope.loading = false;
152
159
  $scope.close();
153
160
  });
@@ -159,7 +166,7 @@ angular.module('niceElements')
159
166
 
160
167
 
161
168
  // ------------------------ If search button is clicked set focus or make request ------------------------
162
- $scope.search = function() {
169
+ $scope.search = function () {
163
170
  if (!$scope.isDisabled) {
164
171
  if ($scope.showDropdown) {
165
172
  $scope.updateSearch();
@@ -186,7 +193,7 @@ angular.module('niceElements')
186
193
 
187
194
 
188
195
  // ----------------------------------- Scroll to hover -----------------------------------
189
- $scope.scrollToHover = function(notSmooth) {
196
+ $scope.scrollToHover = function (notSmooth) {
190
197
  var dropdownMenu = $element[0].getElementsByClassName("nice-dropdown")[0];
191
198
  var hoverItem = dropdownMenu.getElementsByClassName("active")[0];
192
199
  if (hoverItem) {
@@ -205,10 +212,10 @@ angular.module('niceElements')
205
212
  // Arrow Up
206
213
  if (event.keyCode == 38) {
207
214
  event.preventDefault();
208
- $timeout(function() {
209
- if ( $scope.selectedIndex > 0) {
215
+ $timeout(function () {
216
+ if ($scope.selectedIndex > 0) {
210
217
  $scope.selectedIndex -= 1;
211
- $timeout(function() {
218
+ $timeout(function () {
212
219
  $scope.scrollToHover();
213
220
  });
214
221
  }
@@ -218,10 +225,10 @@ angular.module('niceElements')
218
225
  // Arrow Down
219
226
  if (event.keyCode == 40) {
220
227
  event.preventDefault();
221
- $timeout(function() {
228
+ $timeout(function () {
222
229
  if ($scope.results && $scope.selectedIndex < $scope.results.length - 1) {
223
230
  $scope.selectedIndex += 1;
224
- $timeout(function() {
231
+ $timeout(function () {
225
232
  $scope.scrollToHover();
226
233
  });
227
234
  }
@@ -231,14 +238,14 @@ angular.module('niceElements')
231
238
  // Enter
232
239
  if (event.keyCode == 13) {
233
240
  event.preventDefault();
234
- $timeout(function() {
241
+ $timeout(function () {
235
242
  $scope.selectItem($scope.results[$scope.selectedIndex], $scope.selectedIndex);
236
243
  });
237
244
  }
238
245
 
239
246
  // Escape
240
247
  if (event.keyCode == 27) {
241
- $timeout(function() {
248
+ $timeout(function () {
242
249
  $scope.close();
243
250
  });
244
251
  }
@@ -9,15 +9,14 @@
9
9
  <!------------------------- Field ------------------------->
10
10
  <div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
11
11
  <input class="input-file" type="file" accept="{{ accept }}" ng-model="file" ng-disabled="isDisabled" />
12
- <div class="input-area">
12
+ <div class="input-area" ng-class="{ 'dragging': dragging || draggingGlobal }">
13
13
  <div class="middle-text" ng-if="!imageSource && !loading">
14
- <div class="text">{{ text }}</div>
14
+ <div class="text text-placeholder" ng-if="!dragging">{{ text }}</div>
15
+ <div class="text text-placeholder" ng-if="dragging" translate translate-group="Nice">Drop file here</div>
15
16
  <div class="error" ng-if="error">{{ error }}</div>
16
17
  </div>
17
18
  <img ng-if="imageSource" data-ng-src="{{ imageSource }}" />
18
- </div>
19
- <div class="loading" ng-if="loading">
20
- <nice-loader></nice-loader>
19
+ <nice-loader fulldiv="true" ng-if="loading"></nice-loader>
21
20
  </div>
22
21
  </div>
23
22
  </div>