nice-elements 1.9.13 → 1.9.15
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 +17 -10
- package/CHANGELOG.md +396 -386
- package/LICENSE.md +21 -21
- package/README.md +93 -93
- package/bower.json +10 -18
- package/dist/nice.js +7967 -7906
- package/dist/nice.min.js +1 -1
- package/dist/style.css +22 -18
- package/dist/style.css.map +1 -1
- package/dist/style.min.css +7 -7
- package/package.json +40 -40
- 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 +334 -334
- package/src/components/nice-calendar/nice-calendar.scss +285 -285
- package/src/components/nice-checkbox/nice-checkbox.html +5 -5
- package/src/components/nice-checkbox/nice-checkbox.js +33 -33
- package/src/components/nice-checkbox/nice-checkbox.scss +91 -91
- package/src/components/nice-choice/nice-choice.html +18 -18
- package/src/components/nice-choice/nice-choice.js +210 -210
- package/src/components/nice-choice/nice-choice.scss +110 -109
- package/src/components/nice-click-outside/nice-click-outside.js +105 -105
- package/src/components/nice-comment/nice-comment.html +10 -10
- package/src/components/nice-comment/nice-comment.js +69 -69
- package/src/components/nice-comment/nice-comment.scss +39 -39
- package/src/components/nice-date/nice-date.html +74 -74
- package/src/components/nice-date/nice-date.js +327 -327
- package/src/components/nice-date/nice-date.scss +302 -302
- package/src/components/nice-date-input/nice-date-input.html +41 -41
- package/src/components/nice-date-input/nice-date-input.js +109 -109
- package/src/components/nice-date-input/nice-date-input.scss +45 -45
- package/src/components/nice-date-range/nice-date-range.html +15 -15
- package/src/components/nice-date-range/nice-date-range.js +76 -76
- 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 +87 -87
- 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 +246 -246
- 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 +172 -172
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.scss +127 -127
- package/src/components/nice-dropdown/nice-dropdown.html +60 -60
- package/src/components/nice-dropdown/nice-dropdown.js +489 -489
- package/src/components/nice-dropdown/nice-dropdown.scss +249 -249
- package/src/components/nice-dropdown-date/nice-dropdown-date.html +28 -28
- package/src/components/nice-dropdown-date/nice-dropdown-date.js +126 -126
- package/src/components/nice-dropdown-date/nice-dropdown-date.scss +82 -82
- 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 +833 -833
- package/src/components/nice-help/nice-help.html +6 -6
- package/src/components/nice-help/nice-help.js +55 -55
- package/src/components/nice-help/nice-help.scss +78 -78
- package/src/components/nice-input/nice-input.html +48 -47
- package/src/components/nice-input/nice-input.js +244 -224
- 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 +30 -30
- 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-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 +166 -166
- package/src/components/nice-number/nice-number.scss +18 -18
- package/src/components/nice-percent/nice-percent.html +24 -24
- package/src/components/nice-percent/nice-percent.js +94 -94
- 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 +54 -54
- 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 +55 -55
- 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 +239 -239
- 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 +264 -264
- 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 +29 -29
- package/src/components/nice-steps/nice-steps.scss +81 -81
- package/src/components/nice-svgs/nice-svgs.html +1262 -1262
- package/src/components/nice-svgs/nice-svgs.js +16 -16
- package/src/components/nice-time-picker/nice-time-picker.html +43 -43
- package/src/components/nice-time-picker/nice-time-picker.js +83 -83
- package/src/components/nice-time-picker/nice-time-picker.scss +37 -37
- package/src/components/nice-title/nice-title.html +3 -3
- package/src/components/nice-title/nice-title.js +21 -21
- 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 +95 -95
- package/src/components/nice-toggle/nice-toggle.scss +67 -67
- package/src/components/nice-tooltip/_nice-tooltip.scss +71 -71
- package/src/components/nice-tooltip/nice-tooltip.js +23 -23
- package/src/components/nice-upload/nice-upload.html +22 -22
- package/src/components/nice-upload/nice-upload.js +157 -157
- package/src/components/nice-upload/nice-upload.scss +85 -85
- 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 +43 -43
- package/src/components/nice-yesno/nice-yesno.html +14 -14
- package/src/components/nice-yesno/nice-yesno.js +109 -109
- package/src/components/nice-yesno/nice-yesno.scss +95 -95
- 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 +19 -19
- package/src/styles/_bootstrap-variables.scss +178 -178
- package/src/styles/_nice-buttons.scss +403 -403
- package/src/styles/_nice-common.scss +471 -467
- package/src/styles/_nice-ngdialog.scss +85 -85
- package/src/styles/_nice-spacing.scss +283 -283
- package/src/styles/_nice.scss +65 -65
- package/src/styles/_variables.scss +195 -195
|
@@ -1,110 +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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
border
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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: unset;
|
|
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
|
+
}
|
|
110
111
|
}
|
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @ngdoc directive
|
|
5
|
-
* @name niceElements.directive:clickOutside
|
|
6
|
-
* @description
|
|
7
|
-
* # clickOutside
|
|
8
|
-
*/
|
|
9
|
-
angular.module('niceElements')
|
|
10
|
-
.directive('clickOutside', function($document, $parse, $timeout){
|
|
11
|
-
return {
|
|
12
|
-
restrict: 'A',
|
|
13
|
-
link: function ($scope, elem, attr) {
|
|
14
|
-
$scope.isOpen = false;
|
|
15
|
-
|
|
16
|
-
// watch for is open
|
|
17
|
-
attr.$observe('isOpen', function(value){
|
|
18
|
-
$scope.isOpen = value == 'true';
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
$timeout(function () {
|
|
22
|
-
// postpone linking to next digest to allow for unique id generation
|
|
23
|
-
var classList = (attr.outsideIfNot !== undefined) ? attr.outsideIfNot.split(/[ ,]+/) : [];
|
|
24
|
-
var fn;
|
|
25
|
-
|
|
26
|
-
function eventHandler(e) {
|
|
27
|
-
if ($scope.isOpen) {
|
|
28
|
-
var i, element, r, id, classNames, l;
|
|
29
|
-
|
|
30
|
-
// if there is no click target, no point going on
|
|
31
|
-
if (!e || !e.target) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// loop through the available elements, looking for classes in the class list that might match and so will eat
|
|
36
|
-
for (element = e.target; element; element = element.parentNode) {
|
|
37
|
-
// check if the element is the same element the directive is attached to and exit if so (props @CosticaPuntaru)
|
|
38
|
-
if (element === elem[0]) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// now we have done the initial checks, start gathering id's and classes
|
|
43
|
-
id = element.id;
|
|
44
|
-
classNames = element.className;
|
|
45
|
-
l = classList.length;
|
|
46
|
-
|
|
47
|
-
// Unwrap SVGAnimatedString classes
|
|
48
|
-
if (classNames && classNames.baseVal !== undefined) {
|
|
49
|
-
classNames = classNames.baseVal;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// if there are no class names on the element clicked, skip the check
|
|
53
|
-
if (classNames || id) {
|
|
54
|
-
|
|
55
|
-
// loop through the elements id's and classnames looking for exceptions
|
|
56
|
-
for (i = 0; i < l; i++) {
|
|
57
|
-
//prepare regex for class word matching
|
|
58
|
-
r = new RegExp('\\b' + classList[i] + '\\b');
|
|
59
|
-
|
|
60
|
-
// check for exact matches on id's or classes, but only if they exist in the first place
|
|
61
|
-
if ((id !== undefined && id === classList[i]) || (classNames && r.test(classNames))) {
|
|
62
|
-
// now let's exit out as it is an element that has been defined as being ignored for clicking outside
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// if we have got this far, then we are good to go with processing the command passed in via the click-outside attribute
|
|
70
|
-
$timeout(function () {
|
|
71
|
-
fn = $parse(attr['clickOutside']);
|
|
72
|
-
fn($scope, {event: e});
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
// if the devices has a touchscreen, listen for this event
|
|
79
|
-
if (_hasTouch()) {
|
|
80
|
-
$document.on('touchstart', eventHandler);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// still listen for the click event even if there is touch to cater for touchscreen laptops
|
|
84
|
-
$document.on('click', eventHandler);
|
|
85
|
-
|
|
86
|
-
// when the scope is destroyed, clean up the documents event handlers as we don't want it hanging around
|
|
87
|
-
$scope.$on('$destroy', function () {
|
|
88
|
-
if (_hasTouch()) {
|
|
89
|
-
$document.off('touchstart', eventHandler);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
$document.off('click', eventHandler);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* @description Private function to attempt to figure out if we are on a touch device
|
|
97
|
-
* @private
|
|
98
|
-
**/
|
|
99
|
-
function _hasTouch() {
|
|
100
|
-
// works on most browsers, IE10/11 and Surface
|
|
101
|
-
return 'ontouchstart' in window || navigator.maxTouchPoints;
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
};
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @ngdoc directive
|
|
5
|
+
* @name niceElements.directive:clickOutside
|
|
6
|
+
* @description
|
|
7
|
+
* # clickOutside
|
|
8
|
+
*/
|
|
9
|
+
angular.module('niceElements')
|
|
10
|
+
.directive('clickOutside', function($document, $parse, $timeout){
|
|
11
|
+
return {
|
|
12
|
+
restrict: 'A',
|
|
13
|
+
link: function ($scope, elem, attr) {
|
|
14
|
+
$scope.isOpen = false;
|
|
15
|
+
|
|
16
|
+
// watch for is open
|
|
17
|
+
attr.$observe('isOpen', function(value){
|
|
18
|
+
$scope.isOpen = value == 'true';
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
$timeout(function () {
|
|
22
|
+
// postpone linking to next digest to allow for unique id generation
|
|
23
|
+
var classList = (attr.outsideIfNot !== undefined) ? attr.outsideIfNot.split(/[ ,]+/) : [];
|
|
24
|
+
var fn;
|
|
25
|
+
|
|
26
|
+
function eventHandler(e) {
|
|
27
|
+
if ($scope.isOpen) {
|
|
28
|
+
var i, element, r, id, classNames, l;
|
|
29
|
+
|
|
30
|
+
// if there is no click target, no point going on
|
|
31
|
+
if (!e || !e.target) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// loop through the available elements, looking for classes in the class list that might match and so will eat
|
|
36
|
+
for (element = e.target; element; element = element.parentNode) {
|
|
37
|
+
// check if the element is the same element the directive is attached to and exit if so (props @CosticaPuntaru)
|
|
38
|
+
if (element === elem[0]) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// now we have done the initial checks, start gathering id's and classes
|
|
43
|
+
id = element.id;
|
|
44
|
+
classNames = element.className;
|
|
45
|
+
l = classList.length;
|
|
46
|
+
|
|
47
|
+
// Unwrap SVGAnimatedString classes
|
|
48
|
+
if (classNames && classNames.baseVal !== undefined) {
|
|
49
|
+
classNames = classNames.baseVal;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// if there are no class names on the element clicked, skip the check
|
|
53
|
+
if (classNames || id) {
|
|
54
|
+
|
|
55
|
+
// loop through the elements id's and classnames looking for exceptions
|
|
56
|
+
for (i = 0; i < l; i++) {
|
|
57
|
+
//prepare regex for class word matching
|
|
58
|
+
r = new RegExp('\\b' + classList[i] + '\\b');
|
|
59
|
+
|
|
60
|
+
// check for exact matches on id's or classes, but only if they exist in the first place
|
|
61
|
+
if ((id !== undefined && id === classList[i]) || (classNames && r.test(classNames))) {
|
|
62
|
+
// now let's exit out as it is an element that has been defined as being ignored for clicking outside
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// if we have got this far, then we are good to go with processing the command passed in via the click-outside attribute
|
|
70
|
+
$timeout(function () {
|
|
71
|
+
fn = $parse(attr['clickOutside']);
|
|
72
|
+
fn($scope, {event: e});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
// if the devices has a touchscreen, listen for this event
|
|
79
|
+
if (_hasTouch()) {
|
|
80
|
+
$document.on('touchstart', eventHandler);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// still listen for the click event even if there is touch to cater for touchscreen laptops
|
|
84
|
+
$document.on('click', eventHandler);
|
|
85
|
+
|
|
86
|
+
// when the scope is destroyed, clean up the documents event handlers as we don't want it hanging around
|
|
87
|
+
$scope.$on('$destroy', function () {
|
|
88
|
+
if (_hasTouch()) {
|
|
89
|
+
$document.off('touchstart', eventHandler);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
$document.off('click', eventHandler);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @description Private function to attempt to figure out if we are on a touch device
|
|
97
|
+
* @private
|
|
98
|
+
**/
|
|
99
|
+
function _hasTouch() {
|
|
100
|
+
// works on most browsers, IE10/11 and Surface
|
|
101
|
+
return 'ontouchstart' in window || navigator.maxTouchPoints;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
106
|
});
|
|
@@ -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" 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-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" 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-disabled="isDisabled"></textarea>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
11
|
</div>
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @ngdoc directive
|
|
5
|
-
* @name niceElements.directive:niceComment
|
|
6
|
-
* @description
|
|
7
|
-
* # niceComment
|
|
8
|
-
*/
|
|
9
|
-
angular.module('niceElements')
|
|
10
|
-
.directive('niceComment', function ($timeout) {
|
|
11
|
-
return {
|
|
12
|
-
templateUrl: 'src/components/nice-comment/nice-comment.html',
|
|
13
|
-
restrict: 'E',
|
|
14
|
-
scope: {
|
|
15
|
-
model: '=',
|
|
16
|
-
title: '@?',
|
|
17
|
-
isDisabled: '=',
|
|
18
|
-
placeholder: '@',
|
|
19
|
-
noTextLabel: '@',
|
|
20
|
-
noMargin: '@',
|
|
21
|
-
fieldWidth: '@',
|
|
22
|
-
labelWidth: '@',
|
|
23
|
-
help: '@',
|
|
24
|
-
isInline: '=',
|
|
25
|
-
rows: '@'
|
|
26
|
-
},
|
|
27
|
-
link: function postLink(scope, element, attrs) {
|
|
28
|
-
if (scope.model == null) { scope.model = ''; }
|
|
29
|
-
if (!attrs.placeholder) { attrs.placeholder = ''; }
|
|
30
|
-
if (!attrs.noTextLabel) { angular.isDefined(attrs.noTextLabel); }
|
|
31
|
-
if (!attrs.fieldWidth) { attrs.fieldWidth = 'col-sm-8'; }
|
|
32
|
-
if (!attrs.labelWidth) { attrs.labelWidth = 'col-sm-4'; }
|
|
33
|
-
if (!attrs.help) { attrs.help = ''; }
|
|
34
|
-
if (!attrs.rows) { attrs.rows = 1; }
|
|
35
|
-
|
|
36
|
-
var textareas = element.find('textarea');
|
|
37
|
-
|
|
38
|
-
scope.edit = function () {
|
|
39
|
-
scope.editing = true;
|
|
40
|
-
$timeout(function () {
|
|
41
|
-
textareas[0].focus();
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
textareas[0].addEventListener('keydown', autosize);
|
|
46
|
-
autosize();
|
|
47
|
-
|
|
48
|
-
function autosize() {
|
|
49
|
-
var el = textareas[0];
|
|
50
|
-
$timeout(function () {
|
|
51
|
-
el.style.cssText = 'height:auto; padding:0';
|
|
52
|
-
|
|
53
|
-
// for box-sizing other than "content-box" use:
|
|
54
|
-
el.style.cssText = '-moz-box-sizing:content-box';
|
|
55
|
-
|
|
56
|
-
// Fix height
|
|
57
|
-
el.style.cssText = 'height:' + (el.scrollHeight + 2) + 'px';
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
controller: function ($scope) {
|
|
62
|
-
$scope.editing = false;
|
|
63
|
-
|
|
64
|
-
$scope.save = function () {
|
|
65
|
-
$scope.editing = false;
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
});
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @ngdoc directive
|
|
5
|
+
* @name niceElements.directive:niceComment
|
|
6
|
+
* @description
|
|
7
|
+
* # niceComment
|
|
8
|
+
*/
|
|
9
|
+
angular.module('niceElements')
|
|
10
|
+
.directive('niceComment', function ($timeout) {
|
|
11
|
+
return {
|
|
12
|
+
templateUrl: 'src/components/nice-comment/nice-comment.html',
|
|
13
|
+
restrict: 'E',
|
|
14
|
+
scope: {
|
|
15
|
+
model: '=',
|
|
16
|
+
title: '@?',
|
|
17
|
+
isDisabled: '=',
|
|
18
|
+
placeholder: '@',
|
|
19
|
+
noTextLabel: '@',
|
|
20
|
+
noMargin: '@',
|
|
21
|
+
fieldWidth: '@',
|
|
22
|
+
labelWidth: '@',
|
|
23
|
+
help: '@',
|
|
24
|
+
isInline: '=',
|
|
25
|
+
rows: '@'
|
|
26
|
+
},
|
|
27
|
+
link: function postLink(scope, element, attrs) {
|
|
28
|
+
if (scope.model == null) { scope.model = ''; }
|
|
29
|
+
if (!attrs.placeholder) { attrs.placeholder = ''; }
|
|
30
|
+
if (!attrs.noTextLabel) { angular.isDefined(attrs.noTextLabel); }
|
|
31
|
+
if (!attrs.fieldWidth) { attrs.fieldWidth = 'col-sm-8'; }
|
|
32
|
+
if (!attrs.labelWidth) { attrs.labelWidth = 'col-sm-4'; }
|
|
33
|
+
if (!attrs.help) { attrs.help = ''; }
|
|
34
|
+
if (!attrs.rows) { attrs.rows = 1; }
|
|
35
|
+
|
|
36
|
+
var textareas = element.find('textarea');
|
|
37
|
+
|
|
38
|
+
scope.edit = function () {
|
|
39
|
+
scope.editing = true;
|
|
40
|
+
$timeout(function () {
|
|
41
|
+
textareas[0].focus();
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
textareas[0].addEventListener('keydown', autosize);
|
|
46
|
+
autosize();
|
|
47
|
+
|
|
48
|
+
function autosize() {
|
|
49
|
+
var el = textareas[0];
|
|
50
|
+
$timeout(function () {
|
|
51
|
+
el.style.cssText = 'height:auto; padding:0';
|
|
52
|
+
|
|
53
|
+
// for box-sizing other than "content-box" use:
|
|
54
|
+
el.style.cssText = '-moz-box-sizing:content-box';
|
|
55
|
+
|
|
56
|
+
// Fix height
|
|
57
|
+
el.style.cssText = 'height:' + (el.scrollHeight + 2) + 'px';
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
controller: function ($scope) {
|
|
62
|
+
$scope.editing = false;
|
|
63
|
+
|
|
64
|
+
$scope.save = function () {
|
|
65
|
+
$scope.editing = false;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
});
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
.nice-comment {
|
|
2
|
-
.btn-comment-save {
|
|
3
|
-
position: absolute;
|
|
4
|
-
right: 20px;
|
|
5
|
-
top: 4px;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.btn-comment-cancel {
|
|
9
|
-
position: absolute;
|
|
10
|
-
right: 20px;
|
|
11
|
-
top: 40px;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.form-control[disabled] {
|
|
15
|
-
background: transparent;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
textarea {
|
|
19
|
-
min-height: 34px !important;
|
|
20
|
-
height: 34px;
|
|
21
|
-
box-shadow: 0 0 0;
|
|
22
|
-
|
|
23
|
-
&:focus {
|
|
24
|
-
box-shadow: 0 0 0;
|
|
25
|
-
border-color: transparent;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
border-radius: $nice-border-radius;
|
|
29
|
-
border-color: transparent;
|
|
30
|
-
color: $nice-base-color;
|
|
31
|
-
-webkit-user-select: none;
|
|
32
|
-
padding: 6px 0px;
|
|
33
|
-
|
|
34
|
-
&.editing {
|
|
35
|
-
padding: 6px;
|
|
36
|
-
color: $nice-font-color;
|
|
37
|
-
-webkit-user-select: initial;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
1
|
+
.nice-comment {
|
|
2
|
+
.btn-comment-save {
|
|
3
|
+
position: absolute;
|
|
4
|
+
right: 20px;
|
|
5
|
+
top: 4px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.btn-comment-cancel {
|
|
9
|
+
position: absolute;
|
|
10
|
+
right: 20px;
|
|
11
|
+
top: 40px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.form-control[disabled] {
|
|
15
|
+
background: transparent;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
textarea {
|
|
19
|
+
min-height: 34px !important;
|
|
20
|
+
height: 34px;
|
|
21
|
+
box-shadow: 0 0 0;
|
|
22
|
+
|
|
23
|
+
&:focus {
|
|
24
|
+
box-shadow: 0 0 0;
|
|
25
|
+
border-color: transparent;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
border-radius: $nice-border-radius;
|
|
29
|
+
border-color: transparent;
|
|
30
|
+
color: $nice-base-color;
|
|
31
|
+
-webkit-user-select: none;
|
|
32
|
+
padding: 6px 0px;
|
|
33
|
+
|
|
34
|
+
&.editing {
|
|
35
|
+
padding: 6px;
|
|
36
|
+
color: $nice-font-color;
|
|
37
|
+
-webkit-user-select: initial;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
40
|
}
|