Skip to content

Commit 20ec837

Browse files
committed
feat:下拉样式
1 parent c727201 commit 20ec837

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

packages/core/src/canvas/canvas.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7054,7 +7054,7 @@ export class Canvas {
70547054
textRect.x + this.store.data.x - (pen.textLeft || 0) + 'px'; //+ 5
70557055
this.inputParent.style.top =
70567056
textRect.y + this.store.data.y - (pen.textTop || 0) + 'px'; //+ 5
7057-
let _width = textRect.width + (pen.textLeft || 0);
7057+
let _width = textRect.width ;//+ (pen.textLeft || 0);
70587058
this.inputParent.style.width = (_width < 0 ? 12 : _width) + 'px'; //(textRect.width < pen.width ? 0 : 10)
70597059
this.inputParent.style.height = textRect.height + (pen.textTop || 0) + 'px'; // (textRect.height < pen.height ? 0 : 10)
70607060
this.inputParent.style.zIndex = '9999';
@@ -7073,6 +7073,8 @@ export class Canvas {
70737073
if (!this.store.data.locked) {
70747074
this.inputRight.style.display = 'none';
70757075
}
7076+
this.dropdown.style.background = pen.dropdownBackground || '#fff';
7077+
this.dropdown.style.color = pen.dropdownColor || '#bdc7db';
70767078
this.setDropdownList();
70777079
} else {
70787080
this.inputRight.style.display = 'none';
@@ -7550,6 +7552,15 @@ export class Canvas {
75507552
li.onmousedown = this.stopPropagation;
75517553
li.dataset.i = index + '';
75527554
li.onclick = this.selectDropdown;
7555+
const pen = this.store.pens[this.inputDiv.dataset.penId];
7556+
li.onmouseenter = () => {
7557+
li.style.background = pen.dropdownHoverBackground || '#eee';
7558+
li.style.color = pen.dropdownHoverColor || '#bdc7db';
7559+
};
7560+
li.onmouseleave = () => {
7561+
li.style.background = pen.dropdownBackground || '#fff';
7562+
li.style.color = pen.dropdownColor || '#bdc7db';
7563+
};
75537564
this.dropdown.appendChild(li);
75547565
}
75557566

packages/core/src/pen/model.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,10 @@ export interface Pen extends Rect {
301301
animateShadowBlur?: number;
302302
input?: boolean;
303303
dropdownList?: Dropdown[];
304-
304+
dropdownBackground?: string;
305+
dropdownColor?: string;
306+
dropdownHoverColor?: string;
307+
dropdownHoverBackground?: string;
305308
events?: Event[];
306309

307310
iframe?: string;

packages/core/src/store/store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export interface DataMock {
111111

112112
export interface Network {
113113
name?: string;
114-
protocol?: 'mqtt' | 'websocket' | 'http';
114+
protocol?: 'mqtt' | 'websocket' | 'http' | 'iot' | 'sql';
115115
type?: string; //subscribe
116116
url?: string;
117117
//websocket

0 commit comments

Comments
 (0)