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,111 +1,111 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @ngdoc directive
|
|
5
|
-
* @name niceElements.directive:niceYesno
|
|
6
|
-
* @description
|
|
7
|
-
* # niceYesno
|
|
8
|
-
*/
|
|
9
|
-
angular.module('niceElements')
|
|
10
|
-
.directive('niceYesno', function () {
|
|
11
|
-
return {
|
|
12
|
-
templateUrl: 'src/components/nice-yesno/nice-yesno.html',
|
|
13
|
-
restrict: 'E',
|
|
14
|
-
scope: {
|
|
15
|
-
model: '=',
|
|
16
|
-
modelValue: '=',
|
|
17
|
-
yes: '@',
|
|
18
|
-
no: '@',
|
|
19
|
-
niceTitle: '@',
|
|
20
|
-
title: '@',
|
|
21
|
-
isDisabled: '=',
|
|
22
|
-
fieldWidth: '@',
|
|
23
|
-
labelWidth: '@',
|
|
24
|
-
options: '=',
|
|
25
|
-
defaultFalse: '@',
|
|
26
|
-
noMargin: '@',
|
|
27
|
-
onChange: '&?',
|
|
28
|
-
isInline: '=',
|
|
29
|
-
help: '@',
|
|
30
|
-
required: '='
|
|
31
|
-
},
|
|
32
|
-
controller: function ($scope, gettextCatalog) {
|
|
33
|
-
if (!$scope.yes) { $scope.yes = gettextCatalog.getString('Yes', null, "Nice"); }
|
|
34
|
-
if (!$scope.no) { $scope.no = gettextCatalog.getString('No', null, "Nice"); }
|
|
35
|
-
if (!$scope.title) { $scope.title = ''; }
|
|
36
|
-
if (!$scope.fieldWidth) { $scope.fieldWidth = 'col-sm-8'; }
|
|
37
|
-
if (!$scope.labelWidth) { $scope.labelWidth = 'col-sm-4'; }
|
|
38
|
-
if (!angular.isDefined($scope.model) && !angular.isDefined($scope.options)) $scope.model = !angular.isDefined($scope.defaultFalse);
|
|
39
|
-
if (!angular.isDefined($scope.modelValue) && angular.isDefined($scope.options)) $scope.modelValue = $scope.options[0];
|
|
40
|
-
|
|
41
|
-
$scope.defaultFalse = angular.isDefined($scope.defaultFalse);
|
|
42
|
-
$scope.noMargin = angular.isDefined($scope.noMargin);
|
|
43
|
-
|
|
44
|
-
$scope.buttonClass = "";
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// ------------------------- Set overlay button position based on passed state in $scope.model -------------------------
|
|
48
|
-
$scope.setButtonPosition = function (state) {
|
|
49
|
-
if (state) {
|
|
50
|
-
$scope.buttonClass = "yesno-button-yes";
|
|
51
|
-
} else {
|
|
52
|
-
$scope.buttonClass = "yesno-button-no";
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
// ------------------------- Watch for changes from outside -------------------------
|
|
57
|
-
$scope.$watch('model', function (value_new, value_old) {
|
|
58
|
-
if (angular.isDefined($scope.model)) {
|
|
59
|
-
$scope.setButtonLabel($scope.model);
|
|
60
|
-
$scope.setButtonPosition($scope.model);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
// ------------------------- Watch for model value -------------------------
|
|
65
|
-
$scope.$watch('modelValue', function (value_new, value_old) {
|
|
66
|
-
if ($scope.options) {
|
|
67
|
-
$scope.model = $scope.modelValue == $scope.options[0];
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
// ------------------------- Set button label -------------------------
|
|
72
|
-
$scope.setButtonLabel = function (state) {
|
|
73
|
-
if (state) {
|
|
74
|
-
$scope.state = $scope.yes;
|
|
75
|
-
} else {
|
|
76
|
-
$scope.state = $scope.no;
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
// ------------------------- Set width -------------------------
|
|
81
|
-
$scope.setWidth = function (width, el) {
|
|
82
|
-
el.style.width = width;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
// ------------------------- Switch -------------------------
|
|
87
|
-
$scope.switch = function () {
|
|
88
|
-
if (!$scope.isDisabled) {
|
|
89
|
-
$scope.model = !$scope.model;
|
|
90
|
-
|
|
91
|
-
if ($scope.options) {
|
|
92
|
-
if ($scope.model) {
|
|
93
|
-
$scope.modelValue = $scope.options[0];
|
|
94
|
-
} else {
|
|
95
|
-
$scope.modelValue = $scope.options[1];
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
100
|
-
$scope.formYesno.$setDirty();
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
// Call it first time
|
|
105
|
-
$scope.setButtonPosition($scope.model);
|
|
106
|
-
|
|
107
|
-
// Set label based on state passed in $scope.model
|
|
108
|
-
$scope.setButtonLabel($scope.model);
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
});
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @ngdoc directive
|
|
5
|
+
* @name niceElements.directive:niceYesno
|
|
6
|
+
* @description
|
|
7
|
+
* # niceYesno
|
|
8
|
+
*/
|
|
9
|
+
angular.module('niceElements')
|
|
10
|
+
.directive('niceYesno', function () {
|
|
11
|
+
return {
|
|
12
|
+
templateUrl: 'src/components/nice-yesno/nice-yesno.html',
|
|
13
|
+
restrict: 'E',
|
|
14
|
+
scope: {
|
|
15
|
+
model: '=',
|
|
16
|
+
modelValue: '=',
|
|
17
|
+
yes: '@',
|
|
18
|
+
no: '@',
|
|
19
|
+
niceTitle: '@',
|
|
20
|
+
title: '@',
|
|
21
|
+
isDisabled: '=',
|
|
22
|
+
fieldWidth: '@',
|
|
23
|
+
labelWidth: '@',
|
|
24
|
+
options: '=',
|
|
25
|
+
defaultFalse: '@',
|
|
26
|
+
noMargin: '@',
|
|
27
|
+
onChange: '&?',
|
|
28
|
+
isInline: '=',
|
|
29
|
+
help: '@',
|
|
30
|
+
required: '='
|
|
31
|
+
},
|
|
32
|
+
controller: function ($scope, gettextCatalog) {
|
|
33
|
+
if (!$scope.yes) { $scope.yes = gettextCatalog.getString('Yes', null, "Nice"); }
|
|
34
|
+
if (!$scope.no) { $scope.no = gettextCatalog.getString('No', null, "Nice"); }
|
|
35
|
+
if (!$scope.title) { $scope.title = ''; }
|
|
36
|
+
if (!$scope.fieldWidth) { $scope.fieldWidth = 'col-sm-8'; }
|
|
37
|
+
if (!$scope.labelWidth) { $scope.labelWidth = 'col-sm-4'; }
|
|
38
|
+
if (!angular.isDefined($scope.model) && !angular.isDefined($scope.options)) $scope.model = !angular.isDefined($scope.defaultFalse);
|
|
39
|
+
if (!angular.isDefined($scope.modelValue) && angular.isDefined($scope.options)) $scope.modelValue = $scope.options[0];
|
|
40
|
+
|
|
41
|
+
$scope.defaultFalse = angular.isDefined($scope.defaultFalse);
|
|
42
|
+
$scope.noMargin = angular.isDefined($scope.noMargin);
|
|
43
|
+
|
|
44
|
+
$scope.buttonClass = "";
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
// ------------------------- Set overlay button position based on passed state in $scope.model -------------------------
|
|
48
|
+
$scope.setButtonPosition = function (state) {
|
|
49
|
+
if (state) {
|
|
50
|
+
$scope.buttonClass = "yesno-button-yes";
|
|
51
|
+
} else {
|
|
52
|
+
$scope.buttonClass = "yesno-button-no";
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// ------------------------- Watch for changes from outside -------------------------
|
|
57
|
+
$scope.$watch('model', function (value_new, value_old) {
|
|
58
|
+
if (angular.isDefined($scope.model)) {
|
|
59
|
+
$scope.setButtonLabel($scope.model);
|
|
60
|
+
$scope.setButtonPosition($scope.model);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// ------------------------- Watch for model value -------------------------
|
|
65
|
+
$scope.$watch('modelValue', function (value_new, value_old) {
|
|
66
|
+
if ($scope.options) {
|
|
67
|
+
$scope.model = $scope.modelValue == $scope.options[0];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// ------------------------- Set button label -------------------------
|
|
72
|
+
$scope.setButtonLabel = function (state) {
|
|
73
|
+
if (state) {
|
|
74
|
+
$scope.state = $scope.yes;
|
|
75
|
+
} else {
|
|
76
|
+
$scope.state = $scope.no;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// ------------------------- Set width -------------------------
|
|
81
|
+
$scope.setWidth = function (width, el) {
|
|
82
|
+
el.style.width = width;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
// ------------------------- Switch -------------------------
|
|
87
|
+
$scope.switch = function () {
|
|
88
|
+
if (!$scope.isDisabled) {
|
|
89
|
+
$scope.model = !$scope.model;
|
|
90
|
+
|
|
91
|
+
if ($scope.options) {
|
|
92
|
+
if ($scope.model) {
|
|
93
|
+
$scope.modelValue = $scope.options[0];
|
|
94
|
+
} else {
|
|
95
|
+
$scope.modelValue = $scope.options[1];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
100
|
+
$scope.formYesno.$setDirty();
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// Call it first time
|
|
105
|
+
$scope.setButtonPosition($scope.model);
|
|
106
|
+
|
|
107
|
+
// Set label based on state passed in $scope.model
|
|
108
|
+
$scope.setButtonLabel($scope.model);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
});
|
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
.nice-yesno {
|
|
2
|
-
.nice-disabled {
|
|
3
|
-
|
|
4
|
-
.yesno-wrapper,
|
|
5
|
-
.yesno-yes-bg,
|
|
6
|
-
.yesno-no-bg,
|
|
7
|
-
.yesno-button {
|
|
8
|
-
cursor: not-allowed !important;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.yesno-wrapper {
|
|
13
|
-
background: $nice-yesno-bg;
|
|
14
|
-
border: 1px solid $nice-border-color;
|
|
15
|
-
color: $nice-font-color;
|
|
16
|
-
border-radius: $nice-border-radius;
|
|
17
|
-
|
|
18
|
-
height: 34px;
|
|
19
|
-
position: relative;
|
|
20
|
-
|
|
21
|
-
&:focus-within {
|
|
22
|
-
@extend .nice-focus;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.yesno-yes-bg,
|
|
26
|
-
.yesno-no-bg,
|
|
27
|
-
.yesno-button {
|
|
28
|
-
text-align: center;
|
|
29
|
-
line-height: 34px;
|
|
30
|
-
min-height: unset;
|
|
31
|
-
cursor: pointer;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.yesno-yes-bg,
|
|
35
|
-
.yesno-no-bg {
|
|
36
|
-
opacity: 0.8;
|
|
37
|
-
height: 100%;
|
|
38
|
-
position: absolute;
|
|
39
|
-
top: 0;
|
|
40
|
-
bottom: 0;
|
|
41
|
-
appearance: none;
|
|
42
|
-
background: none;
|
|
43
|
-
border: 0 none;
|
|
44
|
-
padding: 0;
|
|
45
|
-
line-height: 1;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.yesno-no-bg {
|
|
49
|
-
left: 50%;
|
|
50
|
-
width: 50%;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.yesno-yes-bg {
|
|
54
|
-
left: 0;
|
|
55
|
-
width: 50%;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.yesno-button {
|
|
59
|
-
transition: all 0.5s;
|
|
60
|
-
background-color: $nice-yesno-slider-bg;
|
|
61
|
-
border-radius: $nice-border-radius-small;
|
|
62
|
-
color: white;
|
|
63
|
-
position: absolute;
|
|
64
|
-
line-height: 28px;
|
|
65
|
-
padding: 0;
|
|
66
|
-
top: 2px;
|
|
67
|
-
bottom: 2px;
|
|
68
|
-
left: 2px;
|
|
69
|
-
width: calc(50% - 2px);
|
|
70
|
-
opacity: 1 !important;
|
|
71
|
-
|
|
72
|
-
&:hover {
|
|
73
|
-
background-color: darken($nice-yesno-slider-bg, 5%);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
&:focus {
|
|
77
|
-
outline: 0 none;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.yesno-button-no {
|
|
82
|
-
left: 50%;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.yesno-button-yes {
|
|
86
|
-
left: 2px;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
&.true {
|
|
90
|
-
.yesno-button {
|
|
91
|
-
left: 50%;
|
|
92
|
-
width: 50%;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
1
|
+
.nice-yesno {
|
|
2
|
+
.nice-disabled {
|
|
3
|
+
|
|
4
|
+
.yesno-wrapper,
|
|
5
|
+
.yesno-yes-bg,
|
|
6
|
+
.yesno-no-bg,
|
|
7
|
+
.yesno-button {
|
|
8
|
+
cursor: not-allowed !important;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.yesno-wrapper {
|
|
13
|
+
background: $nice-yesno-bg;
|
|
14
|
+
border: 1px solid $nice-border-color;
|
|
15
|
+
color: $nice-font-color;
|
|
16
|
+
border-radius: $nice-border-radius;
|
|
17
|
+
|
|
18
|
+
height: 34px;
|
|
19
|
+
position: relative;
|
|
20
|
+
|
|
21
|
+
&:focus-within {
|
|
22
|
+
@extend .nice-focus;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.yesno-yes-bg,
|
|
26
|
+
.yesno-no-bg,
|
|
27
|
+
.yesno-button {
|
|
28
|
+
text-align: center;
|
|
29
|
+
line-height: 34px;
|
|
30
|
+
min-height: unset;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.yesno-yes-bg,
|
|
35
|
+
.yesno-no-bg {
|
|
36
|
+
opacity: 0.8;
|
|
37
|
+
height: 100%;
|
|
38
|
+
position: absolute;
|
|
39
|
+
top: 0;
|
|
40
|
+
bottom: 0;
|
|
41
|
+
appearance: none;
|
|
42
|
+
background: none;
|
|
43
|
+
border: 0 none;
|
|
44
|
+
padding: 0;
|
|
45
|
+
line-height: 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.yesno-no-bg {
|
|
49
|
+
left: 50%;
|
|
50
|
+
width: 50%;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.yesno-yes-bg {
|
|
54
|
+
left: 0;
|
|
55
|
+
width: 50%;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.yesno-button {
|
|
59
|
+
transition: all 0.5s;
|
|
60
|
+
background-color: $nice-yesno-slider-bg;
|
|
61
|
+
border-radius: $nice-border-radius-small;
|
|
62
|
+
color: white;
|
|
63
|
+
position: absolute;
|
|
64
|
+
line-height: 28px;
|
|
65
|
+
padding: 0;
|
|
66
|
+
top: 2px;
|
|
67
|
+
bottom: 2px;
|
|
68
|
+
left: 2px;
|
|
69
|
+
width: calc(50% - 2px);
|
|
70
|
+
opacity: 1 !important;
|
|
71
|
+
|
|
72
|
+
&:hover {
|
|
73
|
+
background-color: darken($nice-yesno-slider-bg, 5%);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&:focus {
|
|
77
|
+
outline: 0 none;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.yesno-button-no {
|
|
82
|
+
left: 50%;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.yesno-button-yes {
|
|
86
|
+
left: 2px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&.true {
|
|
90
|
+
.yesno-button {
|
|
91
|
+
left: 50%;
|
|
92
|
+
width: 50%;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
96
|
}
|
|
@@ -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
|
-
const classList = (attr.outsideIfNot !== undefined) ? attr.outsideIfNot.split(/[ ,]+/) : [];
|
|
24
|
-
let fn;
|
|
25
|
-
|
|
26
|
-
function eventHandler(e) {
|
|
27
|
-
if ($scope.isOpen) {
|
|
28
|
-
let 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
|
+
const classList = (attr.outsideIfNot !== undefined) ? attr.outsideIfNot.split(/[ ,]+/) : [];
|
|
24
|
+
let fn;
|
|
25
|
+
|
|
26
|
+
function eventHandler(e) {
|
|
27
|
+
if ($scope.isOpen) {
|
|
28
|
+
let 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
|
});
|