nice-elements 1.14.0 → 1.15.0

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/CLAUDE.md +89 -0
  3. package/README.md +3 -1
  4. package/bower.json +1 -1
  5. package/dist/nice.js +605 -93
  6. package/dist/nice.min.js +1 -1
  7. package/dist/style.css +216 -3
  8. package/dist/style.css.map +1 -1
  9. package/dist/style.min.css +2 -2
  10. package/package.json +2 -2
  11. package/src/components/nice-alert/nice-alert.scss +5 -0
  12. package/src/components/nice-badges-list/nice-badges-list.html +13 -0
  13. package/src/components/nice-badges-list/nice-badges-list.js +135 -0
  14. package/src/components/nice-badges-list/nice-badges-list.scss +75 -0
  15. package/src/components/nice-checkbox/nice-checkbox.html +1 -1
  16. package/src/components/nice-date/nice-date.js +3 -1
  17. package/src/components/nice-date/nice-date.scss +1 -0
  18. package/src/components/nice-date-range/nice-date-range.js +7 -7
  19. package/src/components/nice-datetime-picker/nice-datetime-picker.html +3 -3
  20. package/src/components/nice-datetime-picker/nice-datetime-picker.js +7 -2
  21. package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.html +2 -2
  22. package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.scss +1 -0
  23. package/src/components/nice-dialog/nice-dialog.html +16 -0
  24. package/src/components/nice-dialog/nice-dialog.js +47 -0
  25. package/src/components/nice-dialog/nice-dialog.scss +126 -0
  26. package/src/components/nice-dropdown/nice-dropdown.html +3 -3
  27. package/src/components/nice-dropdown/nice-dropdown.js +9 -1
  28. package/src/components/nice-dropdown/nice-dropdown.scss +20 -0
  29. package/src/components/nice-dropdown-date/nice-dropdown-date.js +3 -1
  30. package/src/components/nice-input/nice-input.js +12 -8
  31. package/src/components/nice-input/nice-input.scss +1 -1
  32. package/src/components/nice-no-data/nice-no-data.js +3 -1
  33. package/src/components/nice-notification/nice-notification.scss +3 -1
  34. package/src/components/nice-number/nice-number.html +23 -9
  35. package/src/components/nice-number/nice-number.js +81 -12
  36. package/src/components/nice-percent/nice-percent.html +5 -5
  37. package/src/components/nice-percent/nice-percent.js +5 -3
  38. package/src/components/nice-popup/nice-popup.js +2 -2
  39. package/src/components/nice-search/nice-search.html +2 -4
  40. package/src/components/nice-search/nice-search.js +32 -6
  41. package/src/components/nice-svgs/nice-svgs.html +165 -20
  42. package/src/components/nice-table/nice-table.js +9 -4
  43. package/src/components/nice-toggle/nice-toggle.html +1 -1
  44. package/src/components/nice-toggle/nice-toggle.scss +15 -1
  45. package/src/components/nice-upload/nice-upload.html +1 -1
  46. package/src/components/nice-upload/nice-upload.scss +3 -0
  47. package/src/components/nice-view/_nice-view.scss +10 -1
  48. package/src/components/nice-view/nice-view.html +1 -0
  49. package/src/components/nice-wrapper/nice-wrapper.js +3 -1
  50. package/src/components/nice-yesno/nice-yesno.js +4 -2
  51. package/src/services/nice-service.js +16 -1
  52. package/src/styles/_nice.scss +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nice-elements",
3
- "version": "1.14.0",
3
+ "version": "1.15.0",
4
4
  "description": "Nice elements used in olaii angular 1.x webapps.",
5
5
  "main": "dist/nice.js",
6
6
  "license": "MIT",
@@ -42,4 +42,4 @@
42
42
  "load-grunt-tasks": "5.1.0",
43
43
  "sass": "1.107.1"
44
44
  }
45
- }
45
+ }
@@ -31,6 +31,11 @@
31
31
  .nice-alert-title {
32
32
  font-size: 1.2em;
33
33
  font-weight: bold;
34
+ margin-bottom: 3px;
35
+ }
36
+
37
+ .nice-alert-message {
38
+ line-height: 1.4;
34
39
  }
