nice-elements 1.9.12 → 1.9.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +17 -10
- package/CHANGELOG.md +390 -382
- package/LICENSE.md +21 -21
- package/README.md +93 -93
- package/bower.json +10 -18
- package/dist/nice.js +7967 -7920
- package/dist/nice.min.js +1 -1
- package/dist/style.css +22 -18
- package/dist/style.css.map +1 -1
- package/dist/style.min.css +7 -7
- package/package.json +40 -40
- package/src/components/nice-button/nice-button.html +4 -4
- package/src/components/nice-button/nice-button.js +41 -41
- package/src/components/nice-button/nice-button.scss +16 -16
- package/src/components/nice-button-toggle/nice-button-toggle.html +9 -9
- package/src/components/nice-button-toggle/nice-button-toggle.js +23 -23
- package/src/components/nice-button-toggle/nice-button-toggle.scss +2 -2
- package/src/components/nice-calendar/nice-calendar.html +91 -91
- package/src/components/nice-calendar/nice-calendar.js +334 -334
- package/src/components/nice-calendar/nice-calendar.scss +285 -285
- package/src/components/nice-checkbox/nice-checkbox.html +5 -5
- package/src/components/nice-checkbox/nice-checkbox.js +33 -33
- package/src/components/nice-checkbox/nice-checkbox.scss +91 -91
- package/src/components/nice-choice/nice-choice.html +18 -18
- package/src/components/nice-choice/nice-choice.js +210 -210
- package/src/components/nice-choice/nice-choice.scss +110 -109
- package/src/components/nice-click-outside/nice-click-outside.js +105 -105
- package/src/components/nice-comment/nice-comment.html +10 -10
- package/src/components/nice-comment/nice-comment.js +69 -69
- package/src/components/nice-comment/nice-comment.scss +39 -39
- package/src/components/nice-date/nice-date.html +74 -74
- package/src/components/nice-date/nice-date.js +327 -327
- package/src/components/nice-date/nice-date.scss +302 -302
- package/src/components/nice-date-input/nice-date-input.html +41 -41
- package/src/components/nice-date-input/nice-date-input.js +109 -109
- package/src/components/nice-date-input/nice-date-input.scss +45 -45
- package/src/components/nice-date-range/nice-date-range.html +15 -15
- package/src/components/nice-date-range/nice-date-range.js +76 -76
- package/src/components/nice-date-range/nice-date-range.scss +390 -390
- package/src/components/nice-datetime-picker/nice-datetime-picker.html +29 -29
- package/src/components/nice-datetime-picker/nice-datetime-picker.js +87 -87
- package/src/components/nice-datetime-picker/nice-datetime-picker.scss +428 -428
- package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.html +55 -55
- package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.js +246 -246
- package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.scss +73 -73
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.html +44 -44
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.js +172 -172
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.scss +127 -127
- package/src/components/nice-dropdown/nice-dropdown.html +60 -60
- package/src/components/nice-dropdown/nice-dropdown.js +489 -489
- package/src/components/nice-dropdown/nice-dropdown.scss +249 -249
- package/src/components/nice-dropdown-date/nice-dropdown-date.html +28 -28
- package/src/components/nice-dropdown-date/nice-dropdown-date.js +126 -126
- package/src/components/nice-dropdown-date/nice-dropdown-date.scss +82 -82
- package/src/components/nice-dropdown-old/nice-dropdown-old.html +44 -44
- package/src/components/nice-dropdown-old/nice-dropdown-old.js +330 -330
- package/src/components/nice-dropdown-old/nice-dropdown-old.scss +129 -129
- package/src/components/nice-dtp/nice-dtp.html +91 -91
- package/src/components/nice-dtp/nice-dtp.js +833 -833
- package/src/components/nice-help/nice-help.html +6 -6
- package/src/components/nice-help/nice-help.js +55 -55
- package/src/components/nice-help/nice-help.scss +78 -78
- package/src/components/nice-input/nice-input.html +48 -47
- package/src/components/nice-input/nice-input.js +231 -224
- package/src/components/nice-input/nice-input.scss +130 -130
- package/src/components/nice-label/nice-label.html +10 -10
- package/src/components/nice-label/nice-label.js +30 -30
- package/src/components/nice-loader/nice-loader.html +6 -6
- package/src/components/nice-loader/nice-loader.js +28 -28
- package/src/components/nice-loader/nice-loader.scss +47 -47
- package/src/components/nice-notification/nice-notification.html +3 -3
- package/src/components/nice-notification/nice-notification.js +124 -124
- package/src/components/nice-notification/nice-notification.scss +66 -66
- package/src/components/nice-number/nice-number.html +40 -40
- package/src/components/nice-number/nice-number.js +166 -166
- package/src/components/nice-number/nice-number.scss +18 -18
- package/src/components/nice-percent/nice-percent.html +24 -24
- package/src/components/nice-percent/nice-percent.js +94 -94
- package/src/components/nice-pill/nice-pill.html +3 -3
- package/src/components/nice-pill/nice-pill.js +29 -29
- package/src/components/nice-pill/nice-pill.scss +25 -25
- package/src/components/nice-popup/nice-popup.html +6 -6
- package/src/components/nice-popup/nice-popup.js +122 -122
- package/src/components/nice-popup/nice-popup.scss +43 -43
- package/src/components/nice-progress-bar/nice-progress-bar.html +15 -15
- package/src/components/nice-progress-bar/nice-progress-bar.js +54 -54
- package/src/components/nice-progress-bar/nice-progress-bar.scss +47 -47
- package/src/components/nice-quantity/nice-quantity.html +22 -22
- package/src/components/nice-quantity/nice-quantity.js +55 -55
- package/src/components/nice-quantity/nice-quantity.scss +51 -51
- package/src/components/nice-search/nice-search.html +44 -44
- package/src/components/nice-search/nice-search.js +239 -239
- package/src/components/nice-search/nice-search.scss +90 -90
- package/src/components/nice-search2/nice-search2.html +32 -32
- package/src/components/nice-search2/nice-search2.js +264 -264
- package/src/components/nice-search2/nice-search2.scss +80 -80
- package/src/components/nice-slot/nice-slot.html +10 -10
- package/src/components/nice-slot/nice-slot.js +29 -29
- package/src/components/nice-steps/nice-steps.scss +81 -81
- package/src/components/nice-svgs/nice-svgs.html +1262 -1262
- package/src/components/nice-svgs/nice-svgs.js +16 -16
- package/src/components/nice-time-picker/nice-time-picker.html +43 -43
- package/src/components/nice-time-picker/nice-time-picker.js +83 -83
- package/src/components/nice-time-picker/nice-time-picker.scss +37 -37
- package/src/components/nice-title/nice-title.html +3 -3
- package/src/components/nice-title/nice-title.js +21 -21
- package/src/components/nice-toast/nice-toast.html +2 -2
- package/src/components/nice-toast/nice-toast.js +56 -56
- package/src/components/nice-toast/nice-toast.scss +74 -74
- package/src/components/nice-toggle/nice-toggle.html +12 -12
- package/src/components/nice-toggle/nice-toggle.js +95 -95
- package/src/components/nice-toggle/nice-toggle.scss +67 -67
- package/src/components/nice-tooltip/_nice-tooltip.scss +71 -71
- package/src/components/nice-tooltip/nice-tooltip.js +23 -23
- package/src/components/nice-upload/nice-upload.html +22 -22
- package/src/components/nice-upload/nice-upload.js +157 -157
- package/src/components/nice-upload/nice-upload.scss +85 -85
- package/src/components/nice-wrapper/_nice-wrapper.scss +87 -87
- package/src/components/nice-wrapper/nice-wrapper.html +12 -12
- package/src/components/nice-wrapper/nice-wrapper.js +43 -43
- package/src/components/nice-yesno/nice-yesno.html +14 -14
- package/src/components/nice-yesno/nice-yesno.js +109 -109
- package/src/components/nice-yesno/nice-yesno.scss +95 -95
- package/src/filters/nice-date.js +17 -17
- package/src/filters/nice-highlight.js +16 -16
- package/src/modals/nice-multilangual-modal/nice-multilangual-modal.html +30 -30
- package/src/modals/nice-multilangual-modal/nice-multilangual-modal.js +67 -67
- package/src/modals/nice-multilangual-modal/nice-multilangual-modal.scss +19 -19
- package/src/nice.js +2 -2
- package/src/services/nice-service.js +19 -19
- package/src/styles/_bootstrap-variables.scss +178 -178
- package/src/styles/_nice-buttons.scss +403 -403
- package/src/styles/_nice-common.scss +471 -467
- package/src/styles/_nice-ngdialog.scss +85 -85
- package/src/styles/_nice-spacing.scss +283 -283
- package/src/styles/_nice.scss +65 -65
- package/src/styles/_variables.scss +195 -195
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
<div class="nice-component nice-datetime-picker nice-datetimerange-picker" name="form" ng-class="{ 'margin-bottom-0': noMargin, 'nice-component-inline': isInline }">
|
|
2
|
-
<div class="nice-dtp-background" ng-click="cancelClick()" ng-if="showDtpRange"></div>
|
|
3
|
-
|
|
4
|
-
<div class="row">
|
|
5
|
-
<!------------------------- Title ------------------------->
|
|
6
|
-
<nice-title text="title" help="help" required="required" label-width="labelWidth"></nice-title>
|
|
7
|
-
|
|
8
|
-
<!------------------------- Field ------------------------->
|
|
9
|
-
<div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
|
|
10
|
-
<!--Needed for intercepting form changes ($dirty)!-->
|
|
11
|
-
<div ng-form="formDatetimeRangePicker"></div>
|
|
12
|
-
|
|
13
|
-
<div class="dropdown">
|
|
14
|
-
<div class="dropdown-toggle" id="dropdown{{randNum}}" role="button" ng-click="openDtpRange()">
|
|
15
|
-
<div class="input-group">
|
|
16
|
-
<input type="text" class="form-control" value="{{value}}" ng-disabled="isDisabled" ng-click="openDtpRange()">
|
|
17
|
-
<span class="input-group-btn">
|
|
18
|
-
<button class="btn btn-default btn-right" ng-disabled="isDisabled">
|
|
19
|
-
<nice-icon ng-if="date != 'false'" icon="icon-calendar"></nice-icon>
|
|
20
|
-
<nice-icon ng-if="date == 'false'" icon="icon-clock"></nice-icon>
|
|
21
|
-
</button>
|
|
22
|
-
</span>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
|
|
27
|
-
<div class="dtp-range-wrapper" ng-show="showDtpRange">
|
|
28
|
-
|
|
29
|
-
<div class="dtp-layer">
|
|
30
|
-
<div class="dtp-buttons-left">
|
|
31
|
-
<a class="btn btn-primary btn-block" ng-click="selectLastNDays(1)" translate translate-context="Nice">Last 24 hours</a>
|
|
32
|
-
<a class="btn btn-primary btn-block" ng-click="selectLastNDays(7)" translate translate-context="Nice">Last 7 days</a>
|
|
33
|
-
<a class="btn btn-primary btn-block" ng-click="selectLastMonth()" translate translate-context="Nice">Last month</a>
|
|
34
|
-
<a class="btn btn-primary btn-block" ng-click="selectThisMonth()" translate translate-context="Nice">This month</a>
|
|
35
|
-
</div>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<div class="dtp-left">
|
|
39
|
-
<!-- inject nice-dtp here -->
|
|
40
|
-
<nice-dtp model="dateStart" format="{{format}}" model-format="{{modelFormat}}" date="{{date}}" time="{{time}}" width="{{width}}" enable-ok-buttons="{{enableOkButtons}}" lang="{{lang}}" min-date="{{minDate}}" max-date="{{maxDate}}" week-start="{{weekStart}}" ok-text="{{okText}}" cancel-text="{{cancelText}}" inline="true"></nice-dtp>
|
|
41
|
-
</div>
|
|
42
|
-
<div class="dtp-right">
|
|
43
|
-
<!-- inject nice-dtp here -->
|
|
44
|
-
<nice-dtp model="dateEnd" format="{{format}}" model-format="{{modelFormat}}" date="{{date}}" time="{{time}}" width="{{width}}" enable-ok-buttons="{{enableOkButtons}}" lang="{{lang}}" min-date="{{minDate}}" max-date="{{maxDate}}" week-start="{{weekStart}}" ok-text="{{okText}}" cancel-text="{{cancelText}}" inline="true"></nice-dtp>
|
|
45
|
-
</div>
|
|
46
|
-
|
|
47
|
-
<div class="dtp-buttons-bottom">
|
|
48
|
-
<a class="btn btn-danger btn-block margin-right-20" ng-click="cancelClick()" translate translate-context="Nice">Cancel</a>
|
|
49
|
-
<a class="btn btn-success btn-block" ng-click="okClick()" translate translate-context="Nice">OK</a>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
1
|
+
<div class="nice-component nice-datetime-picker nice-datetimerange-picker" name="form" ng-class="{ 'margin-bottom-0': noMargin, 'nice-component-inline': isInline }">
|
|
2
|
+
<div class="nice-dtp-background" ng-click="cancelClick()" ng-if="showDtpRange"></div>
|
|
3
|
+
|
|
4
|
+
<div class="row">
|
|
5
|
+
<!------------------------- Title ------------------------->
|
|
6
|
+
<nice-title text="title" help="help" required="required" label-width="labelWidth"></nice-title>
|
|
7
|
+
|
|
8
|
+
<!------------------------- Field ------------------------->
|
|
9
|
+
<div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
|
|
10
|
+
<!--Needed for intercepting form changes ($dirty)!-->
|
|
11
|
+
<div ng-form="formDatetimeRangePicker"></div>
|
|
12
|
+
|
|
13
|
+
<div class="dropdown">
|
|
14
|
+
<div class="dropdown-toggle" id="dropdown{{randNum}}" role="button" ng-click="openDtpRange()">
|
|
15
|
+
<div class="input-group">
|
|
16
|
+
<input type="text" class="form-control" value="{{value}}" ng-disabled="isDisabled" ng-click="openDtpRange()">
|
|
17
|
+
<span class="input-group-btn">
|
|
18
|
+
<button type="button" class="btn btn-default btn-right" ng-disabled="isDisabled">
|
|
19
|
+
<nice-icon ng-if="date != 'false'" icon="icon-calendar"></nice-icon>
|
|
20
|
+
<nice-icon ng-if="date == 'false'" icon="icon-clock"></nice-icon>
|
|
21
|
+
</button>
|
|
22
|
+
</span>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<div class="dtp-range-wrapper" ng-show="showDtpRange">
|
|
28
|
+
|
|
29
|
+
<div class="dtp-layer">
|
|
30
|
+
<div class="dtp-buttons-left">
|
|
31
|
+
<a class="btn btn-primary btn-block" ng-click="selectLastNDays(1)" translate translate-context="Nice">Last 24 hours</a>
|
|
32
|
+
<a class="btn btn-primary btn-block" ng-click="selectLastNDays(7)" translate translate-context="Nice">Last 7 days</a>
|
|
33
|
+
<a class="btn btn-primary btn-block" ng-click="selectLastMonth()" translate translate-context="Nice">Last month</a>
|
|
34
|
+
<a class="btn btn-primary btn-block" ng-click="selectThisMonth()" translate translate-context="Nice">This month</a>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
<div class="dtp-left">
|
|
39
|
+
<!-- inject nice-dtp here -->
|
|
40
|
+
<nice-dtp model="dateStart" format="{{format}}" model-format="{{modelFormat}}" date="{{date}}" time="{{time}}" width="{{width}}" enable-ok-buttons="{{enableOkButtons}}" lang="{{lang}}" min-date="{{minDate}}" max-date="{{maxDate}}" week-start="{{weekStart}}" ok-text="{{okText}}" cancel-text="{{cancelText}}" inline="true"></nice-dtp>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="dtp-right">
|
|
43
|
+
<!-- inject nice-dtp here -->
|
|
44
|
+
<nice-dtp model="dateEnd" format="{{format}}" model-format="{{modelFormat}}" date="{{date}}" time="{{time}}" width="{{width}}" enable-ok-buttons="{{enableOkButtons}}" lang="{{lang}}" min-date="{{minDate}}" max-date="{{maxDate}}" week-start="{{weekStart}}" ok-text="{{okText}}" cancel-text="{{cancelText}}" inline="true"></nice-dtp>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<div class="dtp-buttons-bottom">
|
|
48
|
+
<a class="btn btn-danger btn-block margin-right-20" ng-click="cancelClick()" translate translate-context="Nice">Cancel</a>
|
|
49
|
+
<a class="btn btn-success btn-block" ng-click="okClick()" translate translate-context="Nice">OK</a>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
56
|
</div>
|
|
@@ -1,247 +1,247 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @ngdoc directive
|
|
5
|
-
* @name niceElements.directive:niceDatetimerangePicker
|
|
6
|
-
* @description
|
|
7
|
-
* # niceDatetimerangePicker
|
|
8
|
-
*/
|
|
9
|
-
angular.module('niceElements')
|
|
10
|
-
.directive('niceDatetimerangePicker', function (gettextCatalog) {
|
|
11
|
-
return {
|
|
12
|
-
scope: {
|
|
13
|
-
modelStart: '=', // binding model
|
|
14
|
-
modelEnd: '=', // binding model
|
|
15
|
-
format: '@', // default: 'D.M.YYYY • H:mm', format for input label string
|
|
16
|
-
modelFormat: '@',
|
|
17
|
-
date: '@', // default: true, is date picker enabled?
|
|
18
|
-
time: '@', // default: false, is time picker enabled?
|
|
19
|
-
width: '@', // default: 300, width of entire dtp-picker in px
|
|
20
|
-
enableOkButtons: '@', // default: false, is ok/cancel buttons enabled?
|
|
21
|
-
lang: '@', // default: 'en', which locale to use - you must load angular locales first
|
|
22
|
-
minDate: '@', // default: undefined
|
|
23
|
-
maxDate: '@', // default: undefined
|
|
24
|
-
weekStart: '@', // default: 1, which day does the week start? (0 - sunday, 1 - monday, ...)
|
|
25
|
-
okText: '@',
|
|
26
|
-
cancelText: '@',
|
|
27
|
-
shortTime: '@', // default: false,
|
|
28
|
-
title: '@', // default: ''
|
|
29
|
-
noMargin: '@', // default: false, if noMargin==true then entire directive can be injected inside other divs
|
|
30
|
-
fieldWidth: '@', // default: 'col-sm-8', bootstrap classes that defines width of field
|
|
31
|
-
labelWidth: '@', // default: 'col-sm-4', bootstrap classes that defines width of label,
|
|
32
|
-
formatOutput: '@', // Format output or moment
|
|
33
|
-
isDisabled: '=',
|
|
34
|
-
help: '@',
|
|
35
|
-
isInline: '=',
|
|
36
|
-
onChange: '&?'
|
|
37
|
-
},
|
|
38
|
-
templateUrl: 'src/components/nice-datetimerange-picker/nice-datetimerange-picker.html',
|
|
39
|
-
link: {
|
|
40
|
-
pre: function ($scope) {
|
|
41
|
-
console.warn("[NICE ELEMENTS] nice-datetimerange-picker component is deprecated!");
|
|
42
|
-
// Default parameters
|
|
43
|
-
var params = {
|
|
44
|
-
title: '',
|
|
45
|
-
noMargin: false,
|
|
46
|
-
fieldWidth: 'col-sm-8',
|
|
47
|
-
labelWidth: 'col-sm-4',
|
|
48
|
-
format: 'D.M.YYYY • H:mm',
|
|
49
|
-
modelFormat: 'YYYY-MM-DDTHH:mm:ss.SSS',
|
|
50
|
-
minDate: null,
|
|
51
|
-
maxDate: null,
|
|
52
|
-
lang: 'en',
|
|
53
|
-
weekStart: 1,
|
|
54
|
-
shortTime: false,
|
|
55
|
-
cancelText: gettextCatalog.getString('Cancel', null, 'Nice'),
|
|
56
|
-
okText: gettextCatalog.getString('OK', null, 'Nice'),
|
|
57
|
-
date: true,
|
|
58
|
-
time: false,
|
|
59
|
-
width: 300,
|
|
60
|
-
enableOkButtons: false
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
if ($scope.formatOutput === undefined) $scope.formatOutput = false;
|
|
64
|
-
|
|
65
|
-
var setLabelValue = function () {
|
|
66
|
-
var _from = moment($scope.internalStart).format(params.format);
|
|
67
|
-
var _to = moment($scope.internalEnd).format(params.format);
|
|
68
|
-
$scope.value = _from + ' - ' + _to;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
var initCurrentDates = function () {
|
|
72
|
-
if (typeof ($scope.modelStart) === 'undefined' || $scope.modelStart === null) {
|
|
73
|
-
var _start = moment().subtract(1, 'days');
|
|
74
|
-
if ($scope.formatOutput) _start = _start.format(params.modelFormat);
|
|
75
|
-
$scope.modelStart = _start;
|
|
76
|
-
|
|
77
|
-
} else {
|
|
78
|
-
if (!params.date && params.time) {
|
|
79
|
-
// if only time
|
|
80
|
-
var _time = moment();
|
|
81
|
-
var i_hour = params.modelFormat.indexOf('HH:mm');
|
|
82
|
-
var i_min = params.modelFormat.indexOf('mm');
|
|
83
|
-
var hours = $scope.model.substring(i_hour, i_hour + 2);
|
|
84
|
-
var minutes = $scope.model.substring(i_min, i_min + 2);
|
|
85
|
-
|
|
86
|
-
if (i_hour > -1 && i_min > -1) {
|
|
87
|
-
_time.hours(hours);
|
|
88
|
-
_time.minutes(minutes);
|
|
89
|
-
} else {
|
|
90
|
-
console.error('Cannot parse current time model with passed modelFilter. Please check if you missed ' +
|
|
91
|
-
'modelFilter setting in directive.. Falling back to current time instead.');
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
$scope.dateStart = _time;
|
|
95
|
-
} else {
|
|
96
|
-
$scope.dateStart = moment($scope.modelStart);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// initialize dateEnd
|
|
101
|
-
if (typeof ($scope.modelEnd) === 'undefined' || $scope.modelEnd === null) {
|
|
102
|
-
var _end = moment();
|
|
103
|
-
if ($scope.formatOutput) _end = _end.format(params.modelFormat);
|
|
104
|
-
$scope.modelEnd = _end;
|
|
105
|
-
|
|
106
|
-
} else {
|
|
107
|
-
if (!params.date && params.time) {
|
|
108
|
-
// if only time
|
|
109
|
-
var _time = moment();
|
|
110
|
-
var i_hour = params.modelFormat.indexOf('HH:mm');
|
|
111
|
-
var i_min = params.modelFormat.indexOf('mm');
|
|
112
|
-
var hours = $scope.model.substring(i_hour, i_hour + 2);
|
|
113
|
-
var minutes = $scope.model.substring(i_min, i_min + 2);
|
|
114
|
-
|
|
115
|
-
if (i_hour > -1 && i_min > -1) {
|
|
116
|
-
_time.hours(hours);
|
|
117
|
-
_time.minutes(minutes);
|
|
118
|
-
} else {
|
|
119
|
-
console.error('Cannot parse current time model with passed modelFilter. Please check if you missed ' +
|
|
120
|
-
'modelFilter setting in directive.. Falling back to current time instead.');
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
$scope.dateEnd = _time;
|
|
124
|
-
} else {
|
|
125
|
-
$scope.dateEnd = moment($scope.modelEnd);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// Fix dateEnd if it's before dateStart
|
|
130
|
-
if ($scope.dateStart > $scope.dateEnd) {
|
|
131
|
-
$scope.dateEnd = moment($scope.dateStart);
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
// prepare attributes
|
|
136
|
-
params.date = $scope.date === 'true';
|
|
137
|
-
params.time = $scope.time === 'true';
|
|
138
|
-
if ($scope.format && $scope.format != "")
|
|
139
|
-
params.format = $scope.format;
|
|
140
|
-
if ($scope.enableOkButtons)
|
|
141
|
-
params.enableOkButtons = $scope.enableOkButtons === 'true';
|
|
142
|
-
if ($scope.lang)
|
|
143
|
-
params.lang = $scope.lang;
|
|
144
|
-
if ($scope.minDate)
|
|
145
|
-
params.minDate = $scope.minDate;
|
|
146
|
-
if ($scope.maxDate)
|
|
147
|
-
params.maxDate = $scope.maxDate;
|
|
148
|
-
if ($scope.weekStart)
|
|
149
|
-
params.weekStart = parseInt($scope.weekStart);
|
|
150
|
-
if ($scope.okText)
|
|
151
|
-
params.okText = $scope.okText;
|
|
152
|
-
if ($scope.cancelText)
|
|
153
|
-
params.cancelText = $scope.cancelText;
|
|
154
|
-
if ($scope.noMargin)
|
|
155
|
-
params.noMargin = $scope.noMargin === 'true';
|
|
156
|
-
if ($scope.modelFormat)
|
|
157
|
-
params.modelFormat = $scope.modelFormat;
|
|
158
|
-
|
|
159
|
-
$scope.date = params.date;
|
|
160
|
-
$scope.time = params.time;
|
|
161
|
-
|
|
162
|
-
// copy attributes back to scope - for template usage
|
|
163
|
-
$scope = angular.extend($scope, params);
|
|
164
|
-
|
|
165
|
-
$scope.openDtpRange = function () {
|
|
166
|
-
if (!$scope.isDisabled) {
|
|
167
|
-
initCurrentDates();
|
|
168
|
-
$scope.showDtpRange = true;
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
$scope.okClick = function () {
|
|
173
|
-
setLabelValue();
|
|
174
|
-
var _start = moment($scope.internalStart, params.modelFormat);
|
|
175
|
-
if ($scope.formatOutput) _start = _start.format(params.modelFormat);
|
|
176
|
-
$scope.modelStart = _start;
|
|
177
|
-
|
|
178
|
-
var _end = moment($scope.internalEnd, params.modelFormat);
|
|
179
|
-
if ($scope.formatOutput) _end = _end.format(params.modelFormat);
|
|
180
|
-
$scope.modelEnd = _end;
|
|
181
|
-
|
|
182
|
-
//$scope.modelStart = angular.copy($scope.internalStart);
|
|
183
|
-
//$scope.modelEnd = angular.copy($scope.internalEnd);
|
|
184
|
-
$scope.showDtpRange = false;
|
|
185
|
-
|
|
186
|
-
if ($scope.onChange) $scope.onChange({ modelStart: $scope.modelStart, modelEnd: $scope.modelEnd });
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
$scope.cancelClick = function () {
|
|
190
|
-
$scope.showDtpRange = false;
|
|
191
|
-
//$scope.internalStart = angular.copy($scope.modelStart);
|
|
192
|
-
//$scope.internalEnd = angular.copy($scope.modelEnd);
|
|
193
|
-
var _start = moment($scope.modelStart);
|
|
194
|
-
if ($scope.formatOutput) _start = _start.format(params.modelFormat);
|
|
195
|
-
var _end = moment($scope.modelEnd);
|
|
196
|
-
if ($scope.formatOutput) _end = _end.format(params.modelFormat);
|
|
197
|
-
|
|
198
|
-
$scope.internalStart = _start;
|
|
199
|
-
$scope.internalEnd = _end;
|
|
200
|
-
setLabelValue();
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
$scope.selectLastNDays = function (days) {
|
|
204
|
-
$scope.dateStart = moment().subtract(days, 'days');
|
|
205
|
-
$scope.dateEnd = moment();
|
|
206
|
-
$scope.internalStart = $scope.dateStart;
|
|
207
|
-
$scope.internalEnd = $scope.dateEnd;
|
|
208
|
-
setLabelValue();
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
$scope.selectLastMonth = function () {
|
|
212
|
-
$scope.dateStart = moment().subtract(1, 'months');
|
|
213
|
-
$scope.dateEnd = moment();
|
|
214
|
-
$scope.internalStart = $scope.dateStart;
|
|
215
|
-
$scope.internalEnd = $scope.dateEnd;
|
|
216
|
-
setLabelValue();
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
$scope.selectThisMonth = function () {
|
|
220
|
-
$scope.dateStart = moment().date(1).hours(0).minutes(0).seconds(0).milliseconds(0);
|
|
221
|
-
$scope.dateEnd = moment().endOf('month');
|
|
222
|
-
$scope.internalStart = $scope.dateStart;
|
|
223
|
-
$scope.internalEnd = $scope.dateEnd;
|
|
224
|
-
setLabelValue();
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
//$scope.$on('dateSelected', function () {
|
|
229
|
-
// $scope.formDatetimePicker.$setDirty();
|
|
230
|
-
// console.log('date selected');
|
|
231
|
-
//});
|
|
232
|
-
|
|
233
|
-
$scope.$watchGroup(['dateStart', 'dateEnd'], function (newValues) {
|
|
234
|
-
$scope.internalStart = moment(newValues[0]);
|
|
235
|
-
$scope.internalEnd = moment(newValues[1]);
|
|
236
|
-
setLabelValue();
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
$scope.$watchGroup(['modelStart', 'modelEnd'], function () {
|
|
240
|
-
initCurrentDates();
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @ngdoc directive
|
|
5
|
+
* @name niceElements.directive:niceDatetimerangePicker
|
|
6
|
+
* @description
|
|
7
|
+
* # niceDatetimerangePicker
|
|
8
|
+
*/
|
|
9
|
+
angular.module('niceElements')
|
|
10
|
+
.directive('niceDatetimerangePicker', function (gettextCatalog) {
|
|
11
|
+
return {
|
|
12
|
+
scope: {
|
|
13
|
+
modelStart: '=', // binding model
|
|
14
|
+
modelEnd: '=', // binding model
|
|
15
|
+
format: '@', // default: 'D.M.YYYY • H:mm', format for input label string
|
|
16
|
+
modelFormat: '@',
|
|
17
|
+
date: '@', // default: true, is date picker enabled?
|
|
18
|
+
time: '@', // default: false, is time picker enabled?
|
|
19
|
+
width: '@', // default: 300, width of entire dtp-picker in px
|
|
20
|
+
enableOkButtons: '@', // default: false, is ok/cancel buttons enabled?
|
|
21
|
+
lang: '@', // default: 'en', which locale to use - you must load angular locales first
|
|
22
|
+
minDate: '@', // default: undefined
|
|
23
|
+
maxDate: '@', // default: undefined
|
|
24
|
+
weekStart: '@', // default: 1, which day does the week start? (0 - sunday, 1 - monday, ...)
|
|
25
|
+
okText: '@',
|
|
26
|
+
cancelText: '@',
|
|
27
|
+
shortTime: '@', // default: false,
|
|
28
|
+
title: '@', // default: ''
|
|
29
|
+
noMargin: '@', // default: false, if noMargin==true then entire directive can be injected inside other divs
|
|
30
|
+
fieldWidth: '@', // default: 'col-sm-8', bootstrap classes that defines width of field
|
|
31
|
+
labelWidth: '@', // default: 'col-sm-4', bootstrap classes that defines width of label,
|
|
32
|
+
formatOutput: '@', // Format output or moment
|
|
33
|
+
isDisabled: '=',
|
|
34
|
+
help: '@',
|
|
35
|
+
isInline: '=',
|
|
36
|
+
onChange: '&?'
|
|
37
|
+
},
|
|
38
|
+
templateUrl: 'src/components/nice-datetimerange-picker/nice-datetimerange-picker.html',
|
|
39
|
+
link: {
|
|
40
|
+
pre: function ($scope) {
|
|
41
|
+
console.warn("[NICE ELEMENTS] nice-datetimerange-picker component is deprecated!");
|
|
42
|
+
// Default parameters
|
|
43
|
+
var params = {
|
|
44
|
+
title: '',
|
|
45
|
+
noMargin: false,
|
|
46
|
+
fieldWidth: 'col-sm-8',
|
|
47
|
+
labelWidth: 'col-sm-4',
|
|
48
|
+
format: 'D.M.YYYY • H:mm',
|
|
49
|
+
modelFormat: 'YYYY-MM-DDTHH:mm:ss.SSS',
|
|
50
|
+
minDate: null,
|
|
51
|
+
maxDate: null,
|
|
52
|
+
lang: 'en',
|
|
53
|
+
weekStart: 1,
|
|
54
|
+
shortTime: false,
|
|
55
|
+
cancelText: gettextCatalog.getString('Cancel', null, 'Nice'),
|
|
56
|
+
okText: gettextCatalog.getString('OK', null, 'Nice'),
|
|
57
|
+
date: true,
|
|
58
|
+
time: false,
|
|
59
|
+
width: 300,
|
|
60
|
+
enableOkButtons: false
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
if ($scope.formatOutput === undefined) $scope.formatOutput = false;
|
|
64
|
+
|
|
65
|
+
var setLabelValue = function () {
|
|
66
|
+
var _from = moment($scope.internalStart).format(params.format);
|
|
67
|
+
var _to = moment($scope.internalEnd).format(params.format);
|
|
68
|
+
$scope.value = _from + ' - ' + _to;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
var initCurrentDates = function () {
|
|
72
|
+
if (typeof ($scope.modelStart) === 'undefined' || $scope.modelStart === null) {
|
|
73
|
+
var _start = moment().subtract(1, 'days');
|
|
74
|
+
if ($scope.formatOutput) _start = _start.format(params.modelFormat);
|
|
75
|
+
$scope.modelStart = _start;
|
|
76
|
+
|
|
77
|
+
} else {
|
|
78
|
+
if (!params.date && params.time) {
|
|
79
|
+
// if only time
|
|
80
|
+
var _time = moment();
|
|
81
|
+
var i_hour = params.modelFormat.indexOf('HH:mm');
|
|
82
|
+
var i_min = params.modelFormat.indexOf('mm');
|
|
83
|
+
var hours = $scope.model.substring(i_hour, i_hour + 2);
|
|
84
|
+
var minutes = $scope.model.substring(i_min, i_min + 2);
|
|
85
|
+
|
|
86
|
+
if (i_hour > -1 && i_min > -1) {
|
|
87
|
+
_time.hours(hours);
|
|
88
|
+
_time.minutes(minutes);
|
|
89
|
+
} else {
|
|
90
|
+
console.error('Cannot parse current time model with passed modelFilter. Please check if you missed ' +
|
|
91
|
+
'modelFilter setting in directive.. Falling back to current time instead.');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
$scope.dateStart = _time;
|
|
95
|
+
} else {
|
|
96
|
+
$scope.dateStart = moment($scope.modelStart);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// initialize dateEnd
|
|
101
|
+
if (typeof ($scope.modelEnd) === 'undefined' || $scope.modelEnd === null) {
|
|
102
|
+
var _end = moment();
|
|
103
|
+
if ($scope.formatOutput) _end = _end.format(params.modelFormat);
|
|
104
|
+
$scope.modelEnd = _end;
|
|
105
|
+
|
|
106
|
+
} else {
|
|
107
|
+
if (!params.date && params.time) {
|
|
108
|
+
// if only time
|
|
109
|
+
var _time = moment();
|
|
110
|
+
var i_hour = params.modelFormat.indexOf('HH:mm');
|
|
111
|
+
var i_min = params.modelFormat.indexOf('mm');
|
|
112
|
+
var hours = $scope.model.substring(i_hour, i_hour + 2);
|
|
113
|
+
var minutes = $scope.model.substring(i_min, i_min + 2);
|
|
114
|
+
|
|
115
|
+
if (i_hour > -1 && i_min > -1) {
|
|
116
|
+
_time.hours(hours);
|
|
117
|
+
_time.minutes(minutes);
|
|
118
|
+
} else {
|
|
119
|
+
console.error('Cannot parse current time model with passed modelFilter. Please check if you missed ' +
|
|
120
|
+
'modelFilter setting in directive.. Falling back to current time instead.');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
$scope.dateEnd = _time;
|
|
124
|
+
} else {
|
|
125
|
+
$scope.dateEnd = moment($scope.modelEnd);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Fix dateEnd if it's before dateStart
|
|
130
|
+
if ($scope.dateStart > $scope.dateEnd) {
|
|
131
|
+
$scope.dateEnd = moment($scope.dateStart);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// prepare attributes
|
|
136
|
+
params.date = $scope.date === 'true';
|
|
137
|
+
params.time = $scope.time === 'true';
|
|
138
|
+
if ($scope.format && $scope.format != "")
|
|
139
|
+
params.format = $scope.format;
|
|
140
|
+
if ($scope.enableOkButtons)
|
|
141
|
+
params.enableOkButtons = $scope.enableOkButtons === 'true';
|
|
142
|
+
if ($scope.lang)
|
|
143
|
+
params.lang = $scope.lang;
|
|
144
|
+
if ($scope.minDate)
|
|
145
|
+
params.minDate = $scope.minDate;
|
|
146
|
+
if ($scope.maxDate)
|
|
147
|
+
params.maxDate = $scope.maxDate;
|
|
148
|
+
if ($scope.weekStart)
|
|
149
|
+
params.weekStart = parseInt($scope.weekStart);
|
|
150
|
+
if ($scope.okText)
|
|
151
|
+
params.okText = $scope.okText;
|
|
152
|
+
if ($scope.cancelText)
|
|
153
|
+
params.cancelText = $scope.cancelText;
|
|
154
|
+
if ($scope.noMargin)
|
|
155
|
+
params.noMargin = $scope.noMargin === 'true';
|
|
156
|
+
if ($scope.modelFormat)
|
|
157
|
+
params.modelFormat = $scope.modelFormat;
|
|
158
|
+
|
|
159
|
+
$scope.date = params.date;
|
|
160
|
+
$scope.time = params.time;
|
|
161
|
+
|
|
162
|
+
// copy attributes back to scope - for template usage
|
|
163
|
+
$scope = angular.extend($scope, params);
|
|
164
|
+
|
|
165
|
+
$scope.openDtpRange = function () {
|
|
166
|
+
if (!$scope.isDisabled) {
|
|
167
|
+
initCurrentDates();
|
|
168
|
+
$scope.showDtpRange = true;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
$scope.okClick = function () {
|
|
173
|
+
setLabelValue();
|
|
174
|
+
var _start = moment($scope.internalStart, params.modelFormat);
|
|
175
|
+
if ($scope.formatOutput) _start = _start.format(params.modelFormat);
|
|
176
|
+
$scope.modelStart = _start;
|
|
177
|
+
|
|
178
|
+
var _end = moment($scope.internalEnd, params.modelFormat);
|
|
179
|
+
if ($scope.formatOutput) _end = _end.format(params.modelFormat);
|
|
180
|
+
$scope.modelEnd = _end;
|
|
181
|
+
|
|
182
|
+
//$scope.modelStart = angular.copy($scope.internalStart);
|
|
183
|
+
//$scope.modelEnd = angular.copy($scope.internalEnd);
|
|
184
|
+
$scope.showDtpRange = false;
|
|
185
|
+
|
|
186
|
+
if ($scope.onChange) $scope.onChange({ modelStart: $scope.modelStart, modelEnd: $scope.modelEnd });
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
$scope.cancelClick = function () {
|
|
190
|
+
$scope.showDtpRange = false;
|
|
191
|
+
//$scope.internalStart = angular.copy($scope.modelStart);
|
|
192
|
+
//$scope.internalEnd = angular.copy($scope.modelEnd);
|
|
193
|
+
var _start = moment($scope.modelStart);
|
|
194
|
+
if ($scope.formatOutput) _start = _start.format(params.modelFormat);
|
|
195
|
+
var _end = moment($scope.modelEnd);
|
|
196
|
+
if ($scope.formatOutput) _end = _end.format(params.modelFormat);
|
|
197
|
+
|
|
198
|
+
$scope.internalStart = _start;
|
|
199
|
+
$scope.internalEnd = _end;
|
|
200
|
+
setLabelValue();
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
$scope.selectLastNDays = function (days) {
|
|
204
|
+
$scope.dateStart = moment().subtract(days, 'days');
|
|
205
|
+
$scope.dateEnd = moment();
|
|
206
|
+
$scope.internalStart = $scope.dateStart;
|
|
207
|
+
$scope.internalEnd = $scope.dateEnd;
|
|
208
|
+
setLabelValue();
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
$scope.selectLastMonth = function () {
|
|
212
|
+
$scope.dateStart = moment().subtract(1, 'months');
|
|
213
|
+
$scope.dateEnd = moment();
|
|
214
|
+
$scope.internalStart = $scope.dateStart;
|
|
215
|
+
$scope.internalEnd = $scope.dateEnd;
|
|
216
|
+
setLabelValue();
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
$scope.selectThisMonth = function () {
|
|
220
|
+
$scope.dateStart = moment().date(1).hours(0).minutes(0).seconds(0).milliseconds(0);
|
|
221
|
+
$scope.dateEnd = moment().endOf('month');
|
|
222
|
+
$scope.internalStart = $scope.dateStart;
|
|
223
|
+
$scope.internalEnd = $scope.dateEnd;
|
|
224
|
+
setLabelValue();
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
//$scope.$on('dateSelected', function () {
|
|
229
|
+
// $scope.formDatetimePicker.$setDirty();
|
|
230
|
+
// console.log('date selected');
|
|
231
|
+
//});
|
|
232
|
+
|
|
233
|
+
$scope.$watchGroup(['dateStart', 'dateEnd'], function (newValues) {
|
|
234
|
+
$scope.internalStart = moment(newValues[0]);
|
|
235
|
+
$scope.internalEnd = moment(newValues[1]);
|
|
236
|
+
setLabelValue();
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
$scope.$watchGroup(['modelStart', 'modelEnd'], function () {
|
|
240
|
+
initCurrentDates();
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
|
|
247
247
|
});
|