nice-elements 1.11.0 → 1.11.1
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 +510 -505
- package/LICENSE.md +21 -21
- package/README.md +98 -98
- package/bower.json +10 -10
- package/dist/nice.js +8397 -8356
- package/dist/nice.min.js +1 -1
- package/dist/style.css +7 -7
- package/dist/style.min.css +7 -7
- package/eslint.config.mjs +32 -32
- package/package.json +45 -45
- 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 +336 -336
- 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 +34 -34
- 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 +212 -212
- package/src/components/nice-choice/nice-choice.scss +110 -110
- 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 +71 -71
- package/src/components/nice-comment/nice-comment.scss +39 -39
- package/src/components/nice-date/nice-date.html +79 -79
- package/src/components/nice-date/nice-date.js +333 -333
- package/src/components/nice-date/nice-date.scss +305 -305
- package/src/components/nice-date-input/nice-date-input.html +41 -41
- package/src/components/nice-date-input/nice-date-input.js +111 -111
- 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 +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 +48 -48
- package/src/components/nice-input/nice-input.js +246 -245
- 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 +1275 -1275
- 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 +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 +55 -55
- package/src/components/nice-toggle/nice-toggle.scss +131 -131
- package/src/components/nice-tooltip/_nice-tooltip.scss +55 -55
- package/src/components/nice-tooltip/nice-tooltip.js +84 -84
- package/src/components/nice-upload/nice-upload.html +22 -22
- package/src/components/nice-upload/nice-upload.js +159 -159
- package/src/components/nice-upload/nice-upload.scss +85 -85
- package/src/components/nice-view/_nice-view.scss +62 -62
- package/src/components/nice-view/nice-view.html +12 -12
- package/src/components/nice-view/nice-view.js +30 -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/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 +471 -471
- package/src/styles/_nice-ngdialog.scss +85 -85
- package/src/styles/_nice-spacing.scss +283 -283
- package/src/styles/_nice.scss +70 -70
- package/src/styles/_variables.scss +191 -191
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
<div class="nice-component nice-date-input" ng-form="niceDateInputForm" ng-class="{ 'margin-bottom-0': noMargin, 'nice-component-inline': isInline, 'error': niceDateInputForm.$invalid }">
|
|
2
|
-
<div class="row">
|
|
3
|
-
<!------------------------- Title ------------------------->
|
|
4
|
-
<nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
|
|
5
|
-
|
|
6
|
-
<!------------------------- Field ------------------------->
|
|
7
|
-
<div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
|
|
8
|
-
<div class="input-group nice-date-input" ng-show="date" ng-class="{ 'has-warning': !disabled && niceDateInputForm.$invalid && niceDateInputForm.$dirty }">
|
|
9
|
-
<input type="text" class="form-control" ng-model="modelDate" ng-blur="dateBlur($event)" ng-disabled="isDisabled">
|
|
10
|
-
<nice-popup placement="bottom">
|
|
11
|
-
<nice-popup-target>
|
|
12
|
-
<span class="input-group-btn">
|
|
13
|
-
<button type="button" class="btn btn-default btn-right" tabindex="-1" ng-disabled="isDisabled">
|
|
14
|
-
<nice-icon icon="icon-calendar"></nice-icon>
|
|
15
|
-
</button>
|
|
16
|
-
</span>
|
|
17
|
-
</nice-popup-target>
|
|
18
|
-
|
|
19
|
-
<nice-popup-content>
|
|
20
|
-
<nice-date is-inline="true" inline="true" model="inner.dateModel" on-change="dateChanged()" no-margin="true" is-disabled="isDisabled"></nice-date>
|
|
21
|
-
</nice-popup-content>
|
|
22
|
-
</nice-popup>
|
|
23
|
-
</div>
|
|
24
|
-
<div class="input-group nice-time-input" ng-show="time" ng-class="{ 'has-warning': !disabled && niceDateInputForm.$invalid && niceDateInputForm.$dirty }">
|
|
25
|
-
<input type="text" class="form-control" ng-model="modelTime" ng-blur="timeBlur($event)" ng-disabled="isDisabled">
|
|
26
|
-
<nice-popup placement="bottom">
|
|
27
|
-
<nice-popup-target>
|
|
28
|
-
<span class="input-group-btn">
|
|
29
|
-
<button type="button" class="btn btn-default btn-right" tabindex="-1" ng-disabled="isDisabled">
|
|
30
|
-
<nice-icon icon="icon-clock"></nice-icon>
|
|
31
|
-
</button>
|
|
32
|
-
</span>
|
|
33
|
-
</nice-popup-target>
|
|
34
|
-
|
|
35
|
-
<nice-popup-content>
|
|
36
|
-
<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>
|
|
37
|
-
</nice-popup-content>
|
|
38
|
-
</nice-popup>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
1
|
+
<div class="nice-component nice-date-input" ng-form="niceDateInputForm" ng-class="{ 'margin-bottom-0': noMargin, 'nice-component-inline': isInline, 'error': niceDateInputForm.$invalid }">
|
|
2
|
+
<div class="row">
|
|
3
|
+
<!------------------------- Title ------------------------->
|
|
4
|
+
<nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
|
|
5
|
+
|
|
6
|
+
<!------------------------- Field ------------------------->
|
|
7
|
+
<div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
|
|
8
|
+
<div class="input-group nice-date-input" ng-show="date" ng-class="{ 'has-warning': !disabled && niceDateInputForm.$invalid && niceDateInputForm.$dirty }">
|
|
9
|
+
<input type="text" class="form-control" ng-model="modelDate" ng-blur="dateBlur($event)" ng-disabled="isDisabled">
|
|
10
|
+
<nice-popup placement="bottom">
|
|
11
|
+
<nice-popup-target>
|
|
12
|
+
<span class="input-group-btn">
|
|
13
|
+
<button type="button" class="btn btn-default btn-right" tabindex="-1" ng-disabled="isDisabled">
|
|
14
|
+
<nice-icon icon="icon-calendar"></nice-icon>
|
|
15
|
+
</button>
|
|
16
|
+
</span>
|
|
17
|
+
</nice-popup-target>
|
|
18
|
+
|
|
19
|
+
<nice-popup-content>
|
|
20
|
+
<nice-date is-inline="true" inline="true" model="inner.dateModel" on-change="dateChanged()" no-margin="true" is-disabled="isDisabled"></nice-date>
|
|
21
|
+
</nice-popup-content>
|
|
22
|
+
</nice-popup>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="input-group nice-time-input" ng-show="time" ng-class="{ 'has-warning': !disabled && niceDateInputForm.$invalid && niceDateInputForm.$dirty }">
|
|
25
|
+
<input type="text" class="form-control" ng-model="modelTime" ng-blur="timeBlur($event)" ng-disabled="isDisabled">
|
|
26
|
+
<nice-popup placement="bottom">
|
|
27
|
+
<nice-popup-target>
|
|
28
|
+
<span class="input-group-btn">
|
|
29
|
+
<button type="button" class="btn btn-default btn-right" tabindex="-1" ng-disabled="isDisabled">
|
|
30
|
+
<nice-icon icon="icon-clock"></nice-icon>
|
|
31
|
+
</button>
|
|
32
|
+
</span>
|
|
33
|
+
</nice-popup-target>
|
|
34
|
+
|
|
35
|
+
<nice-popup-content>
|
|
36
|
+
<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>
|
|
37
|
+
</nice-popup-content>
|
|
38
|
+
</nice-popup>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
42
|
</div>
|
|
@@ -1,112 +1,112 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @ngdoc directive
|
|
5
|
-
* @name niceElements.directive:niceDatetimePicker
|
|
6
|
-
* @description
|
|
7
|
-
* # niceDatetimePicker
|
|
8
|
-
*/
|
|
9
|
-
angular.module('niceElements')
|
|
10
|
-
.directive('niceDateInput', function () {
|
|
11
|
-
return {
|
|
12
|
-
restrict: 'E',
|
|
13
|
-
transclude: false,
|
|
14
|
-
templateUrl: 'src/components/nice-date-input/nice-date-input.html',
|
|
15
|
-
scope: {
|
|
16
|
-
model: '=', // binding model
|
|
17
|
-
date: '=?', // default: true, is date picker enabled?
|
|
18
|
-
time: '=?', // default: false, is time picker enabled?
|
|
19
|
-
minDate: '@', // default: undefined
|
|
20
|
-
maxDate: '@', // default: undefined
|
|
21
|
-
niceTitle: '@',
|
|
22
|
-
title: '@', // default: ''
|
|
23
|
-
noMargin: '@', // default: false, if noMargin==true then entire directive can be injected inside other divs
|
|
24
|
-
fieldWidth: '@', // default: 'col-sm-8', bootstrap classes that defines width of field
|
|
25
|
-
labelWidth: '@', // default: 'col-sm-4', bootstrap classes that defines width of label
|
|
26
|
-
isDisabled: '=',
|
|
27
|
-
help: '@',
|
|
28
|
-
isInline: '=',
|
|
29
|
-
onChange: '&?',
|
|
30
|
-
required: '='
|
|
31
|
-
},
|
|
32
|
-
controller: function ($scope, $timeout) {
|
|
33
|
-
$scope.formatDate = "DD.MM.YYYY";
|
|
34
|
-
$scope.formatTime = "HH:mm";
|
|
35
|
-
if ($scope.date === undefined) $scope.date = true;
|
|
36
|
-
if ($scope.time === undefined) $scope.time = true;
|
|
37
|
-
$scope.model = moment($scope.model) || moment().set({ 'second': 0, 'millisecond': 0 });
|
|
38
|
-
$scope.inner = {
|
|
39
|
-
timeModel: angular.copy($scope.model),
|
|
40
|
-
dateModel: angular.copy($scope.model)
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
$scope.dateChanged = function () {
|
|
44
|
-
$timeout(function () {
|
|
45
|
-
$scope.modelDate = $scope.inner.dateModel.format($scope.formatDate);
|
|
46
|
-
$scope.handleChange();
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
$scope.timeChanged = function () {
|
|
51
|
-
$timeout(function () {
|
|
52
|
-
$scope.modelTime = $scope.inner.timeModel.format($scope.formatTime);
|
|
53
|
-
$scope.handleChange();
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// -------------------- On date change --------------------
|
|
58
|
-
$scope.handleChange = function () {
|
|
59
|
-
const newModel = moment($scope.modelDate + " " + $scope.modelTime, $scope.formatDate + " " + $scope.formatTime).seconds(0).milliseconds(0);
|
|
60
|
-
if (newModel.isValid()) {
|
|
61
|
-
$scope.model = newModel;
|
|
62
|
-
$scope.niceDateInputForm.$setValidity('validDate', true);
|
|
63
|
-
} else {
|
|
64
|
-
$scope.model = null;
|
|
65
|
-
$scope.niceDateInputForm.$setValidity('validDate', false);
|
|
66
|
-
}
|
|
67
|
-
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
68
|
-
$scope.niceDateInputForm.$setDirty();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// -------------------- Format model --------------------
|
|
72
|
-
$scope.formatModel = function () {
|
|
73
|
-
$scope.modelDate = $scope.model.format($scope.formatDate);
|
|
74
|
-
$scope.modelTime = $scope.model.format($scope.formatTime);
|
|
75
|
-
}
|
|
76
|
-
$scope.formatModel();
|
|
77
|
-
|
|
78
|
-
// -------------------- Date --------------------
|
|
79
|
-
$scope.dateBlur = function () {
|
|
80
|
-
const newDate = moment($scope.modelDate, $scope.formatDate);
|
|
81
|
-
if (newDate.isValid()) {
|
|
82
|
-
$scope.niceDateInputForm.$setValidity('validDate', true);
|
|
83
|
-
$scope.handleChange();
|
|
84
|
-
} else {
|
|
85
|
-
$scope.niceDateInputForm.$setValidity('validDate', false);
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
// -------------------- Time --------------------
|
|
90
|
-
$scope.timeBlur = function () {
|
|
91
|
-
const newTime = moment($scope.modelTime, $scope.formatTime);
|
|
92
|
-
if (newTime.isValid()) {
|
|
93
|
-
$scope.niceDateInputForm.$setValidity('validDate', true);
|
|
94
|
-
$scope.handleChange();
|
|
95
|
-
} else {
|
|
96
|
-
$scope.niceDateInputForm.$setValidity('validDate', false);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
// -------------------- Watch model --------------------
|
|
101
|
-
$scope.$watch('model', function () {
|
|
102
|
-
$scope.formatModel();
|
|
103
|
-
$scope.inner = {
|
|
104
|
-
timeModel: angular.copy($scope.model),
|
|
105
|
-
dateModel: angular.copy($scope.model)
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @ngdoc directive
|
|
5
|
+
* @name niceElements.directive:niceDatetimePicker
|
|
6
|
+
* @description
|
|
7
|
+
* # niceDatetimePicker
|
|
8
|
+
*/
|
|
9
|
+
angular.module('niceElements')
|
|
10
|
+
.directive('niceDateInput', function () {
|
|
11
|
+
return {
|
|
12
|
+
restrict: 'E',
|
|
13
|
+
transclude: false,
|
|
14
|
+
templateUrl: 'src/components/nice-date-input/nice-date-input.html',
|
|
15
|
+
scope: {
|
|
16
|
+
model: '=', // binding model
|
|
17
|
+
date: '=?', // default: true, is date picker enabled?
|
|
18
|
+
time: '=?', // default: false, is time picker enabled?
|
|
19
|
+
minDate: '@', // default: undefined
|
|
20
|
+
maxDate: '@', // default: undefined
|
|
21
|
+
niceTitle: '@',
|
|
22
|
+
title: '@', // default: ''
|
|
23
|
+
noMargin: '@', // default: false, if noMargin==true then entire directive can be injected inside other divs
|
|
24
|
+
fieldWidth: '@', // default: 'col-sm-8', bootstrap classes that defines width of field
|
|
25
|
+
labelWidth: '@', // default: 'col-sm-4', bootstrap classes that defines width of label
|
|
26
|
+
isDisabled: '=',
|
|
27
|
+
help: '@',
|
|
28
|
+
isInline: '=',
|
|
29
|
+
onChange: '&?',
|
|
30
|
+
required: '='
|
|
31
|
+
},
|
|
32
|
+
controller: function ($scope, $timeout) {
|
|
33
|
+
$scope.formatDate = "DD.MM.YYYY";
|
|
34
|
+
$scope.formatTime = "HH:mm";
|
|
35
|
+
if ($scope.date === undefined) $scope.date = true;
|
|
36
|
+
if ($scope.time === undefined) $scope.time = true;
|
|
37
|
+
$scope.model = moment($scope.model) || moment().set({ 'second': 0, 'millisecond': 0 });
|
|
38
|
+
$scope.inner = {
|
|
39
|
+
timeModel: angular.copy($scope.model),
|
|
40
|
+
dateModel: angular.copy($scope.model)
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
$scope.dateChanged = function () {
|
|
44
|
+
$timeout(function () {
|
|
45
|
+
$scope.modelDate = $scope.inner.dateModel.format($scope.formatDate);
|
|
46
|
+
$scope.handleChange();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
$scope.timeChanged = function () {
|
|
51
|
+
$timeout(function () {
|
|
52
|
+
$scope.modelTime = $scope.inner.timeModel.format($scope.formatTime);
|
|
53
|
+
$scope.handleChange();
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// -------------------- On date change --------------------
|
|
58
|
+
$scope.handleChange = function () {
|
|
59
|
+
const newModel = moment($scope.modelDate + " " + $scope.modelTime, $scope.formatDate + " " + $scope.formatTime).seconds(0).milliseconds(0);
|
|
60
|
+
if (newModel.isValid()) {
|
|
61
|
+
$scope.model = newModel;
|
|
62
|
+
$scope.niceDateInputForm.$setValidity('validDate', true);
|
|
63
|
+
} else {
|
|
64
|
+
$scope.model = null;
|
|
65
|
+
$scope.niceDateInputForm.$setValidity('validDate', false);
|
|
66
|
+
}
|
|
67
|
+
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
68
|
+
$scope.niceDateInputForm.$setDirty();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// -------------------- Format model --------------------
|
|
72
|
+
$scope.formatModel = function () {
|
|
73
|
+
$scope.modelDate = $scope.model.format($scope.formatDate);
|
|
74
|
+
$scope.modelTime = $scope.model.format($scope.formatTime);
|
|
75
|
+
}
|
|
76
|
+
$scope.formatModel();
|
|
77
|
+
|
|
78
|
+
// -------------------- Date --------------------
|
|
79
|
+
$scope.dateBlur = function () {
|
|
80
|
+
const newDate = moment($scope.modelDate, $scope.formatDate);
|
|
81
|
+
if (newDate.isValid()) {
|
|
82
|
+
$scope.niceDateInputForm.$setValidity('validDate', true);
|
|
83
|
+
$scope.handleChange();
|
|
84
|
+
} else {
|
|
85
|
+
$scope.niceDateInputForm.$setValidity('validDate', false);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// -------------------- Time --------------------
|
|
90
|
+
$scope.timeBlur = function () {
|
|
91
|
+
const newTime = moment($scope.modelTime, $scope.formatTime);
|
|
92
|
+
if (newTime.isValid()) {
|
|
93
|
+
$scope.niceDateInputForm.$setValidity('validDate', true);
|
|
94
|
+
$scope.handleChange();
|
|
95
|
+
} else {
|
|
96
|
+
$scope.niceDateInputForm.$setValidity('validDate', false);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// -------------------- Watch model --------------------
|
|
101
|
+
$scope.$watch('model', function () {
|
|
102
|
+
$scope.formatModel();
|
|
103
|
+
$scope.inner = {
|
|
104
|
+
timeModel: angular.copy($scope.model),
|
|
105
|
+
dateModel: angular.copy($scope.model)
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
112
|
);
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
.nice-date-input {
|
|
2
|
-
.nice-field {
|
|
3
|
-
display: flex;
|
|
4
|
-
gap: 1rem;
|
|
5
|
-
|
|
6
|
-
.input-group {
|
|
7
|
-
display: flex;
|
|
8
|
-
|
|
9
|
-
.form-control {
|
|
10
|
-
border-right: 0 none;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.form-control {
|
|
14
|
-
z-index: unset;
|
|
15
|
-
padding-right: 0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
&.nice-date-input {
|
|
19
|
-
flex-grow: 1;
|
|
20
|
-
|
|
21
|
-
.nice-popup-content {
|
|
22
|
-
.nice-date-date {
|
|
23
|
-
width: 250px;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
&.nice-time-input {
|
|
29
|
-
width: 100px;
|
|
30
|
-
flex-shrink: 0;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.nice-popup-target {
|
|
34
|
-
display: flex;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.nice-popup-content {
|
|
38
|
-
z-index: 10;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.nice-date {
|
|
42
|
-
width: 250px;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
1
|
+
.nice-date-input {
|
|
2
|
+
.nice-field {
|
|
3
|
+
display: flex;
|
|
4
|
+
gap: 1rem;
|
|
5
|
+
|
|
6
|
+
.input-group {
|
|
7
|
+
display: flex;
|
|
8
|
+
|
|
9
|
+
.form-control {
|
|
10
|
+
border-right: 0 none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.form-control {
|
|
14
|
+
z-index: unset;
|
|
15
|
+
padding-right: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&.nice-date-input {
|
|
19
|
+
flex-grow: 1;
|
|
20
|
+
|
|
21
|
+
.nice-popup-content {
|
|
22
|
+
.nice-date-date {
|
|
23
|
+
width: 250px;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&.nice-time-input {
|
|
29
|
+
width: 100px;
|
|
30
|
+
flex-shrink: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.nice-popup-target {
|
|
34
|
+
display: flex;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.nice-popup-content {
|
|
38
|
+
z-index: 10;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.nice-date {
|
|
42
|
+
width: 250px;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
46
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
<ng-form class="nice-component nice-date-range" ng-class="{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }" name="form">
|
|
2
|
-
<div class="row">
|
|
3
|
-
<!------------------------- Title ------------------------->
|
|
4
|
-
<nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
|
|
5
|
-
|
|
6
|
-
<!------------------------- Field ------------------------->
|
|
7
|
-
<div class="nice-field col-xs-12" ng-class="fieldWidth ? fieldWidth : 'col-sm-8'">
|
|
8
|
-
<div class="input-group">
|
|
9
|
-
<input date-range-picker class="form-control date-picker" type="text" options="opts" ng-model="model" />
|
|
10
|
-
<span date-range-picker options="opts" ng-model="model" class="input-group-addon">
|
|
11
|
-
<nice-icon icon="icon-calendar"></nice-icon>
|
|
12
|
-
</span>
|
|
13
|
-
</div>
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
1
|
+
<ng-form class="nice-component nice-date-range" ng-class="{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }" name="form">
|
|
2
|
+
<div class="row">
|
|
3
|
+
<!------------------------- Title ------------------------->
|
|
4
|
+
<nice-title text="title || niceTitle" help="help" required="required" label-width="labelWidth"></nice-title>
|
|
5
|
+
|
|
6
|
+
<!------------------------- Field ------------------------->
|
|
7
|
+
<div class="nice-field col-xs-12" ng-class="fieldWidth ? fieldWidth : 'col-sm-8'">
|
|
8
|
+
<div class="input-group">
|
|
9
|
+
<input date-range-picker class="form-control date-picker" type="text" options="opts" ng-model="model" />
|
|
10
|
+
<span date-range-picker options="opts" ng-model="model" class="input-group-addon">
|
|
11
|
+
<nice-icon icon="icon-calendar"></nice-icon>
|
|
12
|
+
</span>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
16
|
</ng-form>
|
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @ngdoc directive
|
|
5
|
-
* @name niceElements.directive:niceDateRange
|
|
6
|
-
* @description
|
|
7
|
-
* # niceDateRange
|
|
8
|
-
*/
|
|
9
|
-
angular.module('niceElements')
|
|
10
|
-
|
|
11
|
-
.directive('niceDateRange', function () {
|
|
12
|
-
return {
|
|
13
|
-
restrict: 'E',
|
|
14
|
-
transclude: true,
|
|
15
|
-
templateUrl: 'src/components/nice-date-range/nice-date-range.html',
|
|
16
|
-
scope: {
|
|
17
|
-
model: '=',
|
|
18
|
-
niceTitle: '@',
|
|
19
|
-
title: '@',
|
|
20
|
-
fieldWidth: '@',
|
|
21
|
-
format: '@',
|
|
22
|
-
min: '@',
|
|
23
|
-
max: '@',
|
|
24
|
-
noMargin: '@',
|
|
25
|
-
labelWidth: '@',
|
|
26
|
-
startOfTheYear: '@',
|
|
27
|
-
help: '@',
|
|
28
|
-
isInline: '=',
|
|
29
|
-
onChange: '&?',
|
|
30
|
-
required: '='
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
link: function (scope, attrs) {
|
|
34
|
-
if (!attrs.title) { attrs.title = ''; }
|
|
35
|
-
if (!attrs.fieldWidth) { attrs.fieldWidth = 'col-sm-8'; }
|
|
36
|
-
if (!attrs.labelWidth) { attrs.labelWidth = 'col-sm-4'; }
|
|
37
|
-
if (!attrs.format) { attrs.format = 'dd.MM.yyyy'; }
|
|
38
|
-
attrs.noMargin = angular.isDefined(attrs.noMargin);
|
|
39
|
-
|
|
40
|
-
if (!angular.isDefined(scope.model)) {
|
|
41
|
-
let model = null;
|
|
42
|
-
if (!angular.isDefined(scope.startOfTheYear)) {
|
|
43
|
-
model = {
|
|
44
|
-
startDate: moment().format(),
|
|
45
|
-
endDate: moment().format()
|
|
46
|
-
};
|
|
47
|
-
} else {
|
|
48
|
-
model = {
|
|
49
|
-
startDate: moment([moment().year()]).format(),
|
|
50
|
-
endDate: moment().format()
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
scope.model = model;
|
|
54
|
-
if (scope.onChange) scope.onChange(scope.model);
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
controller: function ($scope) {
|
|
59
|
-
$scope.opts = {
|
|
60
|
-
locale: {
|
|
61
|
-
applyClass: 'btn-green',
|
|
62
|
-
firstDay: 1
|
|
63
|
-
},
|
|
64
|
-
ranges: {},
|
|
65
|
-
min: $scope.min,
|
|
66
|
-
max: $scope.max
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
$scope.opts.ranges[gettextCatalog.getString("Today", null, "Nice")] = [moment(), moment()];
|
|
70
|
-
$scope.opts.ranges[gettextCatalog.getString("Last 7 days", null, "Nice")] = [moment().subtract(7, 'days'), moment()];
|
|
71
|
-
$scope.opts.ranges[gettextCatalog.getString("Last 30 days", null, "Nice")] = [moment().subtract(30, 'days'), moment()];
|
|
72
|
-
$scope.opts.ranges[gettextCatalog.getString("This month", null, "Nice")] = [moment().startOf('month'), moment().endOf('month')];
|
|
73
|
-
|
|
74
|
-
if (angular.isDefined($scope.format)) $scope.opts.format = $scope.format;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
};
|
|
78
|
-
});
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @ngdoc directive
|
|
5
|
+
* @name niceElements.directive:niceDateRange
|
|
6
|
+
* @description
|
|
7
|
+
* # niceDateRange
|
|
8
|
+
*/
|
|
9
|
+
angular.module('niceElements')
|
|
10
|
+
|
|
11
|
+
.directive('niceDateRange', function () {
|
|
12
|
+
return {
|
|
13
|
+
restrict: 'E',
|
|
14
|
+
transclude: true,
|
|
15
|
+
templateUrl: 'src/components/nice-date-range/nice-date-range.html',
|
|
16
|
+
scope: {
|
|
17
|
+
model: '=',
|
|
18
|
+
niceTitle: '@',
|
|
19
|
+
title: '@',
|
|
20
|
+
fieldWidth: '@',
|
|
21
|
+
format: '@',
|
|
22
|
+
min: '@',
|
|
23
|
+
max: '@',
|
|
24
|
+
noMargin: '@',
|
|
25
|
+
labelWidth: '@',
|
|
26
|
+
startOfTheYear: '@',
|
|
27
|
+
help: '@',
|
|
28
|
+
isInline: '=',
|
|
29
|
+
onChange: '&?',
|
|
30
|
+
required: '='
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
link: function (scope, attrs) {
|
|
34
|
+
if (!attrs.title) { attrs.title = ''; }
|
|
35
|
+
if (!attrs.fieldWidth) { attrs.fieldWidth = 'col-sm-8'; }
|
|
36
|
+
if (!attrs.labelWidth) { attrs.labelWidth = 'col-sm-4'; }
|
|
37
|
+
if (!attrs.format) { attrs.format = 'dd.MM.yyyy'; }
|
|
38
|
+
attrs.noMargin = angular.isDefined(attrs.noMargin);
|
|
39
|
+
|
|
40
|
+
if (!angular.isDefined(scope.model)) {
|
|
41
|
+
let model = null;
|
|
42
|
+
if (!angular.isDefined(scope.startOfTheYear)) {
|
|
43
|
+
model = {
|
|
44
|
+
startDate: moment().format(),
|
|
45
|
+
endDate: moment().format()
|
|
46
|
+
};
|
|
47
|
+
} else {
|
|
48
|
+
model = {
|
|
49
|
+
startDate: moment([moment().year()]).format(),
|
|
50
|
+
endDate: moment().format()
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
scope.model = model;
|
|
54
|
+
if (scope.onChange) scope.onChange(scope.model);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
controller: function ($scope) {
|
|
59
|
+
$scope.opts = {
|
|
60
|
+
locale: {
|
|
61
|
+
applyClass: 'btn-green',
|
|
62
|
+
firstDay: 1
|
|
63
|
+
},
|
|
64
|
+
ranges: {},
|
|
65
|
+
min: $scope.min,
|
|
66
|
+
max: $scope.max
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
$scope.opts.ranges[gettextCatalog.getString("Today", null, "Nice")] = [moment(), moment()];
|
|
70
|
+
$scope.opts.ranges[gettextCatalog.getString("Last 7 days", null, "Nice")] = [moment().subtract(7, 'days'), moment()];
|
|
71
|
+
$scope.opts.ranges[gettextCatalog.getString("Last 30 days", null, "Nice")] = [moment().subtract(30, 'days'), moment()];
|
|
72
|
+
$scope.opts.ranges[gettextCatalog.getString("This month", null, "Nice")] = [moment().startOf('month'), moment().endOf('month')];
|
|
73
|
+
|
|
74
|
+
if (angular.isDefined($scope.format)) $scope.opts.format = $scope.format;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
};
|
|
78
|
+
});
|