nice-elements 1.12.9 → 1.12.11
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/.vscode/settings.json +18 -18
- package/CHANGELOG.md +585 -573
- package/LICENSE.md +21 -21
- package/README.md +102 -102
- package/bower.json +17 -17
- package/dist/nice.js +9187 -11517
- package/dist/nice.min.js +1 -1
- package/dist/style.css +12 -12
- package/dist/style.css.map +1 -1
- package/dist/style.min.css +8 -8
- package/eslint.config.mjs +32 -32
- package/package.json +44 -44
- package/src/components/nice-alert/nice-alert.html +6 -6
- package/src/components/nice-alert/nice-alert.js +29 -29
- package/src/components/nice-alert/nice-alert.scss +59 -59
- package/src/components/nice-avatar/nice-avatar.js +122 -122
- package/src/components/nice-avatar/nice-avatar.scss +4 -4
- package/src/components/nice-button/nice-button.html +4 -4
- package/src/components/nice-button/nice-button.js +41 -41
- package/src/components/nice-button/nice-button.scss +16 -16
- package/src/components/nice-button-toggle/nice-button-toggle.html +9 -9
- package/src/components/nice-button-toggle/nice-button-toggle.js +23 -23
- package/src/components/nice-button-toggle/nice-button-toggle.scss +2 -2
- package/src/components/nice-calendar/nice-calendar.html +91 -91
- package/src/components/nice-calendar/nice-calendar.js +346 -346
- package/src/components/nice-calendar/nice-calendar.scss +288 -288
- package/src/components/nice-checkbox/nice-checkbox.html +20 -9
- package/src/components/nice-checkbox/nice-checkbox.js +38 -37
- package/src/components/nice-checkbox/nice-checkbox.scss +120 -120
- package/src/components/nice-choice/nice-choice.html +18 -18
- package/src/components/nice-choice/nice-choice.js +211 -211
- package/src/components/nice-choice/nice-choice.scss +110 -110
- package/src/components/nice-comment/nice-comment.html +10 -10
- package/src/components/nice-comment/nice-comment.js +71 -71
- package/src/components/nice-comment/nice-comment.scss +39 -39
- package/src/components/nice-date/nice-date.html +82 -82
- package/src/components/nice-date/nice-date.js +350 -350
- package/src/components/nice-date/nice-date.scss +305 -305
- package/src/components/nice-date-input/nice-date-input.html +56 -56
- package/src/components/nice-date-input/nice-date-input.js +143 -143
- package/src/components/nice-date-input/nice-date-input.scss +55 -55
- package/src/components/nice-date-range/nice-date-range.html +15 -15
- package/src/components/nice-date-range/nice-date-range.js +78 -78
- package/src/components/nice-date-range/nice-date-range.scss +390 -390
- package/src/components/nice-datetime-picker/nice-datetime-picker.html +29 -29
- package/src/components/nice-datetime-picker/nice-datetime-picker.js +89 -89
- package/src/components/nice-datetime-picker/nice-datetime-picker.scss +428 -428
- package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.html +55 -55
- package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.js +248 -248
- package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.scss +73 -73
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.html +44 -44
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.js +175 -175
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.scss +127 -127
- package/src/components/nice-dropdown/nice-dropdown.html +61 -61
- package/src/components/nice-dropdown/nice-dropdown.js +517 -517
- package/src/components/nice-dropdown/nice-dropdown.scss +262 -262
- package/src/components/nice-dropdown-date/nice-dropdown-date.html +28 -28
- package/src/components/nice-dropdown-date/nice-dropdown-date.js +132 -132
- package/src/components/nice-dropdown-date/nice-dropdown-date.scss +87 -87
- package/src/components/nice-dropdown-old/nice-dropdown-old.html +44 -44
- package/src/components/nice-dropdown-old/nice-dropdown-old.js +330 -330
- package/src/components/nice-dropdown-old/nice-dropdown-old.scss +129 -129
- package/src/components/nice-dtp/nice-dtp.html +91 -91
- package/src/components/nice-dtp/nice-dtp.js +835 -835
- package/src/components/nice-help/nice-help.html +6 -6
- package/src/components/nice-help/nice-help.js +58 -58
- package/src/components/nice-help/nice-help.scss +78 -78
- package/src/components/nice-input/nice-input.html +47 -47
- package/src/components/nice-input/nice-input.js +251 -251
- package/src/components/nice-input/nice-input.scss +130 -130
- package/src/components/nice-label/nice-label.html +10 -10
- package/src/components/nice-label/nice-label.js +32 -32
- package/src/components/nice-loader/nice-loader.html +6 -6
- package/src/components/nice-loader/nice-loader.js +28 -28
- package/src/components/nice-loader/nice-loader.scss +47 -47
- package/src/components/nice-no-data/nice-no-data.html +3 -3
- package/src/components/nice-no-data/nice-no-data.js +27 -27
- package/src/components/nice-no-data/nice-no-data.scss +26 -26
- package/src/components/nice-notification/nice-notification.html +3 -3
- package/src/components/nice-notification/nice-notification.js +124 -124
- package/src/components/nice-notification/nice-notification.scss +66 -66
- package/src/components/nice-number/nice-number.html +40 -40
- package/src/components/nice-number/nice-number.js +172 -172
- package/src/components/nice-number/nice-number.scss +18 -18
- package/src/components/nice-on-scroll/nice-on-scroll.js +17 -17
- package/src/components/nice-percent/nice-percent.html +24 -24
- package/src/components/nice-percent/nice-percent.js +95 -95
- package/src/components/nice-pill/nice-pill.html +3 -3
- package/src/components/nice-pill/nice-pill.js +29 -29
- package/src/components/nice-pill/nice-pill.scss +25 -25
- package/src/components/nice-popup/nice-popup.html +6 -6
- package/src/components/nice-popup/nice-popup.js +122 -122
- package/src/components/nice-popup/nice-popup.scss +43 -43
- package/src/components/nice-progress-bar/nice-progress-bar.html +15 -15
- package/src/components/nice-progress-bar/nice-progress-bar.js +55 -55
- package/src/components/nice-progress-bar/nice-progress-bar.scss +47 -47
- package/src/components/nice-quantity/nice-quantity.html +22 -22
- package/src/components/nice-quantity/nice-quantity.js +57 -57
- package/src/components/nice-quantity/nice-quantity.scss +51 -51
- package/src/components/nice-search/nice-search.html +44 -44
- package/src/components/nice-search/nice-search.js +243 -243
- package/src/components/nice-search/nice-search.scss +90 -90
- package/src/components/nice-search2/nice-search2.html +32 -32
- package/src/components/nice-search2/nice-search2.js +267 -267
- package/src/components/nice-search2/nice-search2.scss +80 -80
- package/src/components/nice-slot/nice-slot.html +10 -10
- package/src/components/nice-slot/nice-slot.js +31 -31
- package/src/components/nice-steps/nice-steps.scss +81 -81
- package/src/components/nice-svgs/nice-svgs.html +1332 -1320
- package/src/components/nice-svgs/nice-svgs.js +19 -19
- package/src/components/nice-table/nice-table.html +38 -38
- package/src/components/nice-table/nice-table.js +60 -60
- package/src/components/nice-table/nice-table.scss +112 -112
- package/src/components/nice-time-picker/nice-time-picker.html +43 -43
- package/src/components/nice-time-picker/nice-time-picker.js +85 -85
- package/src/components/nice-time-picker/nice-time-picker.scss +37 -37
- package/src/components/nice-title/nice-title.html +6 -6
- package/src/components/nice-title/nice-title.js +22 -22
- package/src/components/nice-toast/nice-toast.html +2 -2
- package/src/components/nice-toast/nice-toast.js +56 -56
- package/src/components/nice-toast/nice-toast.scss +74 -74
- package/src/components/nice-toggle/nice-toggle.html +12 -12
- package/src/components/nice-toggle/nice-toggle.js +57 -57
- package/src/components/nice-toggle/nice-toggle.scss +131 -131
- package/src/components/nice-upload/nice-upload.html +22 -22
- package/src/components/nice-upload/nice-upload.js +160 -159
- package/src/components/nice-upload/nice-upload.scss +85 -85
- package/src/components/nice-view/_nice-view.scss +63 -63
- package/src/components/nice-view/nice-view.html +12 -12
- package/src/components/nice-view/nice-view.js +29 -30
- package/src/components/nice-virtual-scroll/_nice-virtual-scroll.scss +17 -17
- package/src/components/nice-virtual-scroll/nice-virtual-scroll.html +12 -12
- package/src/components/nice-virtual-scroll/nice-virtual-scroll.js +70 -70
- package/src/components/nice-wrapper/_nice-wrapper.scss +87 -87
- package/src/components/nice-wrapper/nice-wrapper.html +12 -12
- package/src/components/nice-wrapper/nice-wrapper.js +44 -44
- package/src/components/nice-yesno/nice-yesno.html +14 -14
- package/src/components/nice-yesno/nice-yesno.js +111 -111
- package/src/components/nice-yesno/nice-yesno.scss +95 -95
- package/src/directives/nice-click-outside.js +105 -105
- package/src/directives/nice-infinite-loader.js +27 -27
- package/src/directives/nice-tooltip/_nice-tooltip.scss +55 -55
- package/src/directives/nice-tooltip/nice-tooltip.js +84 -84
- package/src/filters/nice-date.js +17 -17
- package/src/filters/nice-highlight.js +16 -16
- package/src/modals/nice-multilangual-modal/nice-multilangual-modal.html +30 -30
- package/src/modals/nice-multilangual-modal/nice-multilangual-modal.js +67 -67
- package/src/modals/nice-multilangual-modal/nice-multilangual-modal.scss +19 -19
- package/src/nice.js +2 -2
- package/src/services/nice-service.js +22 -22
- package/src/styles/_bootstrap-variables.scss +178 -178
- package/src/styles/_nice-buttons.scss +612 -612
- package/src/styles/_nice-common.scss +479 -479
- package/src/styles/_nice-ngdialog.scss +85 -85
- package/src/styles/_nice-spacing.scss +283 -283
- package/src/styles/_nice.scss +75 -75
- package/src/styles/_variables.scss +194 -194
|
@@ -1,211 +1,211 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @ngdoc directive
|
|
5
|
-
* @name niceElements.directive:niceChoice
|
|
6
|
-
* @description
|
|
7
|
-
* # niceChoice
|
|
8
|
-
*/
|
|
9
|
-
angular.module('niceElements')
|
|
10
|
-
.directive('niceChoice', function () {
|
|
11
|
-
return {
|
|
12
|
-
transclude: true,
|
|
13
|
-
templateUrl: 'src/components/nice-choice/nice-choice.html',
|
|
14
|
-
restrict: 'E',
|
|
15
|
-
scope: {
|
|
16
|
-
niceTitle: '@',
|
|
17
|
-
title: '@',
|
|
18
|
-
model: '=',
|
|
19
|
-
list: '=',
|
|
20
|
-
isDisabled: '=',
|
|
21
|
-
fieldWidth: '@',
|
|
22
|
-
labelWidth: '@',
|
|
23
|
-
listIsObj: '=?',
|
|
24
|
-
selectedIsObj: '=?',
|
|
25
|
-
objValue: '@',
|
|
26
|
-
objKey: '@',
|
|
27
|
-
noMargin: '=?',
|
|
28
|
-
multiple: '=?',
|
|
29
|
-
help: '@',
|
|
30
|
-
isInline: '=?',
|
|
31
|
-
onChange: '&?'
|
|
32
|
-
},
|
|
33
|
-
controller: function ($attrs, $scope) {
|
|
34
|
-
if (!$attrs.title) { $attrs.title = ''; }
|
|
35
|
-
if (!$attrs.fieldWidth) { $attrs.fieldWidth = 'col-sm-8'; }
|
|
36
|
-
if (!$attrs.labelWidth) { $attrs.labelWidth = 'col-sm-4'; }
|
|
37
|
-
if (!$attrs.objValue) { $attrs.objValue = 'value'; }
|
|
38
|
-
if (!$attrs.objKey) { $attrs.objKey = 'id'; }
|
|
39
|
-
$scope.multiple = $scope.multiple === 'true' || $scope.multiple === true;
|
|
40
|
-
$scope.selectedIsObj = $scope.selectedIsObj === 'true' || $scope.selectedIsObj === true;
|
|
41
|
-
$scope.listIsObj = $scope.listIsObj === 'true' || $scope.listIsObj === true;
|
|
42
|
-
|
|
43
|
-
$scope.firstTime = true;
|
|
44
|
-
$scope.checkIfFirstTime = function () {
|
|
45
|
-
if ($scope.firstTime) {
|
|
46
|
-
$scope.firstTime = false;
|
|
47
|
-
return true;
|
|
48
|
-
} else {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// If selected is not yet defined
|
|
54
|
-
if (!angular.isDefined($scope.model)) {
|
|
55
|
-
if ($scope.multiple) {
|
|
56
|
-
$scope.model = [];
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Set internalList
|
|
61
|
-
if ($scope.listIsObj) {
|
|
62
|
-
$scope.internalList = $scope.list;
|
|
63
|
-
} else {
|
|
64
|
-
$scope.internalList = _.map($scope.list, function (val) {
|
|
65
|
-
const obj = {};
|
|
66
|
-
obj[$scope.objKey] = val;
|
|
67
|
-
obj[$scope.objValue] = val;
|
|
68
|
-
return obj;
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Set internalSelected
|
|
73
|
-
if ($scope.selectedIsObj) {
|
|
74
|
-
$scope.internalSelected = $scope.model;
|
|
75
|
-
} else {
|
|
76
|
-
if ($scope.multiple) {
|
|
77
|
-
$scope.internalSelected = _.map($scope.model, function (val) {
|
|
78
|
-
const obj = {};
|
|
79
|
-
obj[$scope.objKey] = val;
|
|
80
|
-
obj[$scope.objValue] = val;
|
|
81
|
-
return obj;
|
|
82
|
-
});
|
|
83
|
-
} else {
|
|
84
|
-
if ($scope.model) {
|
|
85
|
-
const obj = {};
|
|
86
|
-
obj[$scope.objKey] = $scope.model;
|
|
87
|
-
obj[$scope.objValue] = $scope.model;
|
|
88
|
-
$scope.internalSelected = obj;
|
|
89
|
-
} else {
|
|
90
|
-
$scope.internalSelected = $scope.internalList[0];
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const getFilter = function (item) {
|
|
96
|
-
// Create filter for finding object by objValue with _.where()
|
|
97
|
-
const filter = {};
|
|
98
|
-
if (item.hasOwnProperty($scope.objKey))
|
|
99
|
-
filter[$scope.objKey] = item[$scope.objKey];
|
|
100
|
-
else
|
|
101
|
-
filter[$scope.objKey] = item;
|
|
102
|
-
return filter;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
$scope.itemHover = function (event, item) {
|
|
106
|
-
if ($scope.isDisabled) return;
|
|
107
|
-
if (event.buttons == 1 && $scope.multiple) {
|
|
108
|
-
$scope.toggle(item);
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
$scope.setDefault = function () {
|
|
113
|
-
if (!$scope.multiple) {
|
|
114
|
-
$scope.internalSelected = $scope.internalList[0];
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
$scope.isItemSelected = function (item) {
|
|
119
|
-
if (!$scope.internalSelected)
|
|
120
|
-
return false;
|
|
121
|
-
// Which item is selected
|
|
122
|
-
if ($scope.multiple) {
|
|
123
|
-
return _.where($scope.internalSelected, getFilter(item)).length > 0;
|
|
124
|
-
} else {
|
|
125
|
-
return $scope.internalSelected[$scope.objKey] == item[$scope.objKey];
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
$scope.toggle = function (item) {
|
|
130
|
-
if ($scope.isDisabled) return;
|
|
131
|
-
$scope.formChoice.$setDirty();
|
|
132
|
-
|
|
133
|
-
if (!$scope.multiple) {
|
|
134
|
-
$scope.internalSelected = item;
|
|
135
|
-
} else {
|
|
136
|
-
if ($scope.isItemSelected(item)) {
|
|
137
|
-
$scope.internalSelected = _.without($scope.internalSelected, _.findWhere($scope.internalSelected, getFilter(item)));
|
|
138
|
-
} else {
|
|
139
|
-
$scope.internalSelected.push(item);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
$scope.getLabel = function (item) {
|
|
145
|
-
return item[$scope.objValue];
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
$scope.$watchCollection('list', function (value_new, value_old) {
|
|
149
|
-
// Set internalList
|
|
150
|
-
if ($scope.listIsObj) {
|
|
151
|
-
$scope.internalList = $scope.list;
|
|
152
|
-
} else {
|
|
153
|
-
$scope.internalList = _.map($scope.list, function (val) {
|
|
154
|
-
const obj = {};
|
|
155
|
-
obj[$scope.objKey] = val;
|
|
156
|
-
obj[$scope.objValue] = val;
|
|
157
|
-
return obj;
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
$scope.$watchCollection('internalSelected', function (value_new, value_old) {
|
|
163
|
-
// Update $scope.selected based on settings
|
|
164
|
-
if (value_new && (!angular.equals(value_new, value_old) || $scope.checkIfFirstTime())) {
|
|
165
|
-
if ($scope.selectedIsObj) {
|
|
166
|
-
$scope.model = value_new;
|
|
167
|
-
} else {
|
|
168
|
-
if ($scope.multiple) {
|
|
169
|
-
$scope.model = _.map(value_new, $scope.objKey);
|
|
170
|
-
} else {
|
|
171
|
-
$scope.model = value_new[$scope.objKey];
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
$scope.$watchCollection('model', function (value_new, value_old) {
|
|
179
|
-
if (!angular.equals(value_new, value_old)) {
|
|
180
|
-
if (!value_new) {
|
|
181
|
-
if (!$scope.multiple)
|
|
182
|
-
$scope.internalSelected = $scope.internalList[0];
|
|
183
|
-
else
|
|
184
|
-
$scope.internalSelected = [];
|
|
185
|
-
} else {
|
|
186
|
-
// Update $scope.internalSelected based on updated parent scope value $scope.selected and settings
|
|
187
|
-
if ($scope.selectedIsObj) {
|
|
188
|
-
$scope.internalSelected = value_new;
|
|
189
|
-
|
|
190
|
-
} else {
|
|
191
|
-
if ($scope.multiple) {
|
|
192
|
-
$scope.internalSelected = _.map(value_new, function (item) {
|
|
193
|
-
return _.find($scope.internalList, getFilter(item));
|
|
194
|
-
});
|
|
195
|
-
} else {
|
|
196
|
-
$scope.internalSelected = _.find($scope.internalList, getFilter(value_new));
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
if (!value_new) {
|
|
203
|
-
if (!$scope.multiple) {
|
|
204
|
-
$scope.internalSelected = $scope.internalList[0];
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
});
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @ngdoc directive
|
|
5
|
+
* @name niceElements.directive:niceChoice
|
|
6
|
+
* @description
|
|
7
|
+
* # niceChoice
|
|
8
|
+
*/
|
|
9
|
+
angular.module('niceElements')
|
|
10
|
+
.directive('niceChoice', function () {
|
|
11
|
+
return {
|
|
12
|
+
transclude: true,
|
|
13
|
+
templateUrl: 'src/components/nice-choice/nice-choice.html',
|
|
14
|
+
restrict: 'E',
|
|
15
|
+
scope: {
|
|
16
|
+
niceTitle: '@',
|
|
17
|
+
title: '@',
|
|
18
|
+
model: '=',
|
|
19
|
+
list: '=',
|
|
20
|
+
isDisabled: '=',
|
|
21
|
+
fieldWidth: '@',
|
|
22
|
+
labelWidth: '@',
|
|
23
|
+
listIsObj: '=?',
|
|
24
|
+
selectedIsObj: '=?',
|
|
25
|
+
objValue: '@',
|
|
26
|
+
objKey: '@',
|
|
27
|
+
noMargin: '=?',
|
|
28
|
+
multiple: '=?',
|
|
29
|
+
help: '@',
|
|
30
|
+
isInline: '=?',
|
|
31
|
+
onChange: '&?'
|
|
32
|
+
},
|
|
33
|
+
controller: function ($attrs, $scope) {
|
|
34
|
+
if (!$attrs.title) { $attrs.title = ''; }
|
|
35
|
+
if (!$attrs.fieldWidth) { $attrs.fieldWidth = 'col-sm-8'; }
|
|
36
|
+
if (!$attrs.labelWidth) { $attrs.labelWidth = 'col-sm-4'; }
|
|
37
|
+
if (!$attrs.objValue) { $attrs.objValue = 'value'; }
|
|
38
|
+
if (!$attrs.objKey) { $attrs.objKey = 'id'; }
|
|
39
|
+
$scope.multiple = $scope.multiple === 'true' || $scope.multiple === true;
|
|
40
|
+
$scope.selectedIsObj = $scope.selectedIsObj === 'true' || $scope.selectedIsObj === true;
|
|
41
|
+
$scope.listIsObj = $scope.listIsObj === 'true' || $scope.listIsObj === true;
|
|
42
|
+
|
|
43
|
+
$scope.firstTime = true;
|
|
44
|
+
$scope.checkIfFirstTime = function () {
|
|
45
|
+
if ($scope.firstTime) {
|
|
46
|
+
$scope.firstTime = false;
|
|
47
|
+
return true;
|
|
48
|
+
} else {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// If selected is not yet defined
|
|
54
|
+
if (!angular.isDefined($scope.model)) {
|
|
55
|
+
if ($scope.multiple) {
|
|
56
|
+
$scope.model = [];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Set internalList
|
|
61
|
+
if ($scope.listIsObj) {
|
|
62
|
+
$scope.internalList = $scope.list;
|
|
63
|
+
} else {
|
|
64
|
+
$scope.internalList = _.map($scope.list, function (val) {
|
|
65
|
+
const obj = {};
|
|
66
|
+
obj[$scope.objKey] = val;
|
|
67
|
+
obj[$scope.objValue] = val;
|
|
68
|
+
return obj;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Set internalSelected
|
|
73
|
+
if ($scope.selectedIsObj) {
|
|
74
|
+
$scope.internalSelected = $scope.model;
|
|
75
|
+
} else {
|
|
76
|
+
if ($scope.multiple) {
|
|
77
|
+
$scope.internalSelected = _.map($scope.model, function (val) {
|
|
78
|
+
const obj = {};
|
|
79
|
+
obj[$scope.objKey] = val;
|
|
80
|
+
obj[$scope.objValue] = val;
|
|
81
|
+
return obj;
|
|
82
|
+
});
|
|
83
|
+
} else {
|
|
84
|
+
if ($scope.model) {
|
|
85
|
+
const obj = {};
|
|
86
|
+
obj[$scope.objKey] = $scope.model;
|
|
87
|
+
obj[$scope.objValue] = $scope.model;
|
|
88
|
+
$scope.internalSelected = obj;
|
|
89
|
+
} else {
|
|
90
|
+
$scope.internalSelected = $scope.internalList[0];
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const getFilter = function (item) {
|
|
96
|
+
// Create filter for finding object by objValue with _.where()
|
|
97
|
+
const filter = {};
|
|
98
|
+
if (item.hasOwnProperty($scope.objKey))
|
|
99
|
+
filter[$scope.objKey] = item[$scope.objKey];
|
|
100
|
+
else
|
|
101
|
+
filter[$scope.objKey] = item;
|
|
102
|
+
return filter;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
$scope.itemHover = function (event, item) {
|
|
106
|
+
if ($scope.isDisabled) return;
|
|
107
|
+
if (event.buttons == 1 && $scope.multiple) {
|
|
108
|
+
$scope.toggle(item);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
$scope.setDefault = function () {
|
|
113
|
+
if (!$scope.multiple) {
|
|
114
|
+
$scope.internalSelected = $scope.internalList[0];
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
$scope.isItemSelected = function (item) {
|
|
119
|
+
if (!$scope.internalSelected)
|
|
120
|
+
return false;
|
|
121
|
+
// Which item is selected
|
|
122
|
+
if ($scope.multiple) {
|
|
123
|
+
return _.where($scope.internalSelected, getFilter(item)).length > 0;
|
|
124
|
+
} else {
|
|
125
|
+
return $scope.internalSelected[$scope.objKey] == item[$scope.objKey];
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
$scope.toggle = function (item) {
|
|
130
|
+
if ($scope.isDisabled) return;
|
|
131
|
+
$scope.formChoice.$setDirty();
|
|
132
|
+
|
|
133
|
+
if (!$scope.multiple) {
|
|
134
|
+
$scope.internalSelected = item;
|
|
135
|
+
} else {
|
|
136
|
+
if ($scope.isItemSelected(item)) {
|
|
137
|
+
$scope.internalSelected = _.without($scope.internalSelected, _.findWhere($scope.internalSelected, getFilter(item)));
|
|
138
|
+
} else {
|
|
139
|
+
$scope.internalSelected.push(item);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
$scope.getLabel = function (item) {
|
|
145
|
+
return item[$scope.objValue];
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
$scope.$watchCollection('list', function (value_new, value_old) {
|
|
149
|
+
// Set internalList
|
|
150
|
+
if ($scope.listIsObj) {
|
|
151
|
+
$scope.internalList = $scope.list;
|
|
152
|
+
} else {
|
|
153
|
+
$scope.internalList = _.map($scope.list, function (val) {
|
|
154
|
+
const obj = {};
|
|
155
|
+
obj[$scope.objKey] = val;
|
|
156
|
+
obj[$scope.objValue] = val;
|
|
157
|
+
return obj;
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
$scope.$watchCollection('internalSelected', function (value_new, value_old) {
|
|
163
|
+
// Update $scope.selected based on settings
|
|
164
|
+
if (value_new && (!angular.equals(value_new, value_old) || $scope.checkIfFirstTime())) {
|
|
165
|
+
if ($scope.selectedIsObj) {
|
|
166
|
+
$scope.model = value_new;
|
|
167
|
+
} else {
|
|
168
|
+
if ($scope.multiple) {
|
|
169
|
+
$scope.model = _.map(value_new, $scope.objKey);
|
|
170
|
+
} else {
|
|
171
|
+
$scope.model = value_new[$scope.objKey];
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
$scope.$watchCollection('model', function (value_new, value_old) {
|
|
179
|
+
if (!angular.equals(value_new, value_old)) {
|
|
180
|
+
if (!value_new) {
|
|
181
|
+
if (!$scope.multiple)
|
|
182
|
+
$scope.internalSelected = $scope.internalList[0];
|
|
183
|
+
else
|
|
184
|
+
$scope.internalSelected = [];
|
|
185
|
+
} else {
|
|
186
|
+
// Update $scope.internalSelected based on updated parent scope value $scope.selected and settings
|
|
187
|
+
if ($scope.selectedIsObj) {
|
|
188
|
+
$scope.internalSelected = value_new;
|
|
189
|
+
|
|
190
|
+
} else {
|
|
191
|
+
if ($scope.multiple) {
|
|
192
|
+
$scope.internalSelected = _.map(value_new, function (item) {
|
|
193
|
+
return _.find($scope.internalList, getFilter(item));
|
|
194
|
+
});
|
|
195
|
+
} else {
|
|
196
|
+
$scope.internalSelected = _.find($scope.internalList, getFilter(value_new));
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (!value_new) {
|
|
203
|
+
if (!$scope.multiple) {
|
|
204
|
+
$scope.internalSelected = $scope.internalList[0];
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
});
|
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
.nice-choice {
|
|
2
|
-
.selected {
|
|
3
|
-
.choice-checkbox {
|
|
4
|
-
border-color: $nice-choice-selected-bg;
|
|
5
|
-
background: $nice-choice-selected-bg;
|
|
6
|
-
color: $nice-choice-selected-color;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.disabled {
|
|
11
|
-
li {
|
|
12
|
-
cursor: not-allowed;
|
|
13
|
-
opacity: 0.65;
|
|
14
|
-
|
|
15
|
-
&:hover {
|
|
16
|
-
.choice-checkbox {
|
|
17
|
-
cursor: not-allowed;
|
|
18
|
-
border-color: $nice-border-color !important;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.choice-label {
|
|
22
|
-
color: $nice-font-color;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.selected {
|
|
28
|
-
&:hover {
|
|
29
|
-
.choice-checkbox {
|
|
30
|
-
border-color: $nice-choice-selected-bg !important;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
ul {
|
|
38
|
-
margin-bottom: 0;
|
|
39
|
-
display: flex;
|
|
40
|
-
flex-direction: column;
|
|
41
|
-
gap: 6px;
|
|
42
|
-
margin-top: 7px;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&.nice-component-inline {
|
|
46
|
-
ul {
|
|
47
|
-
margin-top: 2px;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
li {
|
|
52
|
-
@extend .noselect;
|
|
53
|
-
cursor: pointer;
|
|
54
|
-
display: flex;
|
|
55
|
-
align-items: center;
|
|
56
|
-
padding: 0 !important;
|
|
57
|
-
|
|
58
|
-
.choice-checkbox {
|
|
59
|
-
transition: all 0.2s;
|
|
60
|
-
background: $nice-choice-bg;
|
|
61
|
-
color: $nice-choice-bg;
|
|
62
|
-
width: 20px;
|
|
63
|
-
height: 20px;
|
|
64
|
-
border: 1px solid $nice-border-color;
|
|
65
|
-
border-radius: $nice-border-radius;
|
|
66
|
-
padding: 0;
|
|
67
|
-
justify-content: center;
|
|
68
|
-
align-items: center;
|
|
69
|
-
display: flex;
|
|
70
|
-
flex-shrink: 0;
|
|
71
|
-
|
|
72
|
-
nice-icon {
|
|
73
|
-
display: block;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
svg {
|
|
77
|
-
height: 16px;
|
|
78
|
-
width: 16px;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.multiple-circle {
|
|
82
|
-
height: 8px;
|
|
83
|
-
width: 8px;
|
|
84
|
-
border-radius: 50%;
|
|
85
|
-
background: white;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
&:focus {
|
|
89
|
-
@extend .nice-focus;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
&:hover {
|
|
94
|
-
.choice-checkbox {
|
|
95
|
-
border-color: $nice-choice-hover-border;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.choice-label {
|
|
99
|
-
color: darken($nice-font-color, 15%);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.circle {
|
|
104
|
-
border-radius: 100px;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.choice-label {
|
|
108
|
-
margin-left: 10px;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
1
|
+
.nice-choice {
|
|
2
|
+
.selected {
|
|
3
|
+
.choice-checkbox {
|
|
4
|
+
border-color: $nice-choice-selected-bg;
|
|
5
|
+
background: $nice-choice-selected-bg;
|
|
6
|
+
color: $nice-choice-selected-color;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.disabled {
|
|
11
|
+
li {
|
|
12
|
+
cursor: not-allowed;
|
|
13
|
+
opacity: 0.65;
|
|
14
|
+
|
|
15
|
+
&:hover {
|
|
16
|
+
.choice-checkbox {
|
|
17
|
+
cursor: not-allowed;
|
|
18
|
+
border-color: $nice-border-color !important;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.choice-label {
|
|
22
|
+
color: $nice-font-color;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.selected {
|
|
28
|
+
&:hover {
|
|
29
|
+
.choice-checkbox {
|
|
30
|
+
border-color: $nice-choice-selected-bg !important;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
ul {
|
|
38
|
+
margin-bottom: 0;
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
gap: 6px;
|
|
42
|
+
margin-top: 7px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&.nice-component-inline {
|
|
46
|
+
ul {
|
|
47
|
+
margin-top: 2px;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
li {
|
|
52
|
+
@extend .noselect;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
padding: 0 !important;
|
|
57
|
+
|
|
58
|
+
.choice-checkbox {
|
|
59
|
+
transition: all 0.2s;
|
|
60
|
+
background: $nice-choice-bg;
|
|
61
|
+
color: $nice-choice-bg;
|
|
62
|
+
width: 20px;
|
|
63
|
+
height: 20px;
|
|
64
|
+
border: 1px solid $nice-border-color;
|
|
65
|
+
border-radius: $nice-border-radius;
|
|
66
|
+
padding: 0;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
align-items: center;
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-shrink: 0;
|
|
71
|
+
|
|
72
|
+
nice-icon {
|
|
73
|
+
display: block;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
svg {
|
|
77
|
+
height: 16px;
|
|
78
|
+
width: 16px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.multiple-circle {
|
|
82
|
+
height: 8px;
|
|
83
|
+
width: 8px;
|
|
84
|
+
border-radius: 50%;
|
|
85
|
+
background: white;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&:focus {
|
|
89
|
+
@extend .nice-focus;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&:hover {
|
|
94
|
+
.choice-checkbox {
|
|
95
|
+
border-color: $nice-choice-hover-border;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.choice-label {
|
|
99
|
+
color: darken($nice-font-color, 15%);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.circle {
|
|
104
|
+
border-radius: 100px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.choice-label {
|
|
108
|
+
margin-left: 10px;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
111
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<div class="nice-component nice-comment" ng-class="{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }">
|
|
2
|
-
<div class="row">
|
|
3
|
-
<!------------------------- Title ------------------------->
|
|
4
|
-
<nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
|
|
5
|
-
|
|
6
|
-
<!------------------------- Field ------------------------->
|
|
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-required="required" ng-disabled="isDisabled"></textarea>
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
1
|
+
<div class="nice-component nice-comment" ng-class="{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }">
|
|
2
|
+
<div class="row">
|
|
3
|
+
<!------------------------- Title ------------------------->
|
|
4
|
+
<nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
|
|
5
|
+
|
|
6
|
+
<!------------------------- Field ------------------------->
|
|
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-required="required" ng-disabled="isDisabled"></textarea>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
11
|
</div>
|