nice-elements 1.10.14 → 1.10.16
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 +0 -1
- package/CHANGELOG.md +16 -0
- package/README.md +1 -1
- package/bower.json +1 -1
- package/dist/nice.js +371 -302
- package/dist/nice.min.js +1 -1
- package/dist/style.css +65 -10
- package/dist/style.css.map +2 -1
- package/dist/style.min.css +2 -2
- package/eslint.config.mjs +6 -2
- package/package.json +4 -4
- package/src/components/nice-calendar/nice-calendar.js +16 -16
- package/src/components/nice-choice/nice-choice.js +6 -6
- package/src/components/nice-click-outside/nice-click-outside.js +7 -7
- package/src/components/nice-comment/nice-comment.js +2 -2
- package/src/components/nice-date/nice-date.js +6 -4
- package/src/components/nice-date-input/nice-date-input.js +3 -3
- package/src/components/nice-date-range/nice-date-range.js +2 -2
- package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.js +21 -21
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.js +8 -7
- package/src/components/nice-dropdown/nice-dropdown.js +29 -22
- package/src/components/nice-dropdown/nice-dropdown.scss +1 -1
- package/src/components/nice-dropdown-date/nice-dropdown-date.js +9 -5
- package/src/components/nice-dropdown-date/nice-dropdown-date.scss +5 -1
- package/src/components/nice-dropdown-old/nice-dropdown-old.js +26 -27
- package/src/components/nice-dtp/nice-dtp.js +85 -85
- package/src/components/nice-help/nice-help.js +7 -4
- package/src/components/nice-input/nice-input.js +8 -8
- package/src/components/nice-no-data/nice-no-data.scss +4 -9
- package/src/components/nice-notification/nice-notification.js +42 -42
- package/src/components/nice-number/nice-number.js +3 -3
- package/src/components/nice-percent/nice-percent.js +1 -1
- package/src/components/nice-popup/nice-popup.js +2 -2
- package/src/components/nice-search/nice-search.js +12 -9
- package/src/components/nice-search2/nice-search2.js +15 -13
- package/src/components/nice-table/nice-table.scss +3 -3
- package/src/components/nice-time-picker/nice-time-picker.js +1 -1
- package/src/components/nice-toast/nice-toast.js +2 -2
- package/src/components/nice-upload/nice-upload.js +4 -4
- package/src/components/nice-view/_nice-view.scss +62 -0
- package/src/components/nice-view/nice-view.html +13 -0
- package/src/components/nice-view/nice-view.js +30 -0
- package/src/components/nice-wrapper/nice-wrapper.js +1 -1
- package/src/filters/nice-date.js +1 -1
- package/src/filters/nice-highlight.js +2 -2
- package/src/services/nice-service.js +2 -2
- package/src/styles/_nice.scss +2 -1
- package/src/styles/_variables.scss +2 -1
|
@@ -6,13 +6,7 @@
|
|
|
6
6
|
padding: 2rem 1rem;
|
|
7
7
|
font-size: 0.9em;
|
|
8
8
|
gap: 0.3rem;
|
|
9
|
-
color: var(--nice-font-color);
|
|
10
|
-
opacity: 0.5;
|
|
11
|
-
transition: opacity 0.3s ease;
|
|
12
|
-
|
|
13
|
-
&:hover {
|
|
14
|
-
opacity: 0.7;
|
|
15
|
-
}
|
|
9
|
+
color: var(--nice-font-color-lighter);
|
|
16
10
|
|
|
17
11
|
&.nice-no-data-fulldiv {
|
|
18
12
|
position: absolute;
|
|
@@ -27,5 +21,6 @@
|
|
|
27
21
|
width: 24px;
|
|
28
22
|
}
|
|
29
23
|
|
|
30
|
-
.nice-no-data-message {
|
|
31
|
-
}
|
|
24
|
+
.nice-no-data-message {
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -9,75 +9,76 @@
|
|
|
9
9
|
angular.module('niceElements')
|
|
10
10
|
.factory('NiceNotification', function ($timeout, $http, $compile, $templateCache, $rootScope, $sce) {
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
let startTop = 10;
|
|
13
|
+
let startRight = 10;
|
|
14
|
+
let verticalSpacing = 10;
|
|
15
|
+
let horizontalSpacing = 10;
|
|
16
|
+
let delay = 5000;
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
const messageElements = [];
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
const notify = function (args, t) {
|
|
21
21
|
|
|
22
|
-
if (typeof args !== 'object'){
|
|
23
|
-
args = {message:args};
|
|
22
|
+
if (typeof args !== 'object') {
|
|
23
|
+
args = { message: args };
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
args.template = args.template ? args.template : 'src/components/nice-notification/nice-notification.html';
|
|
27
27
|
args.delay = !angular.isUndefined(args.delay) ? args.delay : delay;
|
|
28
28
|
args.type = t ? t : '';
|
|
29
29
|
|
|
30
|
-
$http.get(args.template,{cache: $templateCache}).success(function(template) {
|
|
30
|
+
$http.get(args.template, { cache: $templateCache }).success(function (template) {
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
const scope = $rootScope.$new();
|
|
33
33
|
scope.message = $sce.trustAsHtml(args.message);
|
|
34
34
|
scope.title = $sce.trustAsHtml(args.title);
|
|
35
|
-
scope.t = args.type.substr(0,1);
|
|
35
|
+
scope.t = args.type.substr(0, 1);
|
|
36
36
|
scope.delay = args.delay;
|
|
37
37
|
|
|
38
|
-
if (typeof args.scope === 'object'){
|
|
39
|
-
for (
|
|
38
|
+
if (typeof args.scope === 'object') {
|
|
39
|
+
for (let key in args.scope) {
|
|
40
40
|
scope[key] = args.scope[key];
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
const reposite = function () {
|
|
45
|
+
let j = 0;
|
|
46
|
+
let k = 0;
|
|
47
|
+
let lastTop = startTop;
|
|
48
|
+
let top = 0;
|
|
49
|
+
// const lastRight = startRight;
|
|
50
|
+
for (let i = messageElements.length - 1; i >= 0; i--) {
|
|
51
|
+
const element = messageElements[i];
|
|
52
|
+
const elHeight = parseInt(element[0].offsetHeight);
|
|
53
|
+
const elWidth = parseInt(element[0].offsetWidth);
|
|
53
54
|
if ((top + elHeight) > window.innerHeight) {
|
|
54
55
|
lastTop = startTop;
|
|
55
|
-
k
|
|
56
|
+
k++;
|
|
56
57
|
j = 0;
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
top = lastTop + (j === 0 ? 0 : verticalSpacing);
|
|
60
|
+
const right = startRight + (k * (horizontalSpacing + elWidth));
|
|
60
61
|
|
|
61
62
|
element.css('top', top + 'px');
|
|
62
63
|
element.css('right', right + 'px');
|
|
63
64
|
|
|
64
65
|
lastTop = top + elHeight;
|
|
65
|
-
j
|
|
66
|
+
j++;
|
|
66
67
|
}
|
|
67
68
|
};
|
|
68
69
|
|
|
69
|
-
|
|
70
|
+
const templateElement = $compile(template)(scope);
|
|
70
71
|
templateElement.addClass(args.type);
|
|
71
|
-
templateElement.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd click', function(e){
|
|
72
|
+
templateElement.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd click', function (e) {
|
|
72
73
|
e = e.originalEvent || e;
|
|
73
|
-
if (e.type === 'click' || (e.propertyName === 'opacity' && e.elapsedTime >= 0.4)){
|
|
74
|
+
if (e.type === 'click' || (e.propertyName === 'opacity' && e.elapsedTime >= 0.4)) {
|
|
74
75
|
templateElement.remove();
|
|
75
76
|
messageElements.splice(messageElements.indexOf(templateElement), 1);
|
|
76
77
|
reposite();
|
|
77
78
|
}
|
|
78
79
|
});
|
|
79
80
|
|
|
80
|
-
$timeout(function() {
|
|
81
|
+
$timeout(function () {
|
|
81
82
|
templateElement.addClass('killed');
|
|
82
83
|
templateElement.remove();
|
|
83
84
|
messageElements.splice(messageElements.indexOf(templateElement), 1);
|
|
@@ -89,34 +90,33 @@ angular.module('niceElements')
|
|
|
89
90
|
|
|
90
91
|
$timeout(reposite);
|
|
91
92
|
|
|
92
|
-
}).error(function(data){
|
|
93
|
-
throw new Error('Template ('+args.template+') could not be loaded. ' + data);
|
|
93
|
+
}).error(function (data) {
|
|
94
|
+
throw new Error('Template (' + args.template + ') could not be loaded. ' + data);
|
|
94
95
|
});
|
|
95
|
-
|
|
96
96
|
};
|
|
97
97
|
|
|
98
|
-
notify.config = function(args){
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
notify.config = function (args) {
|
|
99
|
+
startTop = args.top ? args.top : startTop;
|
|
100
|
+
verticalSpacing = args.verticalSpacing ? args.verticalSpacing : verticalSpacing;
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
-
notify.primary = function() {
|
|
103
|
+
notify.primary = function (args) {
|
|
104
104
|
this(args, '');
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
-
notify.error = function(args) {
|
|
107
|
+
notify.error = function (args) {
|
|
108
108
|
this(args, 'error');
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
-
notify.success = function(args) {
|
|
111
|
+
notify.success = function (args) {
|
|
112
112
|
this(args, 'success');
|
|
113
113
|
};
|
|
114
114
|
|
|
115
|
-
notify.info = function(args) {
|
|
115
|
+
notify.info = function (args) {
|
|
116
116
|
this(args, 'info');
|
|
117
117
|
};
|
|
118
118
|
|
|
119
|
-
notify.warning = function(args) {
|
|
119
|
+
notify.warning = function (args) {
|
|
120
120
|
this(args, 'warning');
|
|
121
121
|
};
|
|
122
122
|
|
|
@@ -133,7 +133,7 @@ angular.module('niceElements')
|
|
|
133
133
|
$scope.$watch("model", function (oldModel, newModel) {
|
|
134
134
|
$scope.check();
|
|
135
135
|
if ($scope.onChange && oldModel != newModel) {
|
|
136
|
-
$timeout(function() {
|
|
136
|
+
$timeout(function () {
|
|
137
137
|
$scope.onChange({ model: $scope.model });
|
|
138
138
|
})
|
|
139
139
|
}
|
|
@@ -142,7 +142,7 @@ angular.module('niceElements')
|
|
|
142
142
|
|
|
143
143
|
// Add to the value
|
|
144
144
|
$scope.add = function () {
|
|
145
|
-
|
|
145
|
+
const result = new Decimal($scope.model != undefined ? $scope.model : $scope.defaultValue).plus($scope.step).toNumber(); //.toFixed($scope.decimals);
|
|
146
146
|
if ($scope.max) {
|
|
147
147
|
if (result <= parseFloat($scope.max)) {
|
|
148
148
|
$scope.model = result;
|
|
@@ -158,7 +158,7 @@ angular.module('niceElements')
|
|
|
158
158
|
|
|
159
159
|
// Subtract to the value
|
|
160
160
|
$scope.subtract = function () {
|
|
161
|
-
|
|
161
|
+
const result = new Decimal($scope.model != undefined ? $scope.model : $scope.defaultValue).minus($scope.step).toNumber();
|
|
162
162
|
if (result >= Number($scope.min)) {
|
|
163
163
|
$scope.model = result;
|
|
164
164
|
$scope.niceNumberForm.$setDirty();
|
|
@@ -54,8 +54,8 @@ angular.module('niceElements')
|
|
|
54
54
|
// Setup popper
|
|
55
55
|
// https://popper.js.org/docs/v2/constructors/
|
|
56
56
|
$scope.setupPopper = function () {
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
const target = $element[0].getElementsByClassName('nice-popup-target')[0];
|
|
58
|
+
const content = $element[0].getElementsByClassName('nice-popup-content')[0];
|
|
59
59
|
$scope.popper = Popper.createPopper(target, content, {
|
|
60
60
|
placement: $scope.placement,
|
|
61
61
|
strategy: $scope.strategy,
|
|
@@ -71,7 +71,7 @@ angular.module('niceElements')
|
|
|
71
71
|
scope.modelString = scope.model;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
const setValid = function (isValid) {
|
|
75
75
|
if (scope.required && scope.form) {
|
|
76
76
|
scope.form.$setValidity('objectSelected', isValid);
|
|
77
77
|
}
|
|
@@ -116,8 +116,8 @@ angular.module('niceElements')
|
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
// Close the dropdown if clicked outside
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
const onClick = function (event) {
|
|
120
|
+
const isClickedElementChildOfPopup = element.find(event.target).length > 0;
|
|
121
121
|
|
|
122
122
|
if (isClickedElementChildOfPopup) return;
|
|
123
123
|
|
|
@@ -129,7 +129,7 @@ angular.module('niceElements')
|
|
|
129
129
|
angular.element(element).on('click', onClick);
|
|
130
130
|
|
|
131
131
|
// Keyboard up/down on search results
|
|
132
|
-
|
|
132
|
+
const onKeyDown = function (event) {
|
|
133
133
|
if ((event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13 || event.keyCode == 27) && scope.results && scope.results.length > 0) {
|
|
134
134
|
event.preventDefault();
|
|
135
135
|
|
|
@@ -171,7 +171,7 @@ angular.module('niceElements')
|
|
|
171
171
|
$scope.requests = 0;
|
|
172
172
|
|
|
173
173
|
$scope.focus = function () {
|
|
174
|
-
|
|
174
|
+
const input = $element[0].getElementsByTagName('input')[0];
|
|
175
175
|
if (input) {
|
|
176
176
|
input.focus();
|
|
177
177
|
}
|
|
@@ -183,7 +183,7 @@ angular.module('niceElements')
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
$scope.results = [];
|
|
186
|
-
|
|
186
|
+
const updateList = function (results, requestNumber) {
|
|
187
187
|
|
|
188
188
|
if (results) {
|
|
189
189
|
if ($scope.requests == requestNumber) {
|
|
@@ -202,13 +202,16 @@ angular.module('niceElements')
|
|
|
202
202
|
$scope.updateSearch = function () {
|
|
203
203
|
$scope.loading = true;
|
|
204
204
|
|
|
205
|
-
if ($scope.timer_promise)
|
|
206
|
-
$timeout.cancel($scope.timer_promise);
|
|
205
|
+
if ($scope.timer_promise) $timeout.cancel($scope.timer_promise);
|
|
207
206
|
|
|
208
207
|
$scope.timer_promise = $timeout(function () {
|
|
209
208
|
if ($scope.onChange) $scope.onChange({ model: $scope.model, modelString: $scope.modelString });
|
|
209
|
+
if (!$scope.refreshFunction) {
|
|
210
|
+
$scope.loading = false;
|
|
211
|
+
return console.warn("[NICE ELEMENTS] No refresh function set to the nice-search component!");
|
|
212
|
+
}
|
|
210
213
|
$scope.requests = $scope.requests + 1;
|
|
211
|
-
|
|
214
|
+
const requestNumber = angular.copy($scope.requests);
|
|
212
215
|
$scope.refreshFunction($scope.modelString).then(function (response) {
|
|
213
216
|
updateList(response, requestNumber);
|
|
214
217
|
}, function (error) {
|
|
@@ -30,7 +30,8 @@ angular.module('niceElements')
|
|
|
30
30
|
keyForInputLabel: '@',
|
|
31
31
|
debounceTime: '@',
|
|
32
32
|
isInline: '=',
|
|
33
|
-
help: '@'
|
|
33
|
+
help: '@',
|
|
34
|
+
placement: '@', // Describes the preferred placement of the popper
|
|
34
35
|
},
|
|
35
36
|
controller: function ($scope, $timeout, $element) {
|
|
36
37
|
$scope.loading = false;
|
|
@@ -43,15 +44,16 @@ angular.module('niceElements')
|
|
|
43
44
|
|
|
44
45
|
if (!$scope.debounceTime) $scope.debounceTime = 500;
|
|
45
46
|
if (!$scope.model) $scope.model = "";
|
|
47
|
+
if (!$scope.placement) { $scope.placement = "bottom-start"; }
|
|
46
48
|
|
|
47
49
|
// Setup popper
|
|
48
50
|
// https://popper.js.org/docs/v2/constructors/
|
|
49
51
|
$scope.setupPopper = function () {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
const button = $element[0].getElementsByClassName('nice-search-button')[0];
|
|
53
|
+
const tooltip = $element[0].getElementsByClassName('nice-search-dropdown-wrapper')[0];
|
|
52
54
|
$scope.popper = Popper.createPopper(button, tooltip, {
|
|
53
55
|
strategy: 'fixed',
|
|
54
|
-
placement:
|
|
56
|
+
placement: $scope.placement,
|
|
55
57
|
modifiers: [
|
|
56
58
|
{
|
|
57
59
|
name: 'offset',
|
|
@@ -65,11 +67,11 @@ angular.module('niceElements')
|
|
|
65
67
|
phase: "beforeWrite",
|
|
66
68
|
requires: ["computeStyles"],
|
|
67
69
|
fn: function (e) {
|
|
68
|
-
|
|
70
|
+
const state = e.state;
|
|
69
71
|
state.styles.popper.width = state.rects.reference.width + "px";
|
|
70
72
|
},
|
|
71
73
|
effect: function (e) {
|
|
72
|
-
|
|
74
|
+
const state = e.state;
|
|
73
75
|
state.elements.popper.style.width = state.elements.reference.offsetWidth + "px";
|
|
74
76
|
}
|
|
75
77
|
}
|
|
@@ -90,7 +92,7 @@ angular.module('niceElements')
|
|
|
90
92
|
|
|
91
93
|
$scope.open();
|
|
92
94
|
|
|
93
|
-
|
|
95
|
+
const input = $element[0].getElementsByTagName('input')[0];
|
|
94
96
|
if (input) input.focus();
|
|
95
97
|
};
|
|
96
98
|
|
|
@@ -114,7 +116,7 @@ angular.module('niceElements')
|
|
|
114
116
|
$scope.close = function () {
|
|
115
117
|
$scope.isOpen = false;
|
|
116
118
|
|
|
117
|
-
|
|
119
|
+
const input = $element[0].getElementsByTagName('input')[0];
|
|
118
120
|
if (input) input.blur();
|
|
119
121
|
|
|
120
122
|
$timeout(function () {
|
|
@@ -141,7 +143,7 @@ angular.module('niceElements')
|
|
|
141
143
|
if ($scope.refreshFunction != null) {
|
|
142
144
|
$scope.loading = true;
|
|
143
145
|
$scope.requestNumber += 1;
|
|
144
|
-
|
|
146
|
+
const requestNumber = angular.copy($scope.requestNumber);
|
|
145
147
|
$scope.refreshFunction(keywords).then(function (results) {
|
|
146
148
|
if ($scope.requestNumber == requestNumber) {
|
|
147
149
|
$timeout(function () {
|
|
@@ -156,7 +158,7 @@ angular.module('niceElements')
|
|
|
156
158
|
}
|
|
157
159
|
});
|
|
158
160
|
}
|
|
159
|
-
}, function (
|
|
161
|
+
}, function () {
|
|
160
162
|
$scope.loading = false;
|
|
161
163
|
$scope.close();
|
|
162
164
|
});
|
|
@@ -204,10 +206,10 @@ angular.module('niceElements')
|
|
|
204
206
|
|
|
205
207
|
// ----------------------------------- Scroll to hover -----------------------------------
|
|
206
208
|
$scope.scrollToHover = function (notSmooth) {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
+
const dropdownMenu = $element[0].getElementsByClassName("nice-dropdown")[0];
|
|
210
|
+
const hoverItem = dropdownMenu.getElementsByClassName("active")[0];
|
|
209
211
|
if (hoverItem) {
|
|
210
|
-
|
|
212
|
+
const topPos = hoverItem.offsetTop;
|
|
211
213
|
dropdownMenu.scroll({
|
|
212
214
|
top: topPos - 120,
|
|
213
215
|
left: 0,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.nice-table-wrapper {
|
|
2
|
-
min-height: .01%;
|
|
2
|
+
min-height: 0.01%;
|
|
3
3
|
overflow-x: auto;
|
|
4
4
|
|
|
5
5
|
.nice-table {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
.nice-table-freeze-right {
|
|
15
15
|
position: sticky;
|
|
16
16
|
background: var(--nice-card-bg-opacity);
|
|
17
|
-
backdrop-filter: blur(3px);
|
|
17
|
+
// backdrop-filter: blur(3px);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
.nice-table-freeze-left {
|
|
@@ -109,4 +109,4 @@
|
|
|
109
109
|
margin-top: -1px;
|
|
110
110
|
border-top: 1px solid var(--nice-border-color);
|
|
111
111
|
}
|
|
112
|
-
}
|
|
112
|
+
}
|
|
@@ -40,7 +40,7 @@ angular.module('niceElements')
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
$scope.checkDate = function (date) {
|
|
43
|
-
|
|
43
|
+
const parsedDate = moment(date, "HH:mm");
|
|
44
44
|
if (parsedDate.isValid()) {
|
|
45
45
|
if ($scope.forma) $scope.forma.$setValidity("valid-time", true);
|
|
46
46
|
$scope.model = parsedDate;
|
|
@@ -29,7 +29,7 @@ angular.module('niceElements')
|
|
|
29
29
|
// -------------------------- Create toast --------------------------
|
|
30
30
|
$scope.createToast = function (message, type) {
|
|
31
31
|
// Create new toast
|
|
32
|
-
|
|
32
|
+
const toast = {
|
|
33
33
|
id: Math.random().toString(36).replace(/[^a-z]+/g, '').substr(2, 10),
|
|
34
34
|
message: message,
|
|
35
35
|
type: type || "default"
|
|
@@ -47,7 +47,7 @@ angular.module('niceElements')
|
|
|
47
47
|
|
|
48
48
|
// -------------------------- Remove toast --------------------------
|
|
49
49
|
$scope.removeToast = function (toast) {
|
|
50
|
-
|
|
50
|
+
const toastIndex = $scope.toasts.findIndex(function (a) { return a.id == toast.id })
|
|
51
51
|
if (toastIndex >= 0) {
|
|
52
52
|
$scope.toasts.splice(toastIndex, 1);
|
|
53
53
|
}
|
|
@@ -48,7 +48,7 @@ angular.module('niceElements')
|
|
|
48
48
|
|
|
49
49
|
scope.dragging = false;
|
|
50
50
|
scope.draggingGlobal = false;
|
|
51
|
-
|
|
51
|
+
const inputElement = element[0].querySelector(".input-file");
|
|
52
52
|
// document.addEventListener("dragenter", scope.startDraggingGlobal);
|
|
53
53
|
// document.addEventListener("drop", scope.endDraggingGlobal);
|
|
54
54
|
// document.addEventListener("dragend", scope.endDraggingGlobal);
|
|
@@ -80,12 +80,12 @@ angular.module('niceElements')
|
|
|
80
80
|
$timeout(function () {
|
|
81
81
|
scope.loading = true;
|
|
82
82
|
scope.error = null;
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
const inputObj = changeEvent.target;
|
|
84
|
+
const reader = new FileReader();
|
|
85
85
|
|
|
86
86
|
if (inputObj.files) {
|
|
87
87
|
try {
|
|
88
|
-
|
|
88
|
+
const fileSize = inputObj.files[0].size; // in bytes
|
|
89
89
|
|
|
90
90
|
reader.onload = function (event) {
|
|
91
91
|
$timeout(function () {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
.nice-view {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
height: 100dvh;
|
|
5
|
+
--nice-view-padding: 2rem;
|
|
6
|
+
|
|
7
|
+
&.nice-view-has-header {
|
|
8
|
+
.nice-view-body {
|
|
9
|
+
padding-top: calc(var(--nice-view-padding) / 2);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&.nice-view-has-footer {
|
|
14
|
+
.nice-view-body {
|
|
15
|
+
padding-bottom: calc(var(--nice-view-padding) / 2);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.nice-view-header {
|
|
20
|
+
flex-shrink: 0;
|
|
21
|
+
padding: var(--nice-view-padding);
|
|
22
|
+
padding-bottom: calc(var(--nice-view-padding) / 2);
|
|
23
|
+
|
|
24
|
+
.nice-view-header-wrapper {
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
|
|
28
|
+
.nice-icon {
|
|
29
|
+
height: 50px;
|
|
30
|
+
width: 50px;
|
|
31
|
+
margin-right: 1rem;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.nice-view-header-title {
|
|
36
|
+
font-size: 2em;
|
|
37
|
+
line-height: 1;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.nice-view-header-subtitle {
|
|
41
|
+
text-transform: uppercase;
|
|
42
|
+
color: var(--nice-primary-color);
|
|
43
|
+
margin-bottom: 3px;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.nice-view-body {
|
|
48
|
+
flex-grow: 1;
|
|
49
|
+
overflow: auto;
|
|
50
|
+
padding: var(--nice-view-padding);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.nice-view-footer {
|
|
54
|
+
flex-shrink: 0;
|
|
55
|
+
padding: var(--nice-view-padding);
|
|
56
|
+
padding-top: calc(var(--nice-view-padding) / 2);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@media (max-width: 767px) {
|
|
60
|
+
--nice-view-padding: 1rem;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<form class="nice-view" ng-submit="submit" ng-class="{ 'nice-view-has-header': hasHeader, 'nice-view-has-footer': hasFooter }">
|
|
2
|
+
<div class="nice-view-header" ng-if="hasHeader">
|
|
3
|
+
<div class="nice-view-header-wrapper">
|
|
4
|
+
<nice-icon ng-if="niceIcon" icon="{{ niceIcon }}"></nice-icon>
|
|
5
|
+
<div>
|
|
6
|
+
<div class="nice-view-header-subtitle">{{ niceSubtitle }}</div>
|
|
7
|
+
<div class="nice-view-header-title">{{ niceTitle }}</div>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="nice-view-body" ng-transclude></div>
|
|
12
|
+
<div class="nice-view-footer" ng-if="hasFooter" ng-transclude="footer"></div>
|
|
13
|
+
</form>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @ngdoc directive
|
|
5
|
+
* @name niceElements.directive:niceView
|
|
6
|
+
* @description
|
|
7
|
+
* # niceView
|
|
8
|
+
*/
|
|
9
|
+
angular.module('niceElements')
|
|
10
|
+
.directive('niceView', function () {
|
|
11
|
+
return {
|
|
12
|
+
templateUrl: 'src/components/nice-view/nice-view.html',
|
|
13
|
+
restrict: 'E',
|
|
14
|
+
replace: true,
|
|
15
|
+
transclude: {
|
|
16
|
+
'header': '?niceViewHeader',
|
|
17
|
+
'footer': '?niceViewFooter'
|
|
18
|
+
},
|
|
19
|
+
scope: {
|
|
20
|
+
niceTitle: '@',
|
|
21
|
+
niceSubtitle: '@',
|
|
22
|
+
niceIcon: '@',
|
|
23
|
+
submit: '=',
|
|
24
|
+
},
|
|
25
|
+
controller: function ($scope, $transclude) {
|
|
26
|
+
$scope.hasHeader = $transclude.isSlotFilled('header') || $scope.niceTitle || $scope.niceSubtitle || $scope.niceIcon;
|
|
27
|
+
$scope.hasFooter = $transclude.isSlotFilled('footer');
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
});
|
|
@@ -33,7 +33,7 @@ angular.module('niceElements')
|
|
|
33
33
|
$scope.hasTitle = $transclude.isSlotFilled('title');
|
|
34
34
|
$scope.hasSubtitle = $transclude.isSlotFilled('subtitle');
|
|
35
35
|
$scope.hasFooter = $transclude.isSlotFilled('footer');
|
|
36
|
-
$scope.hasHeader = $scope.hasTitle || $scope.hasSubtitle || $scope.title || $scope.subtitle || $scope.collapsable;
|
|
36
|
+
$scope.hasHeader = $scope.hasTitle || $scope.hasSubtitle || $scope.title || $scope.niceTitle || $scope.subtitle || $scope.collapsable;
|
|
37
37
|
|
|
38
38
|
$scope.toggle = function () {
|
|
39
39
|
if (!$scope.collapsable) return;
|
package/src/filters/nice-date.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
angular.module('niceElements').filter('niceDate', function () {
|
|
10
10
|
return function (object, addTime, addSeconds) {
|
|
11
|
-
|
|
11
|
+
let formatString = "D.M.YYYY";
|
|
12
12
|
if (addTime) {
|
|
13
13
|
formatString = "D.M.YYYY • H:mm";
|
|
14
14
|
if (addSeconds) formatString += ":ss";
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
angular.module('niceElements').filter('niceHighlight', function () {
|
|
10
10
|
return function (value, highlightedText) {
|
|
11
11
|
if (!value) return "";
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const regex = new RegExp(highlightedText, 'gmi');
|
|
13
|
+
const newValue = String(value).replace(regex, "<span class='nice-highligh'>$&</span>");
|
|
14
14
|
return newValue;
|
|
15
15
|
};
|
|
16
16
|
});
|
package/src/styles/_nice.scss
CHANGED
|
@@ -65,4 +65,5 @@
|
|
|
65
65
|
@import "../components/nice-toggle/nice-toggle";
|
|
66
66
|
@import "../components/nice-no-data/nice-no-data";
|
|
67
67
|
@import "../components/nice-table/nice-table";
|
|
68
|
-
@import "../
|
|
68
|
+
@import "../components/nice-view/nice-view";
|
|
69
|
+
@import "../modals/nice-multilangual-modal/nice-multilangual-modal";
|
|
@@ -124,6 +124,7 @@ $nice-table-bg-active: #f5f5f5 !default;
|
|
|
124
124
|
--nice-font-family: #{$nice-font-family};
|
|
125
125
|
--nice-font-weight: #{$nice-font-weight};
|
|
126
126
|
--nice-font-color: #{$nice-font-color};
|
|
127
|
+
--nice-font-color-lighter: #767676;
|
|
127
128
|
|
|
128
129
|
// ---------- Common ----------
|
|
129
130
|
--nice-hover-color: #{$nice-hover-color};
|
|
@@ -177,7 +178,7 @@ $nice-table-bg-active: #f5f5f5 !default;
|
|
|
177
178
|
// ---------- Card ----------
|
|
178
179
|
--nice-card-border: #{$nice-border-color};
|
|
179
180
|
--nice-card-bg: white;
|
|
180
|
-
--nice-card-bg-opacity: rgba(255, 255, 255, 0.
|
|
181
|
+
--nice-card-bg-opacity: rgba(255, 255, 255, 0.9);
|
|
181
182
|
--nice-card-padding: 2rem;
|
|
182
183
|
|
|
183
184
|
// ---------- Input ----------
|