-
-
-
-
-
-
-
-
+
diff --git a/ui-ngx/src/app/shared/components/color-picker/color-picker.component.scss b/ui-ngx/src/app/shared/components/color-picker/color-picker.component.scss
index ddd870c7d0..6d3978550a 100644
--- a/ui-ngx/src/app/shared/components/color-picker/color-picker.component.scss
+++ b/ui-ngx/src/app/shared/components/color-picker/color-picker.component.scss
@@ -17,75 +17,87 @@
width: 100%;
display: flex;
flex-direction: column;
+ gap: 16px;
- ::ng-deep {
- .saturation-component {
- height: 100%;
- min-height: 200px;
- max-height: 300px;
+ .saturation-component {
+ height: 100%;
+ min-height: 200px;
+ max-height: 300px;
+ border-radius: 8px;
+ }
+
+ .control-component {
+ max-height: 48px;
+ display: flex;
+ gap: 16px;
+
+ .indicator-component {
+ height: 48px;
+ width: 48px;
border-radius: 8px;
- margin-bottom: 16px;
- div.pointer {
- border-width: 2px;
- width: 16px;
- height: 16px;
- }
- }
-
- indicator-component {
- svg {
- vertical-align: -70% !important;
- }
+ background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMUAFg9Gm0AAAAPSURBVAjXY2D4jxXhEgYAfr8P8QhChVEAAAAASUVORK5CYII=') repeat;
}
.hue-alpha-range {
- alpha-component, hue-component {
+ display: flex;
+ justify-content: space-between;
+ flex-direction: column;
+ flex: 1;
+
+ > * {
height: 18px;
+ border-radius: 9px;
border: 1px solid rgba(0, 0, 0, 0.1);
- .pointer {
- height: 18px;
- width: 18px;
- background: none;
- border: 2px solid #fff;
- }
- .gradient-color {
- border-radius: 24px;
- }
+ }
+ }
+ }
+
+ .color-input-block {
+ display: flex;
+
+ .color-input {
+ flex: 1;
+ }
+
+ .type-btn {
+ height: 26px;
+ width: 20px;
+ background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAgCAMAAAAootjDAAAAM1BMVEUAAAAzMzMzMzMzMzMzMzM0NDQzMzMzMzM0NDQzMzMzMzM0NDQzMzMzMzMyMjIrKyszMzPF8UZlAAAAEHRSTlMA1fHr4ZxxSRP45sG+sCkGH2+Z6QAAAHJJREFUKM+9kkkSgCAQA0FEVLb5/2tViqgQvNrHviSzKGCt6nDGuNass8i8NsrLiX+bZbrUtDwm7VLYE0zWUtEZ+RvUZpEvN8YhH9QmQRoC8kFpEnVHVP/DJUZVeSAem5fDKxwtms/BR+PT8gN8vwk/0wE1gQzNVYryIwAAAABJRU5ErkJggg==') no-repeat center;
+ background-size: 6px 12px;
+
+ &:hover {
+ background-color: #eee;
}
}
}
}
-.control-component {
- max-height: 48px;
- margin-bottom: 16px;
-}
+:host ::ng-deep {
+ .saturation-component {
+ .pointer {
+ border-width: 2px;
+ width: 16px;
+ height: 16px;
+ }
+ }
-indicator-component {
- height: 48px;
- width: 48px;
- border-radius: 8px;
- background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMUAFg9Gm0AAAAPSURBVAjXY2D4jxXhEgYAfr8P8QhChVEAAAAASUVORK5CYII=') repeat;
-}
+ indicator-component {
+ svg {
+ vertical-align: -70% !important;
+ }
+ }
-.hue-alpha-range {
- hue-component, alpha-component {
- border-radius: 24px;
- }
-}
-
-color-presets-component {
- border-top: 1px solid #d0d0d0;
-}
-
-.type-btn {
- display: inline-block;
- height: 20px;
- width: 20px;
- background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAgCAMAAAAootjDAAAAM1BMVEUAAAAzMzMzMzMzMzMzMzM0NDQzMzMzMzM0NDQzMzMzMzM0NDQzMzMzMzMyMjIrKyszMzPF8UZlAAAAEHRSTlMA1fHr4ZxxSRP45sG+sCkGH2+Z6QAAAHJJREFUKM+9kkkSgCAQA0FEVLb5/2tViqgQvNrHviSzKGCt6nDGuNass8i8NsrLiX+bZbrUtDwm7VLYE0zWUtEZ+RvUZpEvN8YhH9QmQRoC8kFpEnVHVP/DJUZVeSAem5fDKxwtms/BR+PT8gN8vwk/0wE1gQzNVYryIwAAAABJRU5ErkJggg==') no-repeat center;
- background-size: 6px 12px;
-
- &:hover {
- background-color: #eee;
+ .hue-alpha-range {
+ alpha-component, hue-component {
+ .pointer {
+ height: 18px;
+ width: 18px;
+ background: none;
+ border: 2px solid #fff;
+ }
+ .gradient-color {
+ border-radius: 9px;
+ }
+ }
}
}
diff --git a/ui-ngx/src/app/shared/components/color-picker/color-picker.component.ts b/ui-ngx/src/app/shared/components/color-picker/color-picker.component.ts
index dd7afee70a..ce49310b03 100644
--- a/ui-ngx/src/app/shared/components/color-picker/color-picker.component.ts
+++ b/ui-ngx/src/app/shared/components/color-picker/color-picker.component.ts
@@ -14,7 +14,7 @@
/// limitations under the License.
///
-import { Component, forwardRef, OnDestroy, OnInit } from '@angular/core';
+import { Component, forwardRef, OnDestroy } from '@angular/core';
import { Color, ColorPickerControl } from '@iplab/ngx-color-picker';
import { Subscription } from 'rxjs';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
@@ -41,7 +41,7 @@ export enum ColorType {
}
]
})
-export class ColorPickerComponent implements OnInit, ControlValueAccessor, OnDestroy {
+export class ColorPickerComponent implements ControlValueAccessor, OnDestroy {
selectedPresentation = 0;
presentations = [ColorType.hex, ColorType.rgba, ColorType.hsla];
@@ -51,16 +51,17 @@ export class ColorPickerComponent implements OnInit, ControlValueAccessor, OnDes
private subscriptions: Array
= [];
- private propagateChange = null;
+ private propagateChange = (v: any) => {};
+
+ private setValue = false;
constructor() {
- }
-
- public ngOnInit(): void {
this.subscriptions.push(
- this.control.valueChanges.subscribe(value => {
- if (this.modelValue) {
+ this.control.valueChanges.subscribe(() => {
+ if (!this.setValue) {
this.updateModel();
+ } else {
+ this.setValue = false;
}
})
);
@@ -74,7 +75,8 @@ export class ColorPickerComponent implements OnInit, ControlValueAccessor, OnDes
}
writeValue(value: string): void {
- this.control. setValueFrom(value || '#fff');
+ this.setValue = !!value;
+ this.control.setValueFrom(value || '#fff');
this.modelValue = value;
if (this.control.initType === ColorType.hexa) {
diff --git a/ui-ngx/src/app/shared/components/dialog/color-picker-dialog.component.html b/ui-ngx/src/app/shared/components/dialog/color-picker-dialog.component.html
index de733b2a20..eaec4c0b5e 100644
--- a/ui-ngx/src/app/shared/components/dialog/color-picker-dialog.component.html
+++ b/ui-ngx/src/app/shared/components/dialog/color-picker-dialog.component.html
@@ -15,8 +15,8 @@
limitations under the License.
-->
-