nice-elements 1.12.5 → 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 +7 -0
- package/README.md +1 -1
- package/bower.json +1 -1
- package/dist/nice.js +88 -59
- package/dist/nice.min.js +1 -1
- package/dist/style.css +22 -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-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/services/nice-service.js +2 -2
- package/src/styles/_nice-common.scss +4 -2
- package/src/styles/_variables.scss +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v1.12.6 (15.7.2025)
|
|
4
|
+
|
|
5
|
+
- added validations to nice date input,
|
|
6
|
+
- added help to checkbox,
|
|
7
|
+
- added description prop to nice checkbox,
|
|
8
|
+
- added transclude to nice checkbox
|
|
9
|
+
|
|
3
10
|
## v1.12.5 (11.6.2025)
|
|
4
11
|
|
|
5
12
|
- fixed nice date wrong start of week day
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|

|
|
2
2
|
|
|
3
|
-
# Nice elements v1.12.
|
|
3
|
+
# Nice elements v1.12.6
|
|
4
4
|
|
|
5
5
|
Nice elements is an AngularJS v1.5.8 module that contains nice form elements like inputs, choice fields, search, toggle, dropdown, etc.
|
|
6
6
|
|
package/bower.json
CHANGED
package/dist/nice.js
CHANGED
|
@@ -457,14 +457,17 @@ angular.module('niceElements')
|
|
|
457
457
|
return {
|
|
458
458
|
templateUrl: 'src/components/nice-checkbox/nice-checkbox.html',
|
|
459
459
|
restrict: 'E',
|
|
460
|
+
transclude: true,
|
|
460
461
|
scope: {
|
|
461
462
|
model: '=',
|
|
462
463
|
niceTitle: '@',
|
|
464
|
+
niceDescription: '@',
|
|
463
465
|
title: '@',
|
|
464
466
|
titleOnLeft: '=',
|
|
465
467
|
noMargin: '@',
|
|
466
468
|
clickDisabled: '@',
|
|
467
469
|
onChange: '&?',
|
|
470
|
+
help: '@',
|
|
468
471
|
isDisabled: '=',
|
|
469
472
|
},
|
|
470
473
|
controller: function ($scope) {
|
|
@@ -887,8 +890,8 @@ angular.module('niceElements')
|
|
|
887
890
|
model: '=', // binding model
|
|
888
891
|
date: '=?', // default: true, is date picker enabled?
|
|
889
892
|
time: '=?', // default: false, is time picker enabled?
|
|
890
|
-
minDate: '
|
|
891
|
-
maxDate: '
|
|
893
|
+
minDate: '=', // default: undefined
|
|
894
|
+
maxDate: '=', // default: undefined
|
|
892
895
|
niceTitle: '@',
|
|
893
896
|
title: '@', // default: ''
|
|
894
897
|
noMargin: '@', // default: false, if noMargin==true then entire directive can be injected inside other divs
|
|
@@ -903,9 +906,10 @@ angular.module('niceElements')
|
|
|
903
906
|
placeholderDate: '@',
|
|
904
907
|
placeholderTime: '@',
|
|
905
908
|
},
|
|
906
|
-
controller: function ($scope, $timeout, gettextCatalog) {
|
|
909
|
+
controller: function ($scope, $element, $timeout, gettextCatalog) {
|
|
907
910
|
$scope.formatDate = "DD.MM.YYYY";
|
|
908
911
|
$scope.formatTime = "HH:mm";
|
|
912
|
+
$scope.error = '';
|
|
909
913
|
if ($scope.date === undefined) $scope.date = true;
|
|
910
914
|
if ($scope.time === undefined) $scope.time = true;
|
|
911
915
|
if (!$scope.placeholderDate) { $scope.placeholderDate = gettextCatalog.getString("••.••.••••", null, "Nice"); }
|
|
@@ -916,6 +920,12 @@ angular.module('niceElements')
|
|
|
916
920
|
dateModel: angular.copy($scope.model || moment()),
|
|
917
921
|
};
|
|
918
922
|
|
|
923
|
+
$scope.dateInput = null;
|
|
924
|
+
const timeInput = $element[0].getElementsByClassName("nice-time-input-field");
|
|
925
|
+
const dateInput = $element[0].getElementsByClassName("nice-date-input-field");
|
|
926
|
+
if (timeInput && timeInput[0]) $scope.dateInput = timeInput[0];
|
|
927
|
+
if (dateInput && dateInput[0]) $scope.dateInput = dateInput[0];
|
|
928
|
+
|
|
919
929
|
$scope.dateChanged = function () {
|
|
920
930
|
$timeout(function () {
|
|
921
931
|
$scope.modelDate = $scope.inner.dateModel.format($scope.formatDate);
|
|
@@ -935,12 +945,25 @@ angular.module('niceElements')
|
|
|
935
945
|
if (!$scope.date) $scope.modelDate = moment().format($scope.formatDate);
|
|
936
946
|
const newModel = moment($scope.modelDate + " " + $scope.modelTime, $scope.formatDate + " " + $scope.formatTime).seconds(0).milliseconds(0);
|
|
937
947
|
if (newModel.isValid()) {
|
|
938
|
-
$scope.
|
|
939
|
-
|
|
948
|
+
if ($scope.minDate && newModel.isBefore($scope.minDate)) {
|
|
949
|
+
// $scope.model = null;
|
|
950
|
+
$scope.niceDateInputForm.$setValidity('valid-date', false);
|
|
951
|
+
$scope.error = gettextCatalog.getString("Minimum date is {{date}}", { date: $scope.format($scope.minDate) }, "Nice");
|
|
952
|
+
} else if ($scope.maxDate && newModel.isAfter($scope.maxDate)) {
|
|
953
|
+
// $scope.model = null;
|
|
954
|
+
$scope.error = gettextCatalog.getString("Maximum date is {{date}}", { date: $scope.format($scope.maxDate) }, "Nice");
|
|
955
|
+
$scope.niceDateInputForm.$setValidity('valid-date', false);
|
|
956
|
+
} else {
|
|
957
|
+
$scope.model = newModel;
|
|
958
|
+
$scope.error = '';
|
|
959
|
+
$scope.niceDateInputForm.$setValidity('valid-date', null);
|
|
960
|
+
}
|
|
940
961
|
} else {
|
|
941
|
-
$scope.model = null;
|
|
942
|
-
$scope.
|
|
962
|
+
// $scope.model = null;
|
|
963
|
+
$scope.error = gettextCatalog.getString("Date is not valid", null, "Nice");
|
|
964
|
+
$scope.niceDateInputForm.$setValidity('valid-date', false);
|
|
943
965
|
}
|
|
966
|
+
if ($scope.dateInput) $scope.dateInput.setCustomValidity($scope.error);
|
|
944
967
|
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
945
968
|
$scope.niceDateInputForm.$setDirty();
|
|
946
969
|
};
|
|
@@ -948,6 +971,8 @@ angular.module('niceElements')
|
|
|
948
971
|
// -------------------- Clear --------------------
|
|
949
972
|
$scope.clear = function () {
|
|
950
973
|
$scope.model = null;
|
|
974
|
+
$scope.error = '';
|
|
975
|
+
if ($scope.dateInput) $scope.dateInput.setCustomValidity($scope.error);
|
|
951
976
|
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
952
977
|
$scope.niceDateInputForm.$setDirty();
|
|
953
978
|
};
|
|
@@ -964,26 +989,19 @@ angular.module('niceElements')
|
|
|
964
989
|
};
|
|
965
990
|
$scope.formatModel();
|
|
966
991
|
|
|
992
|
+
// -------------------- Format date --------------------
|
|
993
|
+
$scope.format = function (date) {
|
|
994
|
+
return moment(date).format($scope.formatDate + ($scope.time ? (" • " + $scope.formatTime) : ""));
|
|
995
|
+
};
|
|
996
|
+
|
|
967
997
|
// -------------------- Date --------------------
|
|
968
998
|
$scope.dateBlur = function () {
|
|
969
|
-
|
|
970
|
-
if (newDate.isValid()) {
|
|
971
|
-
$scope.niceDateInputForm.$setValidity('validDate', true);
|
|
972
|
-
$scope.handleChange();
|
|
973
|
-
} else {
|
|
974
|
-
$scope.niceDateInputForm.$setValidity('validDate', false);
|
|
975
|
-
}
|
|
999
|
+
$scope.handleChange();
|
|
976
1000
|
};
|
|
977
1001
|
|
|
978
1002
|
// -------------------- Time --------------------
|
|
979
1003
|
$scope.timeBlur = function () {
|
|
980
|
-
|
|
981
|
-
if (newTime.isValid()) {
|
|
982
|
-
$scope.niceDateInputForm.$setValidity('validDate', true);
|
|
983
|
-
$scope.handleChange();
|
|
984
|
-
} else {
|
|
985
|
-
$scope.niceDateInputForm.$setValidity('validDate', false);
|
|
986
|
-
}
|
|
1004
|
+
$scope.handleChange();
|
|
987
1005
|
};
|
|
988
1006
|
|
|
989
1007
|
// -------------------- Watch model --------------------
|
|
@@ -6477,7 +6495,11 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
|
|
|
6477
6495
|
" <button type=\"button\" class=\"btn nice-checkbox-checkbox\" ng-disabled=\"isDisabled\">\n" +
|
|
6478
6496
|
" <nice-icon class=\"nice-checkbox-check\" icon=\"icon-check\"></nice-icon>\n" +
|
|
6479
6497
|
" </button>\n" +
|
|
6480
|
-
" <div
|
|
6498
|
+
" <div class=\"nice-checkbox-info\" ng-transclude>\n" +
|
|
6499
|
+
" <nice-title text=\"title || niceTitle\" help=\"help\" required=\"required\" description=\"niceDescription\" label-width=\"col-xs-12\"></nice-title>\n" +
|
|
6500
|
+
" \n" +
|
|
6501
|
+
" \n" +
|
|
6502
|
+
" </div>\n" +
|
|
6481
6503
|
"</div>"
|
|
6482
6504
|
);
|
|
6483
6505
|
|
|
@@ -6521,56 +6543,63 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
|
|
|
6521
6543
|
|
|
6522
6544
|
|
|
6523
6545
|
$templateCache.put('src/components/nice-date-input/nice-date-input.html',
|
|
6524
|
-
"<
|
|
6546
|
+
"<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 }\">\n" +
|
|
6525
6547
|
" <div class=\"row\">\n" +
|
|
6526
6548
|
" \n" +
|
|
6527
6549
|
" <nice-title text=\"title || niceTitle\" help=\"help\" required=\"required\" label-width=\"labelWidth\"></nice-title>\n" +
|
|
6528
6550
|
"\n" +
|
|
6529
6551
|
" \n" +
|
|
6530
6552
|
" <div class=\"nice-field col-xs-12\" ng-class=\"[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]\">\n" +
|
|
6531
|
-
" <div class=\"
|
|
6532
|
-
" <
|
|
6533
|
-
"
|
|
6534
|
-
" <nice-popup
|
|
6535
|
-
" <
|
|
6536
|
-
" <
|
|
6537
|
-
" <
|
|
6538
|
-
"
|
|
6553
|
+
" <div class=\"nice-date-field\">\n" +
|
|
6554
|
+
" <div class=\"input-group nice-date-input\" ng-show=\"date\" ng-class=\"{ 'has-warning': !disabled && niceDateInputForm.$invalid && niceDateInputForm.$dirty }\">\n" +
|
|
6555
|
+
" <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\">\n" +
|
|
6556
|
+
" <nice-popup placement=\"bottom\">\n" +
|
|
6557
|
+
" <nice-popup-target>\n" +
|
|
6558
|
+
" <span class=\"input-group-btns input-group-btn\">\n" +
|
|
6559
|
+
" <button type=\"button\" class=\"btn btn-default btn-right\" ng-if=\"model && nullable\" tabindex=\"-1\" ng-disabled=\"isDisabled\" ng-click=\"clear()\">\n" +
|
|
6560
|
+
" <nice-icon icon=\"icon-x\"></nice-icon>\n" +
|
|
6561
|
+
" </button>\n" +
|
|
6562
|
+
"\n" +
|
|
6563
|
+
" <button type=\"button\" class=\"btn btn-default btn-right\" tabindex=\"-1\" ng-disabled=\"isDisabled\">\n" +
|
|
6564
|
+
" <nice-icon icon=\"icon-calendar\"></nice-icon>\n" +
|
|
6565
|
+
" </button>\n" +
|
|
6566
|
+
" </span>\n" +
|
|
6567
|
+
" </nice-popup-target>\n" +
|
|
6539
6568
|
"\n" +
|
|
6540
|
-
"
|
|
6541
|
-
"
|
|
6542
|
-
"
|
|
6543
|
-
"
|
|
6544
|
-
"
|
|
6569
|
+
" <nice-popup-content>\n" +
|
|
6570
|
+
" <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>\n" +
|
|
6571
|
+
" </nice-popup-content>\n" +
|
|
6572
|
+
" </nice-popup>\n" +
|
|
6573
|
+
" </div>\n" +
|
|
6545
6574
|
"\n" +
|
|
6546
|
-
"
|
|
6547
|
-
"
|
|
6548
|
-
"
|
|
6549
|
-
"
|
|
6550
|
-
"
|
|
6551
|
-
"
|
|
6552
|
-
"
|
|
6553
|
-
"
|
|
6554
|
-
"
|
|
6555
|
-
"
|
|
6556
|
-
"
|
|
6557
|
-
"
|
|
6558
|
-
" </
|
|
6575
|
+
" <div class=\"input-group nice-time-input\" ng-show=\"time\" ng-class=\"{ 'has-warning': !disabled && niceDateInputForm.$invalid && niceDateInputForm.$dirty }\">\n" +
|
|
6576
|
+
" <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\">\n" +
|
|
6577
|
+
" <nice-popup placement=\"bottom\">\n" +
|
|
6578
|
+
" <nice-popup-target>\n" +
|
|
6579
|
+
" <span class=\"input-group-btns input-group-btn\">\n" +
|
|
6580
|
+
" <button type=\"button\" class=\"btn btn-default btn-right\" ng-if=\"model && nullable && !date\" tabindex=\"-1\" ng-disabled=\"isDisabled\" ng-click=\"clear()\">\n" +
|
|
6581
|
+
" <nice-icon icon=\"icon-x\"></nice-icon>\n" +
|
|
6582
|
+
" </button>\n" +
|
|
6583
|
+
"\n" +
|
|
6584
|
+
" <button type=\"button\" class=\"btn btn-default btn-right\" tabindex=\"-1\" ng-disabled=\"isDisabled\">\n" +
|
|
6585
|
+
" <nice-icon icon=\"icon-clock\"></nice-icon>\n" +
|
|
6586
|
+
" </button>\n" +
|
|
6587
|
+
" </span>\n" +
|
|
6588
|
+
" </nice-popup-target>\n" +
|
|
6559
6589
|
"\n" +
|
|
6560
|
-
"
|
|
6561
|
-
"
|
|
6562
|
-
"
|
|
6563
|
-
"
|
|
6564
|
-
"
|
|
6590
|
+
" <nice-popup-content>\n" +
|
|
6591
|
+
" <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>\n" +
|
|
6592
|
+
" </nice-popup-content>\n" +
|
|
6593
|
+
" </nice-popup>\n" +
|
|
6594
|
+
" </div>\n" +
|
|
6595
|
+
" </div>\n" +
|
|
6565
6596
|
"\n" +
|
|
6566
|
-
"
|
|
6567
|
-
"
|
|
6568
|
-
" </nice-popup-content>\n" +
|
|
6569
|
-
" </nice-popup>\n" +
|
|
6597
|
+
" <div class=\"error-message\" ng-if=\"error\">\n" +
|
|
6598
|
+
" <div class=\"error-message\">{{ error }}</div>\n" +
|
|
6570
6599
|
" </div>\n" +
|
|
6571
6600
|
" </div>\n" +
|
|
6572
6601
|
" </div>\n" +
|
|
6573
|
-
"</
|
|
6602
|
+
"</ng-form>"
|
|
6574
6603
|
);
|
|
6575
6604
|
|
|
6576
6605
|
|