35
40
 
36
41
  &.nice-alert-success {
@@ -0,0 +1,13 @@
1
+ <div class="nice-badges-list" ng-class="{ 'nice-badges-list-full-width': fullWidth, 'nice-badges-list-expanded': expanded }">
2
+ <!-- Full width: all badges are rendered so they can be measured, the overflowing ones are hidden -->
3
+ <div class="nice-badge nice-badge-item" ng-if="fullWidth" ng-class="[badgeClass, { 'nice-badge-hidden': !expanded && $index >= visibleCount }]" ng-repeat="item in items track by $index" title="{{ getLabel(item) }}">{{ getLabel(item) }}</div>
4
+
5
+ <!-- Fixed limit -->
6
+ <div class="nice-badge nice-badge-item" ng-if="!fullWidth" ng-class="badgeClass" ng-repeat="item in items | limitTo:(expanded ? items.length : getLimit()) track by $index">{{ getLabel(item) }}</div>
7
+
8
+ <!-- More / less toggle -->
9
+ <div class="nice-badge nice-badge-more" ng-show="getHiddenCount() > 0" ng-click="toggle()">
10
+ <span ng-if="!expanded" translate translate-context="Nice" translate-n="getHiddenCount()" translate-plural="+{{$count}} more">+{{$count}} more</span>
11
+ <span ng-if="expanded" translate translate-context="Nice">Show less</span>
12
+ </div>
13
+ </div>
@@ -0,0 +1,135 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @ngdoc directive
5
+ * @name niceElements.directive:niceBadgesList
6
+ * @description
7
+ * # niceBadgesList
8
+ * Row of small badges that shows the first few items and collapses the rest into a "+X more" toggle.
9
+ * `label` is an expression with `item` in scope, e.g. `label="item.name"`; without it the item itself is shown.
10
+ *
11
+ * With `full-width="true"` the list fills the available width: when collapsed it stays on one line and shows
12
+ * as many badges as fit (the `limit` is ignored), expanding shows all badges on multiple lines.
13
+ *
14
+ * Usage:
15
+ * <nice-badges-list items="row.ticket_types" label="item.name" limit="3" badge-class="badge-color-1"></nice-badges-list>
16
+ * <nice-badges-list items="row.ticket_types" label="item.name" full-width="true"></nice-badges-list>
17
+ */
18
+ angular.module('niceElements')
19
+ .directive('niceBadgesList', function ($timeout) {
20
+ return {
21
+ templateUrl: 'src/components/nice-badges-list/nice-badges-list.html',
22
+ restrict: 'E',
23
+ scope: {
24
+ items: '<',
25
+ label: '&?',
26
+ limit: '<?',
27
+ fullWidth: '<?',
28
+ badgeClass: '@?'
29
+ },
30
+ link: function (scope, element) {
31
+ scope.expanded = false;
32
+ scope.visibleCount = 0;
33
+
34
+ scope.getItemsLength = function () {
35
+ return scope.items ? scope.items.length : 0;
36
+ };
37
+
38
+ scope.getLimit = function () {
39
+ if (scope.fullWidth) return scope.visibleCount;
40
+ return angular.isNumber(scope.limit) ? scope.limit : 3;
41
+ };
42
+
43
+ scope.getHiddenCount = function () {
44
+ return Math.max(scope.getItemsLength() - scope.getLimit(), 0);
45
+ };
46
+
47
+ scope.getLabel = function (item) {
48
+ return scope.label ? scope.label({ item: item }) : item;
49
+ };
50
+
51
+ scope.toggle = function () {
52
+ scope.expanded = !scope.expanded;
53
+ };
54
+
55
+
56
+ // ---------- Full width: fit as many badges as possible in one line ----------
57
+
58
+ // Measures all badges laid out in a single line and returns how many fit next to the "+X more" toggle
59
+ function measureVisibleCount() {
60
+ var container = element[0].querySelector('.nice-badges-list');
61
+ if (!container) return 0;
62
+
63
+ container.classList.add('nice-badges-list-measuring');
64
+
65
+ var badges = container.querySelectorAll('.nice-badge-item');
66
+ var more = container.querySelector('.nice-badge-more');
67
+ var available = container.clientWidth;
68
+ var gap = parseFloat(window.getComputedStyle(container).columnGap) || 0;
69
+ var moreWidth = more ? more.getBoundingClientRect().width + gap : 0;
70
+
71
+ var widths = [];
72
+ var total = 0;
73
+ for (var i = 0; i < badges.length; i++) {
74
+ widths.push(badges[i].getBoundingClientRect().width);
75
+ total += widths[i] + (i > 0 ? gap : 0);
76
+ }
77
+
78
+ container.classList.remove('nice-badges-list-measuring');
79
+
80
+ // Everything fits, no toggle needed
81
+ if (total <= available) return widths.length;
82
+
83
+ var count = 0;
84
+ var used = moreWidth;
85
+ for (var j = 0; j < widths.length; j++) {
86
+ used += widths[j] + (j > 0 ? gap : 0);
87
+ if (used > available) break;
88
+ count++;
89
+ }
90
+
91
+ // Always show at least one badge (it gets truncated if it's too wide)
92
+ return Math.max(count, Math.min(1, widths.length));
93
+ }
94
+
95
+ function calculate() {
96
+ if (!scope.fullWidth) return;
97
+ var count = measureVisibleCount();
98
+ if (count !== scope.visibleCount) {
99
+ scope.visibleCount = count;
100
+ // The "+X more" label width depends on the count, so check once more after it re-renders
101
+ $timeout(function () {
102
+ var recount = measureVisibleCount();
103
+ if (recount < scope.visibleCount) scope.visibleCount = recount;
104
+ });
105
+ }
106
+ }
107
+
108
+ var lastWidth = null;
109
+ var resizeObserver = new ResizeObserver(function (entries) {
110
+ var width = entries[0].contentRect.width;
111
+ if (width === lastWidth) return;
112
+ lastWidth = width;
113
+ scope.$applyAsync(calculate);
114
+ });
115
+
116
+ scope.$watch('fullWidth', function (fullWidth) {
117
+ if (fullWidth) {
118
+ resizeObserver.observe(element[0]);
119
+ $timeout(calculate);
120
+ } else {
121
+ resizeObserver.disconnect();
122
+ lastWidth = null;
123
+ }
124
+ });
125
+
126
+ scope.$watchCollection('items', function () {
127
+ if (scope.fullWidth) $timeout(calculate);
128
+ });
129
+
130
+ scope.$on('$destroy', function () {
131
+ resizeObserver.disconnect();
132
+ });
133
+ }
134
+ };
135
+ });
@@ -0,0 +1,75 @@
1
+ nice-badges-list {
2
+ display: block;
3
+ min-width: 0;
4
+ }
5
+
6
+ .nice-badges-list {
7
+ display: flex;
8
+ flex-wrap: wrap;
9
+ gap: 0.2rem;
10
+
11
+ // Full width collapsed: a single line, overflowing badges are hidden
12
+ &.nice-badges-list-full-width:not(.nice-badges-list-expanded) {
13
+ flex-wrap: nowrap;
14
+ overflow: hidden;
15
+
16
+ .nice-badge-item {
17
+ min-width: 0;
18
+ flex-shrink: 1;
19
+ }
20
+
21
+ .nice-badge-hidden {
22
+ display: none;
23
+ }
24
+ }
25
+
26
+ // Temporary state while badge widths are measured
27
+ &.nice-badges-list-measuring.nice-badges-list-full-width {
28
+ flex-wrap: nowrap;
29
+
30
+ .nice-badge-item {
31
+ flex-shrink: 0;
32
+ }
33
+
34
+ .nice-badge-hidden {
35
+ display: block;
36
+ }
37
+
38
+ .nice-badge-more {
39
+ display: inline-flex !important;
40
+ }
41
+ }
42
+ }
43
+
44
+ .nice-badge {
45
+ display: inline-flex;
46
+ align-items: center;
47
+ justify-content: center;
48
+ padding: 3px 7px;
49
+ font-size: 0.7em;
50
+ line-height: 1;
51
+ white-space: nowrap;
52
+ border-radius: var(--nice-border-radius-small);
53
+ background: var(--nice-primary-color-plain);
54
+ color: var(--nice-primary-color);
55
+ }
56
+
57
+ .nice-badge-item {
58
+ overflow: hidden;
59
+ text-overflow: ellipsis;
60
+ // inline-flex doesn't ellipsize text nodes, so use block for the item itself
61
+ display: block;
62
+ }
63
+
64
+ // Transparent "+X more" toggle shown after a collapsed list of badges
65
+ .nice-badge-more {
66
+ flex-shrink: 0;
67
+ background: transparent;
68
+ color: var(--nice-font-color-lighter);
69
+ cursor: pointer;
70
+ user-select: none;
71
+
72
+ &:hover {
73
+ color: var(--nice-font-color);
74
+ }
75
+ }
@@ -14,7 +14,7 @@
14
14
  <nice-icon ng-if="!model && indeterminate" class="nice-checkbox-check" icon="icon-minus"></nice-icon>
15
15
  </button>
16
16
  <div class="nice-checkbox-info" ng-transclude>
17
- <nice-title text="title || niceTitle" help="help" required="required" description="description" description="niceDescription" label-width="col-xs-12"></nice-title>
17
+ <nice-title text="title || niceTitle" help="help" required="required" description="niceDescription" label-width="col-xs-12"></nice-title>
18
18
  <!-- <div ng-if="title || niceTitle" class="nice-checkbox-message" ng-class="{ 'nice-disabled': isDisabled }">{{ title || niceTitle }}</div> -->
19
19
  <!-- <div ng-if="niceDescription" class="nice-checkbox-description" ng-class="{ 'nice-disabled': isDisabled }">{{ niceDescription }}</div> -->
20
20
  </div>
@@ -36,7 +36,9 @@ angular.module('niceElements')
36
36
  placeholder: '@',
37
37
  placement: '@', // Describes the preferred placement of the popper
38
38
  },
