nice-elements 1.13.0 → 1.13.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/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/bower.json +1 -1
- package/dist/nice.js +27 -6
- package/dist/nice.min.js +1 -1
- package/dist/style.css +2 -2
- package/dist/style.css.map +1 -1
- package/dist/style.min.css +2 -2
- package/package.json +1 -1
- package/src/components/nice-choice/nice-choice.js +1 -0
- package/src/components/nice-dropdown/nice-dropdown.js +1 -2
- package/src/components/nice-upload/nice-upload.html +3 -1
- package/src/components/nice-upload/nice-upload.scss +1 -1
- package/src/filters/nice-highlight.js +21 -2
- package/src/services/nice-service.js +1 -1
- package/src/styles/_nice-common.scss +1 -1
package/package.json
CHANGED
|
@@ -33,7 +33,7 @@ angular.module('niceElements')
|
|
|
33
33
|
objValue: '@', // Optional - default is 'value'
|
|
34
34
|
objKey: '@?', // Optional - default is 'id'. Used only when returnOnlyKey=true.
|
|
35
35
|
selectedIsKey: '@?',
|
|
36
|
-
nullable: '
|
|
36
|
+
nullable: '=', // No selection is possible
|
|
37
37
|
required: '=', // Model cannot be NULL
|
|
38
38
|
noMargin: '@', // margin-bottom: 0px
|
|
39
39
|
multiple: '@', // Can select multiple items
|
|
@@ -66,7 +66,6 @@ angular.module('niceElements')
|
|
|
66
66
|
if (!$scope.selectedText) { $scope.selectedText = gettextCatalog.getString("selected", null, "Nice"); }
|
|
67
67
|
if (!$scope.addButtonFunction) { $scope.addButtonFunction = null; }
|
|
68
68
|
if (!$scope.placement) { $scope.placement = "bottom-start"; }
|
|
69
|
-
$scope.nullable = $scope.nullable === 'true' || $scope.nullable === true;
|
|
70
69
|
$scope.noMargin = $scope.noMargin === 'true' || $scope.noMargin === true;
|
|
71
70
|
$scope.multiple = $scope.multiple === 'true' || $scope.multiple === true;
|
|
72
71
|
$scope.clearOnSelect = $scope.clearOnSelect === 'true' || $scope.clearOnSelect === true;
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
<div class="text text-placeholder" ng-if="dragging" translate translate-group="Nice">Drop file here</div>
|
|
14
14
|
<div class="error" ng-if="error">{{ error }}</div>
|
|
15
15
|
</div>
|
|
16
|
-
<
|
|
16
|
+
<div ng-if="imageSource" ng-transclude>
|
|
17
|
+
<img data-ng-src="{{ imageSource }}" />
|
|
18
|
+
</div>
|
|
17
19
|
</div>
|
|
18
20
|
<input class="input-file" type="file" accept="{{ accept }}" ng-model="file" ng-required="required" ng-disabled="isDisabled || loading" />
|
|
19
21
|
<nice-loader fulldiv="true" ng-if="loading"></nice-loader>
|
|
@@ -8,9 +8,28 @@
|
|
|
8
8
|
*/
|
|
9
9
|
angular.module('niceElements').filter('niceHighlight', function () {
|
|
10
10
|
return function (value, highlightedText) {
|
|
11
|
-
if (!value) return "";
|
|
11
|
+
if (!value || !highlightedText) return "";
|
|
12
12
|
const regex = new RegExp(highlightedText, 'gmi');
|
|
13
|
-
const newValue = String(value).replace(regex, "<span class='nice-
|
|
13
|
+
const newValue = String(value).replace(regex, "<span class='nice-highlight'>$&</span>");
|
|
14
14
|
return newValue;
|
|
15
15
|
};
|
|
16
16
|
});
|
|
17
|
+
|
|
18
|
+
angular.module('niceElements')
|
|
19
|
+
.filter('h', function ($sce, $sanitize) {
|
|
20
|
+
return function (text, phrase) {
|
|
21
|
+
if (!phrase || !text) return text;
|
|
22
|
+
|
|
23
|
+
// 1. Sanitize the original text to prevent XSS
|
|
24
|
+
let cleanText = $sanitize(text);
|
|
25
|
+
|
|
26
|
+
// 2. Create the case-insensitive global Regex
|
|
27
|
+
const regex = new RegExp('(' + phrase + ')', 'gi');
|
|
28
|
+
|
|
29
|
+
// 3. Replace matches with the h element
|
|
30
|
+
const highlighted = cleanText.replace(regex, '<h>$1</h>');
|
|
31
|
+
|
|
32
|
+
// 4. Trust the result so ng-bind-html renders it
|
|
33
|
+
return $sce.trustAsHtml(highlighted);
|
|
34
|
+
};
|
|
35
|
+
});
|