nice-elements 1.12.4 → 1.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/bower.json +1 -1
- package/dist/nice.js +100 -65
- package/dist/nice.min.js +1 -1
- package/dist/style.css +28 -6
- package/dist/style.css.map +1 -1
- package/dist/style.min.css +2 -2
- package/package.json +1 -1
- package/src/components/nice-checkbox/nice-checkbox.html +5 -1
- package/src/components/nice-checkbox/nice-checkbox.js +3 -0
- package/src/components/nice-checkbox/nice-checkbox.scss +32 -3
- package/src/components/nice-date/nice-date.js +2 -2
- package/src/components/nice-date-input/nice-date-input.html +44 -37
- package/src/components/nice-date-input/nice-date-input.js +36 -21
- package/src/components/nice-date-input/nice-date-input.scss +4 -2
- package/src/components/nice-input/nice-input.html +1 -1
- package/src/components/nice-input/nice-input.js +1 -0
- package/src/components/nice-title/nice-title.html +4 -1
- package/src/components/nice-title/nice-title.js +1 -0
- package/src/components/nice-toggle/nice-toggle.html +1 -1
- package/src/components/nice-toggle/nice-toggle.js +1 -0
- package/src/services/nice-service.js +2 -2
- package/src/styles/_nice-common.scss +10 -2
- package/src/styles/_variables.scss +0 -1
package/package.json
CHANGED
|
@@ -2,5 +2,9 @@
|
|
|
2
2
|
<button type="button" class="btn nice-checkbox-checkbox" ng-disabled="isDisabled">
|
|
3
3
|
<nice-icon class="nice-checkbox-check" icon="icon-check"></nice-icon>
|
|
4
4
|
</button>
|
|
5
|
-
<div
|
|
5
|
+
<div class="nice-checkbox-info" ng-transclude>
|
|
6
|
+
<nice-title text="title || niceTitle" help="help" required="required" description="niceDescription" label-width="col-xs-12"></nice-title>
|
|
7
|
+
<!-- <div ng-if="title || niceTitle" class="nice-checkbox-message" ng-class="{ 'nice-disabled': isDisabled }">{{ title || niceTitle }}</div> -->
|
|
8
|
+
<!-- <div ng-if="niceDescription" class="nice-checkbox-description" ng-class="{ 'nice-disabled': isDisabled }">{{ niceDescription }}</div> -->
|
|
9
|
+
</div>
|
|
6
10
|
</div>
|
|
@@ -11,14 +11,17 @@ angular.module('niceElements')
|
|
|
11
11
|
return {
|
|
12
12
|
templateUrl: 'src/components/nice-checkbox/nice-checkbox.html',
|
|
13
13
|
restrict: 'E',
|
|
14
|
+
transclude: true,
|
|
14
15
|
scope: {
|
|
15
16
|
model: '=',
|
|
16
17
|
niceTitle: '@',
|
|
18
|
+
niceDescription: '@',
|
|
17
19
|
title: '@',
|
|
18
20
|
titleOnLeft: '=',
|
|
19
21
|
noMargin: '@',
|
|
20
22
|
clickDisabled: '@',
|
|
21
23
|
onChange: '&?',
|
|
24
|
+
help: '@',
|
|
22
25
|
isDisabled: '=',
|
|
23
26
|
},
|
|
24
27
|
controller: function ($scope) {
|
|
@@ -6,6 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
&.nice-checkbox-left {
|
|
8
8
|
flex-direction: row-reverse;
|
|
9
|
+
|
|
10
|
+
.nice-checkbox-info {
|
|
11
|
+
text-align: right;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.nice-title {
|
|
15
|
+
text-align: right;
|
|
16
|
+
}
|
|
9
17
|
}
|
|
10
18
|
|
|
11
19
|
.nice-checkbox-checkbox {
|
|
@@ -32,11 +40,32 @@
|
|
|
32
40
|
}
|
|
33
41
|
}
|
|
34
42
|
|
|
35
|
-
.nice-
|
|
36
|
-
|
|
37
|
-
|
|
43
|
+
.nice-title {
|
|
44
|
+
padding-right: 0;
|
|
45
|
+
padding-left: 0;
|
|
46
|
+
text-align: left;
|
|
47
|
+
min-height: unset;
|
|
48
|
+
|
|
49
|
+
.nice-title-text {
|
|
50
|
+
text-align: inherit;
|
|
51
|
+
}
|
|
38
52
|
}
|
|
39
53
|
|
|
54
|
+
// .nice-checkbox-info {
|
|
55
|
+
// display: flex;
|
|
56
|
+
// flex-direction: column;
|
|
57
|
+
// }
|
|
58
|
+
|
|
59
|
+
// .nice-checkbox-message {
|
|
60
|
+
// user-select: none;
|
|
61
|
+
// color: var(--nice-font-color);
|
|
62
|
+
// }
|
|
63
|
+
|
|
64
|
+
// .nice-checkbox-description {
|
|
65
|
+
// font-size: .8em;
|
|
66
|
+
// font-style: italic;
|
|
67
|
+
// }
|
|
68
|
+
|
|
40
69
|
&:hover {
|
|
41
70
|
.nice-checkbox-checkbox {
|
|
42
71
|
border-color: var(--nice-choice-hover-border);
|
|
@@ -88,7 +88,7 @@ angular.module('niceElements')
|
|
|
88
88
|
{ value: 9, name: gettextCatalog.getString("October", null, "Nice") },
|
|
89
89
|
{ value: 10, name: gettextCatalog.getString("November", null, "Nice") },
|
|
90
90
|
{ value: 11, name: gettextCatalog.getString("December", null, "Nice") }
|
|
91
|
-
]
|
|
91
|
+
];
|
|
92
92
|
|
|
93
93
|
if ($scope.maxDate) $scope.maxDate = moment($scope.maxDate);
|
|
94
94
|
if ($scope.minDate) $scope.minDate = moment($scope.minDate);
|
|
@@ -259,7 +259,7 @@ angular.module('niceElements')
|
|
|
259
259
|
// ------------------ Build month ------------------
|
|
260
260
|
$scope._buildMonth = function () {
|
|
261
261
|
let done = false;
|
|
262
|
-
const date = angular.copy($scope.innerDate.date).startOf("month").startOf('week');
|
|
262
|
+
const date = angular.copy($scope.innerDate.date).startOf("month").startOf('week').isoWeekday(1);
|
|
263
263
|
let monthIndex = date.month();
|
|
264
264
|
let count = 0;
|
|
265
265
|
|
|
@@ -1,50 +1,57 @@
|
|
|
1
|
-
<
|
|
1
|
+
<ng-form class="nice-component nice-date-input" name="niceDateInputForm" ng-class="{ 'margin-bottom-0': noMargin, 'nice-component-inline': isInline, 'error': niceDateInputForm.$invalid, 'nice-date-input-no-date': !date }">
|
|
2
2
|
<div class="row">
|
|
3
3
|
<!------------------------- Title ------------------------->
|
|
4
4
|
<nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
|
|
5
5
|
|
|
6
6
|
<!------------------------- Field ------------------------->
|
|
7
7
|
<div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
|
|
8
|
-
<div class="
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
<nice-popup
|
|
12
|
-
<
|
|
13
|
-
<
|
|
14
|
-
<
|
|
15
|
-
|
|
8
|
+
<div class="nice-date-field">
|
|
9
|
+
<div class="input-group nice-date-input" ng-show="date" ng-class="{ 'has-warning': !disabled && niceDateInputForm.$invalid && niceDateInputForm.$dirty }">
|
|
10
|
+
<input type="text" class="form-control nice-date-input-field" ng-model="modelDate" placeholder="{{ placeholderDate }}" ng-blur="dateBlur($event)" ng-required="required" ng-disabled="isDisabled">
|
|
11
|
+
<nice-popup placement="bottom">
|
|
12
|
+
<nice-popup-target>
|
|
13
|
+
<span class="input-group-btns input-group-btn">
|
|
14
|
+
<button type="button" class="btn btn-default btn-right" ng-if="model && nullable" tabindex="-1" ng-disabled="isDisabled" ng-click="clear()">
|
|
15
|
+
<nice-icon icon="icon-x"></nice-icon>
|
|
16
|
+
</button>
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
<button type="button" class="btn btn-default btn-right" tabindex="-1" ng-disabled="isDisabled">
|
|
19
|
+
<nice-icon icon="icon-calendar"></nice-icon>
|
|
20
|
+
</button>
|
|
21
|
+
</span>
|
|
22
|
+
</nice-popup-target>
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
<nice-popup
|
|
32
|
-
<
|
|
33
|
-
<
|
|
34
|
-
<
|
|
35
|
-
|
|
24
|
+
<nice-popup-content>
|
|
25
|
+
<nice-date is-inline="true" inline="true" model="inner.dateModel" on-change="dateChanged()" no-margin="true" min-date="minDate" max-date="maxDate" is-disabled="isDisabled"></nice-date>
|
|
26
|
+
</nice-popup-content>
|
|
27
|
+
</nice-popup>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<div class="input-group nice-time-input" ng-show="time" ng-class="{ 'has-warning': !disabled && niceDateInputForm.$invalid && niceDateInputForm.$dirty }">
|
|
31
|
+
<input type="text" class="form-control nice-time-input-field" ng-model="modelTime" placeholder="{{ placeholderTime }}" ng-blur="timeBlur($event)" ng-required="required" ng-disabled="isDisabled">
|
|
32
|
+
<nice-popup placement="bottom">
|
|
33
|
+
<nice-popup-target>
|
|
34
|
+
<span class="input-group-btns input-group-btn">
|
|
35
|
+
<button type="button" class="btn btn-default btn-right" ng-if="model && nullable && !date" tabindex="-1" ng-disabled="isDisabled" ng-click="clear()">
|
|
36
|
+
<nice-icon icon="icon-x"></nice-icon>
|
|
37
|
+
</button>
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
<button type="button" class="btn btn-default btn-right" tabindex="-1" ng-disabled="isDisabled">
|
|
40
|
+
<nice-icon icon="icon-clock"></nice-icon>
|
|
41
|
+
</button>
|
|
42
|
+
</span>
|
|
43
|
+
</nice-popup-target>
|
|
44
|
+
|
|
45
|
+
<nice-popup-content>
|
|
46
|
+
<nice-date is-inline="true" inline="true" model="inner.timeModel" on-change="timeChanged()" time="true" date="false" no-margin="true" is-disabled="isDisabled"></nice-date>
|
|
47
|
+
</nice-popup-content>
|
|
48
|
+
</nice-popup>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
42
51
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
</nice-popup-content>
|
|
46
|
-
</nice-popup>
|
|
52
|
+
<div class="error-message" ng-if="error">
|
|
53
|
+
<div class="error-message">{{ error }}</div>
|
|
47
54
|
</div>
|
|
48
55
|
</div>
|
|
49
56
|
</div>
|
|
50
|
-
</
|
|
57
|
+
</ng-form>
|
|
@@ -16,8 +16,8 @@ angular.module('niceElements')
|
|
|
16
16
|
model: '=', // binding model
|
|
17
17
|
date: '=?', // default: true, is date picker enabled?
|
|
18
18
|
time: '=?', // default: false, is time picker enabled?
|
|
19
|
-
minDate: '
|
|
20
|
-
maxDate: '
|
|
19
|
+
minDate: '=', // default: undefined
|
|
20
|
+
maxDate: '=', // default: undefined
|
|
21
21
|
niceTitle: '@',
|
|
22
22
|
title: '@', // default: ''
|
|
23
23
|
noMargin: '@', // default: false, if noMargin==true then entire directive can be injected inside other divs
|
|
@@ -32,9 +32,10 @@ angular.module('niceElements')
|
|
|
32
32
|
placeholderDate: '@',
|
|
33
33
|
placeholderTime: '@',
|
|
34
34
|
},
|
|
35
|
-
controller: function ($scope, $timeout, gettextCatalog) {
|
|
35
|
+
controller: function ($scope, $element, $timeout, gettextCatalog) {
|
|
36
36
|
$scope.formatDate = "DD.MM.YYYY";
|
|
37
37
|
$scope.formatTime = "HH:mm";
|
|
38
|
+
$scope.error = '';
|
|
38
39
|
if ($scope.date === undefined) $scope.date = true;
|
|
39
40
|
if ($scope.time === undefined) $scope.time = true;
|
|
40
41
|
if (!$scope.placeholderDate) { $scope.placeholderDate = gettextCatalog.getString("••.••.••••", null, "Nice"); }
|
|
@@ -45,6 +46,12 @@ angular.module('niceElements')
|
|
|
45
46
|
dateModel: angular.copy($scope.model || moment()),
|
|
46
47
|
};
|
|
47
48
|
|
|
49
|
+
$scope.dateInput = null;
|
|
50
|
+
const timeInput = $element[0].getElementsByClassName("nice-time-input-field");
|
|
51
|
+
const dateInput = $element[0].getElementsByClassName("nice-date-input-field");
|
|
52
|
+
if (timeInput && timeInput[0]) $scope.dateInput = timeInput[0];
|
|
53
|
+
if (dateInput && dateInput[0]) $scope.dateInput = dateInput[0];
|
|
54
|
+
|
|
48
55
|
$scope.dateChanged = function () {
|
|
49
56
|
$timeout(function () {
|
|
50
57
|
$scope.modelDate = $scope.inner.dateModel.format($scope.formatDate);
|
|
@@ -64,12 +71,25 @@ angular.module('niceElements')
|
|
|
64
71
|
if (!$scope.date) $scope.modelDate = moment().format($scope.formatDate);
|
|
65
72
|
const newModel = moment($scope.modelDate + " " + $scope.modelTime, $scope.formatDate + " " + $scope.formatTime).seconds(0).milliseconds(0);
|
|
66
73
|
if (newModel.isValid()) {
|
|
67
|
-
$scope.
|
|
68
|
-
|
|
74
|
+
if ($scope.minDate && newModel.isBefore($scope.minDate)) {
|
|
75
|
+
// $scope.model = null;
|
|
76
|
+
$scope.niceDateInputForm.$setValidity('valid-date', false);
|
|
77
|
+
$scope.error = gettextCatalog.getString("Minimum date is {{date}}", { date: $scope.format($scope.minDate) }, "Nice");
|
|
78
|
+
} else if ($scope.maxDate && newModel.isAfter($scope.maxDate)) {
|
|
79
|
+
// $scope.model = null;
|
|
80
|
+
$scope.error = gettextCatalog.getString("Maximum date is {{date}}", { date: $scope.format($scope.maxDate) }, "Nice");
|
|
81
|
+
$scope.niceDateInputForm.$setValidity('valid-date', false);
|
|
82
|
+
} else {
|
|
83
|
+
$scope.model = newModel;
|
|
84
|
+
$scope.error = '';
|
|
85
|
+
$scope.niceDateInputForm.$setValidity('valid-date', null);
|
|
86
|
+
}
|
|
69
87
|
} else {
|
|
70
|
-
$scope.model = null;
|
|
71
|
-
$scope.
|
|
88
|
+
// $scope.model = null;
|
|
89
|
+
$scope.error = gettextCatalog.getString("Date is not valid", null, "Nice");
|
|
90
|
+
$scope.niceDateInputForm.$setValidity('valid-date', false);
|
|
72
91
|
}
|
|
92
|
+
if ($scope.dateInput) $scope.dateInput.setCustomValidity($scope.error);
|
|
73
93
|
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
74
94
|
$scope.niceDateInputForm.$setDirty();
|
|
75
95
|
};
|
|
@@ -77,6 +97,8 @@ angular.module('niceElements')
|
|
|
77
97
|
// -------------------- Clear --------------------
|
|
78
98
|
$scope.clear = function () {
|
|
79
99
|
$scope.model = null;
|
|
100
|
+
$scope.error = '';
|
|
101
|
+
if ($scope.dateInput) $scope.dateInput.setCustomValidity($scope.error);
|
|
80
102
|
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
81
103
|
$scope.niceDateInputForm.$setDirty();
|
|
82
104
|
};
|
|
@@ -93,26 +115,19 @@ angular.module('niceElements')
|
|
|
93
115
|
};
|
|
94
116
|
$scope.formatModel();
|
|
95
117
|
|
|
118
|
+
// -------------------- Format date --------------------
|
|
119
|
+
$scope.format = function (date) {
|
|
120
|
+
return moment(date).format($scope.formatDate + ($scope.time ? (" • " + $scope.formatTime) : ""));
|
|
121
|
+
};
|
|
122
|
+
|
|
96
123
|
// -------------------- Date --------------------
|
|
97
124
|
$scope.dateBlur = function () {
|
|
98
|
-
|
|
99
|
-
if (newDate.isValid()) {
|
|
100
|
-
$scope.niceDateInputForm.$setValidity('validDate', true);
|
|
101
|
-
$scope.handleChange();
|
|
102
|
-
} else {
|
|
103
|
-
$scope.niceDateInputForm.$setValidity('validDate', false);
|
|
104
|
-
}
|
|
125
|
+
$scope.handleChange();
|
|
105
126
|
};
|
|
106
127
|
|
|
107
128
|
// -------------------- Time --------------------
|
|
108
129
|
$scope.timeBlur = function () {
|
|
109
|
-
|
|
110
|
-
if (newTime.isValid()) {
|
|
111
|
-
$scope.niceDateInputForm.$setValidity('validDate', true);
|
|
112
|
-
$scope.handleChange();
|
|
113
|
-
} else {
|
|
114
|
-
$scope.niceDateInputForm.$setValidity('validDate', false);
|
|
115
|
-
}
|
|
130
|
+
$scope.handleChange();
|
|
116
131
|
};
|
|
117
132
|
|
|
118
133
|
// -------------------- Watch model --------------------
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<ng-form class="nice-component nice-input" ng-class="{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }" name="forma">
|
|
2
2
|
<div class="row">
|
|
3
3
|
<!------------------------- Title ------------------------->
|
|
4
|
-
<nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
|
|
4
|
+
<nice-title text="title || niceTitle" help="help" required="required" description="description" label-width="labelWidth"></nice-title>
|
|
5
5
|
|
|
6
6
|
<!------------------------- Field ------------------------->
|
|
7
7
|
<div class="nice-field col-xs-12" ng-class="fieldWidth ? fieldWidth : 'col-sm-8'">
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
<div class="nice-title col-xs-12" ng-class="[labelWidth ? labelWidth : 'col-sm-4', {'nice-title-empty': !text && !help} ]" ng-if="text">
|
|
2
|
-
<div class="nice-title-
|
|
2
|
+
<div class="nice-title-inner">
|
|
3
|
+
<div class="nice-title-text">{{ text }}<span class="nice-title-required" ng-if="required">*</span></div>
|
|
4
|
+
<div class="nice-title-description" ng-if="description">{{ description }}</div>
|
|
5
|
+
</div>
|
|
3
6
|
<nice-help class="nice-title-help" ng-if="help" text="{{ help }}"></nice-help>
|
|
4
7
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<div class="nice-component nice-toggle" ng-class="{ 'margin-bottom-0': noMargin, 'title-right': titleRight, 'nice-component-inline': isInline, 'nice-component-block': isBlock, 'active': inverted ? !model : model }" ng-form="formToggle">
|
|
2
2
|
<div class="row">
|
|
3
3
|
<!------------------------- Title ------------------------->
|
|
4
|
-
<nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
|
|
4
|
+
<nice-title text="title || niceTitle" help="help" required="required" description="description" label-width="labelWidth"></nice-title>
|
|
5
5
|
|
|
6
6
|
<!------------------------- Field ------------------------->
|
|
7
7
|
<div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
|
|
@@ -10,7 +10,7 @@ angular.module('niceElements')
|
|
|
10
10
|
.service('NiceService', function ($rootScope) {
|
|
11
11
|
const service = {
|
|
12
12
|
name: "Nice elements",
|
|
13
|
-
version: "1.12.
|
|
13
|
+
version: "1.12.6",
|
|
14
14
|
getHeader: function () {
|
|
15
15
|
return {};
|
|
16
16
|
},
|
|
@@ -20,4 +20,4 @@ angular.module('niceElements')
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
return service;
|
|
23
|
-
})
|
|
23
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
label.nice {
|
|
2
|
-
color:
|
|
2
|
+
color: var(--nice-font-color);
|
|
3
3
|
text-align: right;
|
|
4
4
|
display: block;
|
|
5
5
|
line-height: 34px;
|
|
@@ -19,6 +19,7 @@ label.nice {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
.nice-component {
|
|
22
|
+
display: block;
|
|
22
23
|
margin-bottom: 10px;
|
|
23
24
|
|
|
24
25
|
select,
|
|
@@ -119,11 +120,18 @@ label.nice {
|
|
|
119
120
|
display: flex;
|
|
120
121
|
justify-content: flex-end;
|
|
121
122
|
align-items: center;
|
|
123
|
+
gap: 5px;
|
|
122
124
|
min-height: 34px;
|
|
123
125
|
|
|
124
126
|
.nice-title-text {
|
|
125
127
|
text-align: right;
|
|
126
|
-
color:
|
|
128
|
+
color: var(--nice-font-color);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.nice-title-description {
|
|
132
|
+
font-size: 0.8em;
|
|
133
|
+
font-style: italic;
|
|
134
|
+
opacity: 0.8;
|
|
127
135
|
}
|
|
128
136
|
|
|
129
137
|
.nice-title-required {
|
|
@@ -57,7 +57,6 @@ $nice-box-shadow: 0 0 10px rgba(0, 0, 0, 0.1) !default;
|
|
|
57
57
|
$nice-navbar-height: 50px;
|
|
58
58
|
|
|
59
59
|
// ---------- Input colors override ----------
|
|
60
|
-
$nice-label-color: $nice-font-color !default;
|
|
61
60
|
$nice-input-placeholder-color: #999999 !default;
|
|
62
61
|
$nice-input-bg: $nice-background !default;
|
|
63
62
|
$nice-input-disabled-bg: white !default;
|