nice-elements 1.7.0 → 1.7.2
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.
- package/CHANGELOG.md +15 -0
- package/README.md +2 -1
- package/bower.json +1 -1
- package/dist/nice.js +76 -58
- package/dist/nice.min.js +1 -1
- package/dist/style.css +25 -10
- package/dist/style.css.map +1 -1
- package/dist/style.min.css +2 -2
- package/package.json +1 -1
- package/src/components/nice-calendar/nice-calendar.scss +0 -2
- package/src/components/nice-date/nice-date.html +2 -4
- package/src/components/nice-date/nice-date.js +1 -1
- package/src/components/nice-date-input/nice-date-input.html +6 -6
- package/src/components/nice-date-input/nice-date-input.js +22 -9
- package/src/components/nice-date-input/nice-date-input.scss +2 -0
- package/src/components/nice-datetime-picker/nice-datetime-picker.scss +1 -1
- package/src/components/nice-dropdown/nice-dropdown.scss +1 -0
- package/src/components/nice-dropdown-old/nice-dropdown-old.js +38 -36
- package/src/components/nice-dtp/nice-dtp.js +1 -0
- package/src/filters/nice-date.js +5 -2
- package/src/filters/nice-highlight.js +1 -0
- package/src/styles/_nice-buttons.scss +9 -3
- package/src/styles/_nice-common.scss +14 -6
|
@@ -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 = {
|
package/src/filters/nice-date.js
CHANGED
|
@@ -7,9 +7,12 @@
|
|
|
7
7
|
* Filter in the niceElements.
|
|
8
8
|
*/
|
|
9
9
|
angular.module('niceElements').filter('niceDate', function () {
|
|
10
|
-
return function(object,
|
|
10
|
+
return function (object, addTime, addSeconds) {
|
|
11
11
|
var formatString = "D.M.YYYY";
|
|
12
|
-
if (
|
|
12
|
+
if (addTime) {
|
|
13
|
+
formatString = "D.M.YYYY • H:mm";
|
|
14
|
+
if (addSeconds) formatString += ":ss";
|
|
15
|
+
}
|
|
13
16
|
return moment(object).format(formatString);
|
|
14
17
|
};
|
|
15
18
|
});
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
angular.module('niceElements').filter('niceHighlight', function () {
|
|
10
10
|
return function (value, highlightedText) {
|
|
11
|
+
if (!value) return "";
|
|
11
12
|
var regex = new RegExp(highlightedText, 'gmi');
|
|
12
13
|
var newValue = String(value).replace(regex, "<span class='nice-highligh'>$&</span>");
|
|
13
14
|
return newValue;
|
|
@@ -31,12 +31,18 @@
|
|
|
31
31
|
flex-shrink: 0;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
// Icon padding
|
|
35
|
+
svg+translate,
|
|
35
36
|
svg+span,
|
|
36
|
-
|
|
37
|
+
translate+svg,
|
|
37
38
|
span+svg,
|
|
39
|
+
nice-icon+translate,
|
|
40
|
+
nice-icon+span,
|
|
41
|
+
translate+nice-icon,
|
|
38
42
|
span+nice-icon,
|
|
39
|
-
span+i
|
|
43
|
+
span+i,
|
|
44
|
+
translate+i i+span,
|
|
45
|
+
i+translate {
|
|
40
46
|
margin-left: 0.5rem;
|
|
41
47
|
}
|
|
42
48
|
|
|
@@ -55,6 +55,10 @@ label.nice {
|
|
|
55
55
|
outline: 0 none;
|
|
56
56
|
border-color: var(--nice-border-color) !important;
|
|
57
57
|
}
|
|
58
|
+
|
|
59
|
+
.input-group-addon {
|
|
60
|
+
border-color: var(--nice-border-color) !important;
|
|
61
|
+
}
|
|
58
62
|
}
|
|
59
63
|
}
|
|
60
64
|
|
|
@@ -344,21 +348,25 @@ p.nice {
|
|
|
344
348
|
}
|
|
345
349
|
|
|
346
350
|
.input-group-addon {
|
|
347
|
-
background: $nice-input-invalid !important;
|
|
351
|
+
// background: $nice-input-invalid !important;
|
|
352
|
+
// color: white !important;
|
|
348
353
|
border-color: $nice-input-invalid !important;
|
|
349
|
-
color:
|
|
354
|
+
color: $nice-input-invalid !important;
|
|
350
355
|
}
|
|
351
356
|
}
|
|
352
357
|
|
|
353
358
|
.has-success {
|
|
359
|
+
outline-color: $nice-input-valid !important;
|
|
360
|
+
|
|
354
361
|
.form-control {
|
|
355
|
-
border-color: $nice-input-valid;
|
|
362
|
+
border-color: $nice-input-valid !important;
|
|
356
363
|
}
|
|
357
364
|
|
|
358
365
|
.input-group-addon {
|
|
359
|
-
// background: $nice-input-valid;
|
|
360
|
-
//
|
|
361
|
-
color:
|
|
366
|
+
// background: $nice-input-valid !important;
|
|
367
|
+
// color: white !important;
|
|
368
|
+
border-color: $nice-input-valid !important;
|
|
369
|
+
color: $nice-input-valid !important;
|
|
362
370
|
}
|
|
363
371
|
}
|
|
364
372
|
|