-
icon.icons
-
- search
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ 'icon.no-icons-found' | translate:{iconSearch: searchIconControl.value} }}
-
-
-
diff --git a/ui-ngx/src/app/shared/components/material-icons.component.ts b/ui-ngx/src/app/shared/components/material-icons.component.ts
index ece1a99108..d144fd45e6 100644
--- a/ui-ngx/src/app/shared/components/material-icons.component.ts
+++ b/ui-ngx/src/app/shared/components/material-icons.component.ts
@@ -37,6 +37,7 @@ import { TbPopoverComponent } from '@shared/components/popover.component';
import { BreakpointObserver } from '@angular/cdk/layout';
import { MediaBreakpoints } from '@shared/models/constants';
import { coerceBoolean } from '@shared/decorators/coercion';
+import { isTbImage } from '@shared/models/resource.models';
@Component({
selector: 'tb-material-icons',
@@ -61,6 +62,10 @@ export class MaterialIconsComponent extends PageComponent implements OnInit {
@coerceBoolean()
showTitle = true;
+ @Input()
+ @coerceBoolean()
+ allowedCustomIcon = false;
+
@Input()
popover: TbPopoverComponent;
@@ -71,6 +76,8 @@ export class MaterialIconsComponent extends PageComponent implements OnInit {
showAllSubject = new BehaviorSubject
(false);
searchIconControl: UntypedFormControl;
+ isCustomIcon = false;
+
iconsRowHeight = 48;
iconsPanelHeight: string;
@@ -122,14 +129,15 @@ export class MaterialIconsComponent extends PageComponent implements OnInit {
map((data) => data.iconRows),
share()
);
+ this.isCustomIcon = isTbImage(this.selectedIcon)
}
clearSearch() {
this.searchIconControl.patchValue('', {emitEvent: true});
}
- selectIcon(icon: MaterialIcon) {
- this.iconSelected.emit(icon.name);
+ selectIcon(icon: string) {
+ this.iconSelected.emit(icon);
}
clearIcon() {
diff --git a/ui-ngx/src/app/shared/models/resource.models.ts b/ui-ngx/src/app/shared/models/resource.models.ts
index 0419e40a7c..c1e692e04f 100644
--- a/ui-ngx/src/app/shared/models/resource.models.ts
+++ b/ui-ngx/src/app/shared/models/resource.models.ts
@@ -188,6 +188,7 @@ export const isImageResourceUrl = (url: string): boolean => url && IMAGES_URL_RE
export const isJSResourceUrl = (url: string): boolean => url && RESOURCES_URL_REGEXP.test(url);
export const isJSResource = (url: string): boolean => url?.startsWith(TB_RESOURCE_PREFIX);
+export const isTbImage = (url: string): boolean => url?.startsWith(TB_IMAGE_PREFIX);
export const extractParamsFromImageResourceUrl = (url: string): {type: ImageResourceType; key: string} => {
const res = url.match(IMAGES_URL_REGEXP);
diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json
index 838ab4fd96..9ee555a838 100644
--- a/ui-ngx/src/assets/locale/locale.constant-en_US.json
+++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json
@@ -9553,6 +9553,7 @@
"icon": {
"icon": "Icon",
"icons": "Icons",
+ "custom": "Custom",
"select-icon": "Select icon",
"material-icons": "Material icons",
"show-all": "Show all icons",
diff --git a/ui-ngx/src/scss/mixins.scss b/ui-ngx/src/scss/mixins.scss
index 8e60483cb1..fb4a51ebce 100644
--- a/ui-ngx/src/scss/mixins.scss
+++ b/ui-ngx/src/scss/mixins.scss
@@ -26,6 +26,10 @@
width: #{$size}px;
height: #{$size}px;
}
+ img {
+ width: #{$size}px;
+ height: #{$size}px;
+ }
}
@mixin tb-mat-icon-button-size($size) {
diff --git a/ui-ngx/src/styles.scss b/ui-ngx/src/styles.scss
index a8cf53534e..6d49e9f698 100644
--- a/ui-ngx/src/styles.scss
+++ b/ui-ngx/src/styles.scss
@@ -896,7 +896,7 @@ pre.tb-highlight {
}
.mat-icon {
- svg {
+ svg, img {
vertical-align: inherit;
}
&.tb-mat-12 {