nice-elements 1.9.15 → 1.10.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nice-elements",
3
- "version": "1.9.15",
3
+ "version": "1.10.0",
4
4
  "description": "Nice elements used in olaii angular 1.x webapps.",
5
5
  "main": "dist/nice.js",
6
6
  "license": "MIT",
@@ -35,6 +35,6 @@
35
35
  "grunt-contrib-uglify": "5.0.1",
36
36
  "grunt-sass": "3.1.0",
37
37
  "load-grunt-tasks": "5.1.0",
38
- "node-sass": "7.0.1"
38
+ "node-sass": "9.0.0"
39
39
  }
40
40
  }
@@ -6,7 +6,7 @@
6
6
  * # niceButton
7
7
  */
8
8
  angular.module('niceElements')
9
- .directive('niceButton', function ($q) {
9
+ .directive('niceButton', function () {
10
10
  return {
11
11
  templateUrl: 'src/components/nice-button/nice-button.html',
12
12
  restrict: 'E',
@@ -0,0 +1,4 @@
1
+ <div class="nice-no-data" ng-class="{ 'nice-no-data-fulldiv': fulldiv }">
2
+ <nice-icon class="nice-no-data-icon" icon="{{ icon }}" ng-if="icon"></nice-icon>
3
+ <div class="nice-no-data-message" ng-transclude>{{ message }}</div>
4
+ </div>
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @ngdoc directive
5
+ * @name niceElements.directive:niceNoData
6
+ * @description
7
+ * # niceNoData
8
+ */
9
+ angular.module('niceElements')
10
+ .directive('niceNoData', function () {
11
+ return {
12
+ templateUrl: 'src/components/nice-no-data/nice-no-data.html',
13
+ restrict: 'E',
14
+ transclude: true,
15
+ replace: true,
16
+ scope: {
17
+ icon: '@?',
18
+ message: '@',
19
+ fulldiv: '@'
20
+ },
21
+ controller: function ($scope, gettextCatalog) {
22
+ // if (!$scope.icon) $scope.icon = "icon-square";
23
+ if (!$scope.message) $scope.message = gettextCatalog.getString("No data");
24
+ }
25
+ };
26
+ });
@@ -0,0 +1,27 @@
1
+ .nice-no-data {
2
+ display: flex;
3
+ flex-direction: column;
4
+ align-items: center;
5
+ justify-content: center;
6
+ padding: 1rem;
7
+ gap: 0.3rem;
8
+ color: var(--nice-font-color);
9
+ opacity: 0.6;
10
+
11
+ &.nice-no-data-fulldiv {
12
+ position: absolute;
13
+ top: 0;
14
+ left: 0;
15
+ width: 100%;
16
+ height: 100%;
17
+ }
18
+
19
+ .nice-no-data-icon {
20
+ height: 24px;
21
+ width: 24px;
22
+ }
23
+
24
+ .nice-no-data-message {
25
+ font-style: italic;
26
+ }
27
+ }
@@ -113,8 +113,6 @@ angular.module('niceElements')
113
113
  $scope.niceNumberForm.$setValidity("zero", null);
114
114
  }
115
115
  }
116
-
117
- if ($scope.onChange) $scope.onChange({ model: $scope.model });
118
116
  };
119
117
 
120
118
 
@@ -131,8 +129,13 @@ angular.module('niceElements')
131
129
 
132
130
 
133
131
  // Watch for model change
134
- $scope.$watch("model", function () {
132
+ $scope.$watch("model", function (oldModel, newModel) {
135
133
  $scope.check();
134
+ if ($scope.onChange && oldModel != newModel) {
135
+ $timeout(function() {
136
+ $scope.onChange({ model: $scope.model });
137
+ })
138
+ }
136
139
  });
137
140
 
138
141
 
@@ -0,0 +1,28 @@
1
+ <div class="nice-table-wrapper">
2
+ <table class="nice-table">
3
+ <thead>
4
+ <tr>
5
+ <th ng-repeat="column in columns" ng-class="[column.class, handleFreeze($first, $last)]">{{ column.title }}</th>
6
+ <th class="w-0 text-right" ng-if="hasActions">
7
+ <span>{{ data.length }}</span>
8
+ <span ng-if="data._resultmeta"> / {{ data._resultmeta.count }}</span>
9
+ </th>
10
+ </tr>
11
+ </thead>
12
+
13
+ <tbody>
14
+ <tr ng-repeat="row in data">
15
+ <td ng-repeat="column in columns" ng-class="[column.class, handleFreeze($first, $last)]">
16
+ <span ng-style="rowStyle(column, row)" ng-class="rowClass(column, row)" ng-if="column.formatter">{{ column.formatter(row[column.key], row) }}</span>
17
+ <span ng-style="rowStyle(column, row)" ng-class="rowClass(column, row)" ng-if="!column.formatter">{{ row[column.key] }}</span>
18
+ </td>
19
+
20
+ <td class="w-0" ng-if="hasActions">
21
+ <div class="nice-table-actions" ng-transclude></div>
22
+ </td>
23
+ </tr>
24
+ </tbody>
25
+ </table>
26
+
27
+ <nice-no-data ng-if="!data || data.length == 0"></nice-no-data>
28
+ </div>
@@ -0,0 +1,40 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @ngdoc directive
5
+ * @name niceElements.directive:niceTable
6
+ * @description
7
+ * # niceTable
8
+ */
9
+ angular.module('niceElements')
10
+ .directive('niceTable', function () {
11
+ return {
12
+ templateUrl: 'src/components/nice-table/nice-table.html',
13
+ restrict: 'E',
14
+ transclude: true,
15
+ replace: true,
16
+ scope: {
17
+ data: '=',
18
+ columns: '=',
19
+ freezeFirst: '@',
20
+ freezeLast: '@',
21
+ },
22
+ controller: function ($scope, $transclude) {
23
+ $scope.hasActions = $transclude().length > 0;
24
+
25
+ $scope.rowStyle = function(column, row) {
26
+ if (!column.valueStyle) return;
27
+ return column.valueStyle(row[column.key], row);
28
+ }
29
+
30
+ $scope.rowClass = function(column, row) {
31
+ if (!column.valueClass) return;
32
+ return column.valueClass(row[column.key], row);
33
+ }
34
+
35
+ $scope.handleFreeze = function(isFirst, isLast) {
36
+ return { 'nice-table-freeze-first': $scope.freezeFirst && isFirst, 'nice-table-freeze-last': $scope.freezeLast && isLast }
37
+ }
38
+ }
39
+ };
40
+ });
@@ -0,0 +1,62 @@
1
+ .nice-table-wrapper {
2
+ min-height: .01%;
3
+ overflow-x: auto;
4
+
5
+ .nice-table {
6
+ width: 100%;
7
+ max-width: 100%;
8
+ border-collapse: collapse;
9
+ border-spacing: 0;
10
+ background: var(--nice-card-bg);
11
+
12
+ .nice-table-freeze-first {
13
+ position: sticky;
14
+ left: 0;
15
+ background: var(--nice-card-bg);
16
+ }
17
+
18
+ .nice-table-freeze-last {
19
+ position: sticky;
20
+ right: 0;
21
+ background: var(--nice-card-bg);
22
+ }
23
+
24
+ .nice-table-actions {
25
+ display: flex;
26
+ gap: 0.5rem;
27
+ }
28
+
29
+ thead {
30
+ border-bottom: 1px solid var(--nice-border-color);
31
+
32
+ tr {
33
+ th {
34
+ padding: 8px;
35
+ vertical-align: bottom;
36
+ text-transform: uppercase;
37
+ font-size: 12px;
38
+ color: var(--nice-primary-color);
39
+ }
40
+ }
41
+ }
42
+
43
+ tbody {
44
+ tr {
45
+ &:hover {
46
+ background-color: var(--nice-hover-color);
47
+
48
+ .nice-table-freeze-first,
49
+ .nice-table-freeze-last {
50
+ background-color: var(--nice-hover-color);
51
+ }
52
+ }
53
+
54
+ td {
55
+ padding: 8px;
56
+ vertical-align: middle;
57
+ border-top: 1px solid var(--nice-border-color);
58
+ }
59
+ }
60
+ }
61
+ }
62
+ }
@@ -1,4 +1,4 @@
1
- <div class="nice-component nice-toggle" ng-class="{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }" ng-form="formToggle">
1
+ <div class="nice-component nice-toggle" ng-class="{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline, 'active': model }" ng-form="formToggle">
2
2
  <div class="row">
3
3
  <!------------------------- Title ------------------------->
4
4
  <nice-title text="title" help="help" required="required" label-width="labelWidth"></nice-title>
@@ -6,7 +6,7 @@
6
6
  <!------------------------- Field ------------------------->
7
7
  <div class="nice-field col-xs-12" ng-class="[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]">
8
8
  <button type="button" class="nice-toggle-field" ng-click="switch()" ng-disabled="isDisabled">
9
- <div class="nice-toggle-field-handle" ng-class="{ 'active': model }">{{ state }}</div>
9
+ <div class="nice-toggle-field-handle">{{ state }}</div>
10
10
  </button>
11
11
  </div>
12
12
  </div>
@@ -42,12 +42,13 @@
42
42
  position: relative;
43
43
  width: 50px;
44
44
  height: 25px;
45
+ transition: background-color 0.3s ease-in-out;
45
46
 
46
- // &:hover {
47
- // .nice-toggle-field-handle {
48
- // background: var(--nice-primary-color-darker);
49
- // }
50
- // }
47
+ &:hover {
48
+ .nice-toggle-field-handle {
49
+ background: var(--nice-border-color-darker);
50
+ }
51
+ }
51
52
 
52
53
  .nice-toggle-field-handle {
53
54
  position: absolute;
@@ -57,10 +58,16 @@
57
58
  height: 19px;
58
59
  background: var(--nice-border-color);
59
60
  border-radius: 50%;
60
- transition: left 0.3s ease-in-out;
61
+ transition: all 0.3s ease-in-out;
62
+ }
63
+ }
64
+
65
+ &.active {
66
+ .nice-toggle-field {
67
+ background: var(--nice-primary-color);
61
68
 
62
- &.active {
63
- background: var(--nice-primary-color);
69
+ .nice-toggle-field-handle {
70
+ background: var(--nice-input-bg);
64
71
  left: calc(100% - 22px);
65
72
  }
66
73
  }
@@ -10,7 +10,7 @@ angular.module('niceElements')
10
10
  .service('NiceService', function () {
11
11
  var service = {
12
12
  name: "Nice elements",
13
- version: "1.9.15",
13
+ version: "1.10.0",
14
14
  getHeader: function () {
15
15
  return {};
16
16
  }
@@ -63,4 +63,6 @@
63
63
  @import "../components/nice-wrapper/nice-wrapper";
64
64
  @import "../components/nice-pill/nice-pill";
65
65
  @import "../components/nice-toggle/nice-toggle";
66
+ @import "../components/nice-no-data/nice-no-data";
67
+ @import "../components/nice-table/nice-table";
66
68
  @import "../modals/nice-multilangual-modal/nice-multilangual-modal";
@@ -178,6 +178,7 @@ $nice-table-bg-active: #f5f5f5 !default;
178
178
 
179
179
  // ---------- Border ----------
180
180
  --nice-border-color: #{$nice-border-color};
181
+ --nice-border-color-darker: #{darken($nice-border-color, 10%)};
181
182
  --nice-border-radius: #{$nice-border-radius};
182
183
  --nice-border-radius-small: #{$nice-border-radius-small};
183
184
 
@@ -193,4 +194,5 @@ $nice-table-bg-active: #f5f5f5 !default;
193
194
 
194
195
  // ---------- Input ----------
195
196
  --nice-input-bg: #{$nice-input-bg};
197
+ --nice-input-bg-hover: #f7f7f7;
196
198
  }