39
- controller: function ($scope, $element, $timeout, gettextCatalog) {
39
+ controller: function ($scope, $attrs, $element, $timeout, gettextCatalog, NiceService) {
40
+ NiceService.bindFlag($scope, $attrs, 'inline');
41
+
40
42
  $scope.isOpen = false;
41
43
  if (!$scope.placement) { $scope.placement = "bottom-start"; }
42
44
  if (!$scope.placeholder) { $scope.placeholder = gettextCatalog.getString("Select date", null, "Nice"); }
@@ -194,6 +194,7 @@
194
194
 
195
195
  &.between {
196
196
  background: var(--nice-primary-color-lighter);
197
+ color: white;
197
198
  }
198
199
 
199
200
  &:hover {
@@ -31,12 +31,12 @@ angular.module('niceElements')
31
31
  required: '='
32
32
  },
33
33
 
34
- link: function (scope, attrs) {
35
- if (!attrs.title) { attrs.title = ''; }
36
- if (!attrs.fieldWidth) { attrs.fieldWidth = 'col-sm-8'; }
37
- if (!attrs.labelWidth) { attrs.labelWidth = 'col-sm-4'; }
38
- if (!attrs.format) { attrs.format = 'dd.MM.yyyy'; }
39
- attrs.noMargin = attrs.noMargin === 'true' || attrs.noMargin === true;
34
+ link: function (scope) {
35
+ if (!scope.title) { scope.title = ''; }
36
+ if (!scope.fieldWidth) { scope.fieldWidth = 'col-sm-8'; }
37
+ if (!scope.labelWidth) { scope.labelWidth = 'col-sm-4'; }
38
+ if (!scope.format) { scope.format = 'dd.MM.yyyy'; }
39
+ scope.noMargin = scope.noMargin === 'true' || scope.noMargin === true;
40
40
 
41
41
  if (!angular.isDefined(scope.model)) {
42
42
  let model = null;
@@ -56,7 +56,7 @@ angular.module('niceElements')
56
56
  }
57
57
  },
58
58
 
59
- controller: function ($scope) {
59
+ controller: function ($scope, gettextCatalog) {
60
60
  $scope.opts = {
61
61
  locale: {
62
62
  applyClass: 'btn-green',
@@ -15,15 +15,15 @@
15
15
  <span class="input-group-btn">
16
16
  <button type="button" class="btn btn-default" ng-click="openDtp()">
17
17
  <!-- <i class="fa" ng-class="date == 'true' ? 'fa-calendar' : 'fa-clock-o'"></i> -->
18
- <nice-icon ng-if="date == 'true'" icon="icon-calendar"></nice-icon>
19
- <nice-icon ng-if="date != 'true'" icon="icon-clock"></nice-icon>
18
+ <nice-icon ng-if="isTrue(date)" icon="icon-calendar"></nice-icon>
19
+ <nice-icon ng-if="!isTrue(date)" icon="icon-clock"></nice-icon>
20
20
  </button>
21
21
  </span>
22
22
  </div>
23
23
 
24
24
  <!-- inject nice-dtp here -->
25
25
  <div ng-show="isOpen">
26
- <nice-dtp model="internalDate" format="{{ format }}" model-format="{{ modelFormat }}" date="{{ date == 'true' }}" time="{{ time == 'true' }}" width="{{ width }}" enable-ok-buttons="{{ enableOkButtons }}" lang="{{ lang }}" min-date="{{ minDate }}" max-date="{{ maxDate }}" week-start="{{ weekStart }}" ok-text="{{ okText }}" cancel-text="{{ cancelText }}" closed="closeDtp"></nice-dtp>
26
+ <nice-dtp model="internalDate" format="{{ format }}" model-format="{{ modelFormat }}" date="{{ isTrue(date) }}" time="{{ isTrue(time) }}" width="{{ width }}" enable-ok-buttons="{{ enableOkButtons }}" lang="{{ lang }}" min-date="{{ minDate }}" max-date="{{ maxDate }}" week-start="{{ weekStart }}" ok-text="{{ okText }}" cancel-text="{{ cancelText }}" closed="closeDtp"></nice-dtp>
27
27
  </div>
28
28
  </div>
29
29
  </div>
@@ -41,9 +41,14 @@ angular.module('niceElements').directive('niceDatetimePicker', function () {
41
41
  console.warn("[NICE ELEMENTS] nice-datetime-picker component is deprecated!");
42
42
  $scope.date = $scope.date == 'true' || $scope.date == true;
43
43
  $scope.time = $scope.time == 'true' || $scope.time == true;
44
- $scope.noMargin === 'true' || $scope.noMargin === true;
45
- $scope.enableOkButtons === 'true' || $scope.enableOkButtons === true;
44
+ $scope.noMargin = $scope.noMargin === 'true' || $scope.noMargin === true;
45
+ $scope.enableOkButtons = $scope.enableOkButtons === 'true' || $scope.enableOkButtons === true;
46
46
  $scope.lang = $scope.lang || 'en';
47
+
48
+ // date/time are "@" attributes, so in the template they can be the string "true" or a boolean
49
+ $scope.isTrue = function (value) {
50
+ return value === true || value === 'true';
51
+ };
47
52
  $scope.okText = $scope.okText || gettextCatalog.getString('OK', null, 'Nice');
48
53
  $scope.cancelText = $scope.cancelText || gettextCatalog.getString('Cancel', null, 'Nice');
49
54
  $scope.weekStart = parseInt($scope.weekStart) || 1;
@@ -32,11 +32,11 @@
32
32
  </div>
33
33
 
34
34
  <div class="dtp-left">
35
- <nice-date model="model.innerStartDate" next-date="model.innerEndDate" is-inline="true" no-margin="true" inline="true" time="time" on-change="dateChanged(model)"></nice-date>
35
+ <nice-date model="model.innerStartDate" next-date="model.innerEndDate" is-inline="true" no-margin="true" inline="true" time="time" min-date="minDate" max-date="maxDate" on-change="dateChanged(model)"></nice-date>
36
36
  </div>
37
37
 
38
38
  <div class="dtp-right">
39
- <nice-date model="model.innerEndDate" next-date="model.innerStartDate" is-inline="true" no-margin="true" inline="true" time="time" on-change="dateChanged(model)"></nice-date>
39
+ <nice-date model="model.innerEndDate" next-date="model.innerStartDate" is-inline="true" no-margin="true" inline="true" time="time" min-date="minDate" max-date="maxDate" on-change="dateChanged(model)"></nice-date>
40
40
  </div>
41
41
  </div>
42
42
  </div>
@@ -32,6 +32,7 @@
32
32
  width: 110px;
33
33
  display: flex;
34
34
  flex-direction: column;
35
+ flex-shrink: 0;
35
36
 
36
37
  @media (max-width: $screen-md-min) {
37
38
  width: auto;
@@ -0,0 +1,16 @@
1
+ <form class="nice-dialog" ng-submit="handleSubmit()">
2
+ <!-- Header -->
3
+ <div class="nice-dialog-header" ng-transclude="header">
4
+ <nice-icon icon="{{ niceIcon }}" ng-if="niceIcon"></nice-icon>
5
+ <div>
6
+ <div class="nice-dialog-sub-title" ng-if="niceSubtitle && !niceHideSubtitle">{{ niceSubtitle }}</div>
7
+ <div class="nice-dialog-title">{{ niceTitle }}</div>
8
+ </div>
9
+ </div>
10
+
11
+ <!-- Body -->
12
+ <div class="nice-dialog-body" ng-transclude></div>
13
+
14
+ <!-- Footer -->
15
+ <div class="nice-dialog-footer" ng-transclude="footer"></div>
16
+ </form>
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @ngdoc directive
5
+ * @name niceElements.directive:niceDialog
6
+ * @description
7
+ * # niceDialog
8
+ * Layout for dialog content (header, scrollable body, footer). Meant to be used inside an ngDialog template,
9
+ * opened with `className: 'nice-ngdialog'` and `showClose: false` (close from the footer instead).
10
+ * The whole dialog is a <form>, so `nice-submit` is called on submit (e.g. pressing enter or a type="submit" button).
11
+ * Header / footer borders appear based on the body scroll position.
12
+ *
13
+ * Usage:
14
+ * <nice-dialog nice-title="Edit" nice-subtitle="Event" nice-icon="icon-edit" nice-submit="save()">
15
+ * ...body...
16
+ * <nice-dialog-footer>
17
+ * <button type="button" class="btn btn-default" ng-click="closeThisDialog()">Cancel</button>
18
+ * <button type="submit" class="btn btn-primary">Save</button>
19
+ * </nice-dialog-footer>
20
+ * </nice-dialog>
21
+ *
22
+ * Pass <nice-dialog-header> to replace the default header (icon + subtitle + title).
23
+ */
24
+ angular.module('niceElements')
25
+ .directive('niceDialog', function () {
26
+ return {
27
+ templateUrl: 'src/components/nice-dialog/nice-dialog.html',
28
+ restrict: 'E',
29
+ replace: true,
30
+ transclude: {
31
+ 'header': '?niceDialogHeader',
32
+ 'footer': '?niceDialogFooter'
33
+ },
34
+ scope: {
35
+ niceTitle: '@',
36
+ niceIcon: '@',
37
+ niceSubtitle: '@',
38
+ niceSubmit: '&?',
39
+ niceHideSubtitle: '=?'
40
+ },
41
+ link: function (scope) {
42
+ scope.handleSubmit = function () {
43
+ if (scope.niceSubmit) scope.niceSubmit();
44
+ };
45
+ }
46
+ };
47
+ });
@@ -0,0 +1,126 @@
1
+ // ngDialog wrapper, open with className: 'nice-ngdialog', showClose: false
2
+ .nice-ngdialog {
3
+ .ngdialog-content {
4
+ background: unset;
5
+ display: flex;
6
+ justify-content: center;
7
+ align-items: center;
8
+
9
+ .nice-dialog {
10
+ max-height: calc(100dvh - 4rem);
11
+ max-width: 95%;
12
+ width: 800px;
13
+ margin: 2rem;
14
+
15
+ background: var(--nice-card-bg);
16
+ border: 1px solid var(--nice-border-color);
17
+ position: relative;
18
+ border-radius: var(--nice-border-radius);
19
+ }
20
+ }
21
+ }
22
+
23
+
24
+ .nice-dialog {
25
+ display: flex;
26
+ flex-direction: column;
27
+ max-height: calc(100vh - 6rem);
28
+ --nice-dialog-padding: 2rem;
29
+
30
+ // Header / footer borders are driven by the body scroll position (same as nice-view)
31
+ timeline-scope: --nice-dialog-scroll;
32
+
33
+ // ---------------- Dialog Header ----------------
34
+ .nice-dialog-header {
35
+ font-size: 1.3em;
36
+ line-height: 1.3;
37
+ padding: var(--nice-dialog-padding);
38
+ padding-bottom: calc(var(--nice-dialog-padding) / 2);
39
+ flex-shrink: 0;
40
+ border-bottom: 1px solid transparent;
41
+ animation: nice-dialog-header-border linear both;
42
+ animation-timeline: --nice-dialog-scroll;
43
+ animation-range: 0 1rem;
44
+
45
+ display: flex;
46
+ align-items: center;
47
+ gap: 1rem;
48
+
49
+ .nice-icon {
50
+ height: 30px;
51
+ width: 30px;
52
+ }
53
+
54
+ .nice-dialog-sub-title {
55
+ font-size: 0.7em;
56
+ color: var(--nice-font-color);
57
+ opacity: 0.8;
58
+ }
59
+
60
+ .nice-dialog-title {
61
+ font-size: 1.2em;
62
+ color: var(--nice-primary-color);
63
+ text-transform: uppercase;
64
+ }
65
+ }
66
+
67
+ // ---------------- Dialog Body ----------------
68
+ .nice-dialog-body {
69
+ padding: calc(var(--nice-dialog-padding) / 2) var(--nice-dialog-padding);
70
+ flex-grow: 1;
71
+ overflow: auto;
72
+ scroll-timeline: --nice-dialog-scroll block;
73
+ }
74
+
75
+ // ---------------- Dialog Footer ----------------
76
+ .nice-dialog-footer {
77
+ position: relative;
78
+ display: block;
79
+ padding: var(--nice-dialog-padding);
80
+ padding-top: calc(var(--nice-dialog-padding) / 2);
81
+ flex-shrink: 0;
82
+ border-top: 1px solid transparent;
83
+ animation: nice-dialog-footer-border linear both;
84
+ animation-timeline: --nice-dialog-scroll;
85
+ animation-range: calc(100% - 1rem) 100%;
86
+
87
+ // Hide the footer when nothing was passed in
88
+ &:empty {
89
+ display: none;
90
+ }
91
+
92
+ .btn-navigation {
93
+ margin: 0;
94
+ }
95
+
96
+ .view-actions {
97
+ gap: 0.5rem;
98
+
99
+ @media (max-width: $screen-xs-max) {
100
+ .split {
101
+ display: none;
102
+ }
103
+ .btn {
104
+ flex-grow: 1;
105
+ }
106
+ }
107
+ }
108
+
109
+ nice-dialog-footer {
110
+ display: flex;
111
+ justify-content: flex-end;
112
+ flex-wrap: wrap;
113
+ gap: 0.5rem;
114
+ }
115
+ }
116
+ }
117
+
118
+ @keyframes nice-dialog-header-border {
119
+ from { border-bottom-color: transparent; }
120
+ to { border-bottom-color: var(--nice-border-color); }
121
+ }
122
+
123
+ @keyframes nice-dialog-footer-border {
124
+ from { border-top-color: var(--nice-border-color); }
125
+ to { border-top-color: transparent; }
126
+ }
@@ -11,9 +11,9 @@
11
11
  <input class="hidden-input" ng-model="model" ng-required="required" ng-disabled="disabled" tabindex="-1" />
12
12
  <div class="btn-dropdown-inside" ng-transclude="button" ng-if="selected != null">
13
13
  <span ng-if="!multiple">{{ selected[objValue] }}</span>
14
- <span ng-if="multiple">
15
- <span ng-if="selected.length > 1">{{ selected.length }} {{ selectedText }}</span>
16
- <span ng-if="selected.length == 1">{{ selected[0][objValue] }}</span>
14
+ <span ng-if="multiple" class="multiple-selected" ng-class="{ 'has-more': selected.length > maxSelectedShown }">
15
+ <span ng-if="selected.length > 0" class="multiple-selected-values"><span ng-repeat="item in selected | limitTo: maxSelectedShown">{{ item[objValue] }}{{ $last ? '' : ', ' }}</span></span>
16
+ <span ng-if="selected.length > maxSelectedShown" class="multiple-selected-more">+{{ selected.length - maxSelectedShown }} {{ moreText }}</span>
17
17
  <span ng-if="selected.length == 0" class="not-selected">{{ nullableText }}</span>
18
18
  </span>
19
19
  </div>
@@ -46,6 +46,8 @@ angular.module('niceElements')
46
46
  noSearch: '=',
47
47
  nullableText: '@',
48
48
  selectedText: '@',
49
+ maxSelectedShown: '@?', // Multiple: number of selected values shown before "+x more" (default 4)
50
+ moreText: '@?', // Multiple: text after "+x" (default "more")
49
51
  dropdownDistance: '@',
50
52
  searchFunction: '=?',
51
53
  filterFunction: '=?',
@@ -54,7 +56,10 @@ angular.module('niceElements')
54
56
  enableLoadMore: '@', // Enable load more
55
57
  placement: '@', // Describes the preferred placement of the popper
56
58
  },
57
- controller: function ($scope, $http, $element, $timeout, gettextCatalog, NiceService) {
59
+ controller: function ($scope, $attrs, $http, $element, $timeout, gettextCatalog, NiceService) {
60
+ NiceService.bindFlag($scope, $attrs, 'selectedIsKey');
61
+ NiceService.bindFlag($scope, $attrs, 'enableLoadMore');
62
+
58
63
  $scope.id = Math.random().toString(36).substring(7);
59
64
  if (!$scope.dropdownDistance) { $scope.dropdownDistance = 5; }
60
65
  if (!$scope.objValue) { $scope.objValue = 'value'; }
@@ -65,6 +70,9 @@ angular.module('niceElements')
65
70
  if (!$scope.nullableText) { $scope.nullableText = gettextCatalog.getString("None", null, "Nice"); }
66
71
  if (!$scope.selectText) { $scope.selectText = gettextCatalog.getString("None", null, "Nice"); }
67
72
  if (!$scope.selectedText) { $scope.selectedText = gettextCatalog.getString("selected", null, "Nice"); }
73
+ if (!$scope.moreText) { $scope.moreText = gettextCatalog.getString("more", null, "Nice"); }
74
+ $scope.maxSelectedShown = parseInt($scope.maxSelectedShown, 10);
75
+ if (isNaN($scope.maxSelectedShown) || $scope.maxSelectedShown < 1) { $scope.maxSelectedShown = 4; }
68
76
  if (!$scope.addButtonFunction) { $scope.addButtonFunction = null; }
69
77
  if (!$scope.placement) { $scope.placement = "bottom-start"; }
70
78
  $scope.noMargin = $scope.noMargin === 'true' || $scope.noMargin === true;
@@ -205,6 +205,26 @@
205
205
  line-height: 1.2;
206
206
  margin-top: 1px;
207
207
  flex-grow: 1;
208
+
209
+ .multiple-selected {
210
+ display: flex;
211
+ align-items: baseline;
212
+ min-width: 0;
213
+ }
214
+
215
+ .multiple-selected-values {
216
+ overflow: hidden;
217
+ text-overflow: ellipsis;
218
+ white-space: nowrap;
219
+ min-width: 0;
220
+ }
221
+
222
+ .multiple-selected-more {
223
+ flex-shrink: 0;
224
+ margin-left: 6px;
225
+ opacity: 0.6;
226
+ white-space: nowrap;
227
+ }
208
228
  }
209
229
 
210
230
  .caret {
@@ -29,7 +29,9 @@ angular.module('niceElements')
29
29
  onChange: '&?',
30
30
  required: '='
31
31
  },
32
- controller: function ($scope, $timeout) {
32
+ controller: function ($scope, $attrs, $timeout, NiceService) {
33
+ NiceService.bindFlag($scope, $attrs, 'mature');
34
+
33
35
  $scope.days = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31];
34
36
  $scope.months = [
35
37
  { value: 0, name: gettextCatalog.getString('Jan', null, 'Nice') },