nice-elements 1.7.0 → 1.7.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.
@@ -35,13 +35,15 @@ angular.module('niceElements')
35
35
  isInline: '=',
36
36
  onChange: '&?'
37
37
  },
38
- controller: function($scope, $element, gettextCatalog) {
38
+ controller: function ($scope, $element, gettextCatalog) {
39
+ console.warn("[NICE ELEMENTS] nice-dropdown-old component is deprecated!");
40
+
39
41
  if (!$scope.objValue) { $scope.objValue = 'value'; }
40
42
  if (!$scope.objKey) { $scope.objKey = 'id'; }
41
43
  if (!$scope.list) { $scope.list = []; }
42
44
  if (!$scope.noOptionsText) { $scope.noOptionsText = gettextCatalog.getString("No options", null, "Nice"); }
43
- if(!$scope.addButtonFunction) { $scope.addButtonFunction = null; }
44
- if(!$scope.listenKeydown) { $scope.listenKeydown = false; }
45
+ if (!$scope.addButtonFunction) { $scope.addButtonFunction = null; }
46
+ if (!$scope.listenKeydown) { $scope.listenKeydown = false; }
45
47
  $scope.valid = $scope.formDropdown;
46
48
 
47
49
 
@@ -56,13 +58,13 @@ angular.module('niceElements')
56
58
  $scope.id = Math.random().toString(36).substring(7);
57
59
 
58
60
  $scope.isOpen = false;
59
- $scope.toggle = function(){ $scope.isOpen = !$scope.isOpen; };
60
- $scope.close = function(){ $scope.isOpen = false; };
61
- $scope.open = function(){ $scope.isOpen = true; };
61
+ $scope.toggle = function () { $scope.isOpen = !$scope.isOpen; };
62
+ $scope.close = function () { $scope.isOpen = false; };
63
+ $scope.open = function () { $scope.isOpen = true; };
62
64
 
63
65
 
64
66
  // ----------------------------------- Get filter -----------------------------------
65
- var getFilter = function(item){
67
+ var getFilter = function (item) {
66
68
  // Create filter for finding object by objValue with _.where()
67
69
  var filter = {};
68
70
  if (item.hasOwnProperty($scope.objKey))
@@ -74,13 +76,13 @@ angular.module('niceElements')
74
76
 
75
77
 
76
78
  // ----------------------------------- Set internal list -----------------------------------
77
- var _set_internal_list = function(){
79
+ var _set_internal_list = function () {
78
80
  $scope.internalList = angular.copy($scope.list);
79
81
  };
80
82
 
81
83
 
82
84
  // ----------------------------------- Add null object to internal list -----------------------------------
83
- var _add_null_object_to_internal = function(){
85
+ var _add_null_object_to_internal = function () {
84
86
  if ($scope.nullable && !$scope.multiple) {
85
87
  var nullObj = {};
86
88
  nullObj[$scope.objKey] = null;
@@ -91,7 +93,7 @@ angular.module('niceElements')
91
93
 
92
94
 
93
95
  // ----------------------------------- Get selected object -----------------------------------
94
- var _get_selected_object = function(selected){
96
+ var _get_selected_object = function (selected) {
95
97
  if (!selected) return null;
96
98
  if ($scope.selectedIsObj) {
97
99
  return selected;
@@ -102,12 +104,12 @@ angular.module('niceElements')
102
104
 
103
105
 
104
106
  // ----------------------------------- Init -----------------------------------
105
- var _set_internal_selected_one = function(selected){
107
+ var _set_internal_selected_one = function (selected) {
106
108
  var obj = {};
107
109
 
108
110
  var selectedObj = _get_selected_object(selected);
109
111
  // console.log('_set_internal_selected_one', selected, selectedObj);
110
- if(selectedObj && _.find($scope.internalList, getFilter(selected))){
112
+ if (selectedObj && _.find($scope.internalList, getFilter(selected))) {
111
113
  obj = selectedObj;
112
114
  } else {
113
115
  obj = $scope.internalList[0];
@@ -118,7 +120,7 @@ angular.module('niceElements')
118
120
 
119
121
 
120
122
  // ----------------------------------- Get selected objects -----------------------------------
121
- var _get_selected_objects = function(selected){
123
+ var _get_selected_objects = function (selected) {
122
124
  if (!selected)
123
125
  return null;
124
126
 
@@ -134,9 +136,9 @@ angular.module('niceElements')
134
136
 
135
137
 
136
138
  // ----------------------------------- Set internal selected multiple -----------------------------------
137
- var _set_internal_selected_multiple = function(item){
139
+ var _set_internal_selected_multiple = function (item) {
138
140
  var _selected_objects = _get_selected_objects(item);
139
- if (_selected_objects){
141
+ if (_selected_objects) {
140
142
  $scope.internalSelected = _selected_objects;
141
143
  _set_model($scope.internalSelected);
142
144
  } else {
@@ -147,21 +149,21 @@ angular.module('niceElements')
147
149
 
148
150
 
149
151
  // ----------------------------------- Set model -----------------------------------
150
- var _set_model = function(value){
152
+ var _set_model = function (value) {
151
153
  var _new = angular.copy($scope.model);
152
154
 
153
- if(!$scope.multiple){
154
- if (value[$scope.objKey]==null){
155
+ if (!$scope.multiple) {
156
+ if (value[$scope.objKey] == null) {
155
157
  _new = null;
156
158
  } else {
157
- if ($scope.selectedIsObj){
159
+ if ($scope.selectedIsObj) {
158
160
  _new = value;
159
161
  } else {
160
162
  _new = value[$scope.objKey];
161
163
  }
162
164
  }
163
165
  } else {
164
- if ($scope.selectedIsObj){
166
+ if ($scope.selectedIsObj) {
165
167
  _new = value;
166
168
  } else {
167
169
  _new = _.map(value, function (val) {
@@ -171,7 +173,7 @@ angular.module('niceElements')
171
173
  }
172
174
 
173
175
  // update model only if it is changed
174
- if (!_.isEqual(_new, $scope.model)){
176
+ if (!_.isEqual(_new, $scope.model)) {
175
177
  $scope.model = _new;
176
178
  if ($scope.onChange) $scope.onChange({ model: $scope.model });
177
179
  }
@@ -179,11 +181,11 @@ angular.module('niceElements')
179
181
 
180
182
 
181
183
  // ----------------------------------- Init -----------------------------------
182
- var init = function() {
184
+ var init = function () {
183
185
  _set_internal_list();
184
186
  _add_null_object_to_internal();
185
187
 
186
- if($scope.multiple && $scope.model){
188
+ if ($scope.multiple && $scope.model) {
187
189
  if ($scope.internalSelected) {
188
190
  // remove already selected but not in list - this happens when list changes from outside
189
191
  _set_internal_selected_multiple(_.filter($scope.internalSelected, function (obj) {
@@ -195,7 +197,7 @@ angular.module('niceElements')
195
197
  }
196
198
 
197
199
  // Set internalSelected
198
- if($scope.internalList && $scope.internalList.length>0){
200
+ if ($scope.internalList && $scope.internalList.length > 0) {
199
201
  $scope.emptyList = false;
200
202
 
201
203
  if ($scope.multiple) {
@@ -204,7 +206,7 @@ angular.module('niceElements')
204
206
  _set_internal_selected_one($scope.model);
205
207
  }
206
208
 
207
- if($scope.formDropdown && $scope.required){
209
+ if ($scope.formDropdown && $scope.required) {
208
210
  $scope.formDropdown.$setValidity('required', true);
209
211
  }
210
212
  } else {
@@ -215,7 +217,7 @@ angular.module('niceElements')
215
217
  sel[$scope.objValue] = $scope.noOptionsText;
216
218
  $scope.internalList = [sel];
217
219
 
218
- if($scope.formDropdown && $scope.required){
220
+ if ($scope.formDropdown && $scope.required) {
219
221
  $scope.formDropdown.$setValidity('required', false); // Form is not valid because dropdown is empty and required
220
222
  }
221
223
 
@@ -229,12 +231,12 @@ angular.module('niceElements')
229
231
 
230
232
 
231
233
  // ----------------------------------- Is Item selected -----------------------------------
232
- $scope.isItemSelected = function(item){
234
+ $scope.isItemSelected = function (item) {
233
235
  if (!$scope.internalSelected) return false;
234
236
 
235
237
  // Which item is selected
236
238
  if ($scope.multiple) {
237
- return _.where($scope.internalSelected, {'id':item.id}).length > 0;
239
+ return _.where($scope.internalSelected, { 'id': item.id }).length > 0;
238
240
  } else {
239
241
  return $scope.internalSelected[$scope.objKey] == item[$scope.objKey];
240
242
  }
@@ -242,12 +244,12 @@ angular.module('niceElements')
242
244
 
243
245
 
244
246
  // ----------------------------------- Item clicked -----------------------------------
245
- $scope.clicked = function(item){
247
+ $scope.clicked = function (item) {
246
248
  $scope.formDropdown.$setDirty();
247
- if($scope.multiple){
249
+ if ($scope.multiple) {
248
250
  // This actually toggles selection
249
251
  var _current = angular.copy($scope.internalSelected);
250
- if(!_.find(_current, getFilter(item))){
252
+ if (!_.find(_current, getFilter(item))) {
251
253
  _current.push(item);
252
254
  } else {
253
255
  _current = _.reject(_current, getFilter(item[$scope.objKey]));
@@ -262,7 +264,7 @@ angular.module('niceElements')
262
264
 
263
265
 
264
266
  // ----------------------------------- Get label -----------------------------------
265
- $scope.getLabel = function(item){
267
+ $scope.getLabel = function (item) {
266
268
  if (item) {
267
269
  return item[$scope.objValue];
268
270
  } else {
@@ -285,14 +287,14 @@ angular.module('niceElements')
285
287
  var _new_model_object = _get_selected_objects(value_new);
286
288
  }
287
289
 
288
- if (!_.isEqual(_new_model_object, $scope.internalSelected)){
290
+ if (!_.isEqual(_new_model_object, $scope.internalSelected)) {
289
291
  init();
290
292
  }
291
293
  });
292
294
 
293
295
 
294
296
  // ----------------------------------- Listen keydown -----------------------------------
295
- $scope.bindKeypress = function(){
297
+ $scope.bindKeypress = function () {
296
298
  if ($scope.listenKeydown) {
297
299
  $element.bind('keyup', function (e) {
298
300
  // bind to keypress events if dropdown list is opened
@@ -319,8 +321,8 @@ angular.module('niceElements')
319
321
  }
320
322
  };
321
323
 
322
- $scope.unbindKeypress = function(){
323
- $element.off('keyup', function (e) {});
324
+ $scope.unbindKeypress = function () {
325
+ $element.off('keyup', function (e) { });
324
326
  };
325
327
 
326
328
  }
@@ -36,6 +36,7 @@ angular.module('niceElements')
36
36
  },
37
37
  templateUrl: 'src/components/nice-dtp/nice-dtp.html',
38
38
  controller: function ($scope, $element, $attrs, gettextCatalog) {
39
+ console.warn("[NICE ELEMENTS] nice-dtp component is deprecated!");
39
40
 
40
41
  // default parameters
41
42
  var params = {
@@ -344,21 +344,25 @@ p.nice {
344
344
  }
345
345
 
346
346
  .input-group-addon {
347
- background: $nice-input-invalid !important;
347
+ // background: $nice-input-invalid !important;
348
+ // color: white !important;
348
349
  border-color: $nice-input-invalid !important;
349
- color: white;
350
+ color: $nice-input-invalid !important;
350
351
  }
351
352
  }
352
353
 
353
354
  .has-success {
355
+ outline-color: $nice-input-valid !important;
356
+
354
357
  .form-control {
355
- border-color: $nice-input-valid;
358
+ border-color: $nice-input-valid !important;
356
359
  }
357
360
 
358
361
  .input-group-addon {
359
- // background: $nice-input-valid;
360
- // border-color: $nice-input-valid;
361
- color: var(--nice-font-color);
362
+ // background: $nice-input-valid !important;
363
+ // color: white !important;
364
+ border-color: $nice-input-valid !important;
365
+ color: $nice-input-valid !important;
362
366
  }
363
367
  }
364
368