cedro 0.1.4 → 0.1.5
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 +1 -1
- package/src/core/application.core.ts +19 -1
- package/src/index.ts +9 -8
- package/src/interfaces/application.interface.ts +4 -0
- package/src/interfaces/widget.interface.ts +4 -2
- package/src/ui/Icon.ui.ts +3 -9
- package/src/ui/IconButton.ui.ts +39 -3
- package/src/ui/accordion.ts +71 -0
- package/src/ui/button.ui.ts +18 -1
- package/src/ui/buttonColor.ui.ts +24 -0
- package/src/ui/buttonmenu.ui.ts +59 -0
- package/src/ui/buttonstack.ui.ts +94 -0
- package/src/ui/checkbox.ui.ts +8 -0
- package/src/ui/datagrid.ui.ts +16 -1
- package/src/ui/draggable.ui.ts +22 -0
- package/src/ui/hpanel.ui.ts +127 -0
- package/src/ui/iconButtonMenu.ui.ts +59 -0
- package/src/ui/index.ts +30 -2
- package/src/ui/loading.ui.ts +10 -0
- package/src/ui/menu.ui.ts +41 -47
- package/src/ui/progressbar.ui.ts +74 -0
- package/src/ui/radiobutton.ts +8 -0
- package/src/ui/scroll.ui.ts +1 -2
- package/src/ui/select.ui.ts +3 -0
- package/src/ui/styles/accordion.css +9 -0
- package/src/ui/styles/button.css +0 -3
- package/src/ui/styles/buttoncolor.css +8 -0
- package/src/ui/styles/datagrid.css +28 -2
- package/src/ui/styles/hpanel.css +12 -0
- package/src/ui/styles/loading.css +12 -0
- package/src/ui/styles/loading.svg +49 -0
- package/src/ui/styles/main.css +7 -0
- package/src/ui/styles/menu.css +0 -1
- package/src/ui/styles/progressbar.css +19 -0
- package/src/ui/styles/scroll.css +1 -1
- package/src/ui/styles/stackbutton.css +205 -0
- package/src/ui/styles/tabs.css +45 -0
- package/src/ui/styles/textarea.css +13 -0
- package/src/ui/styles/textbox.css +66 -0
- package/src/ui/styles/toolbar.css +19 -0
- package/src/ui/styles/valuebar.css +26 -0
- package/src/ui/styles/vpanel.css +12 -0
- package/src/ui/styles/vstackbutton.css +202 -0
- package/src/ui/switch.ui.ts +7 -0
- package/src/ui/tabs.ui.ts +79 -28
- package/src/ui/textarea.ui.ts +20 -0
- package/src/ui/textbox.ui.ts +9 -0
- package/src/ui/toggle.ui.ts +49 -0
- package/src/ui/toolbar.ui.ts +35 -7
- package/src/ui/valuebar.ui.ts +116 -0
- package/src/ui/vpanel.ui.ts +128 -0
- package/src/ui/widget.ui.ts +28 -3
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Draggable } from "./draggable.ui";
|
|
2
|
+
import "./styles/hpanel.css";
|
|
3
|
+
import { Widget, WidgetAlignTypes, WidgetTypes } from "./widget.ui";
|
|
4
|
+
|
|
5
|
+
const HPANEL_HANDLER_SIZE = 4;
|
|
6
|
+
|
|
7
|
+
export class HPanel extends Widget {
|
|
8
|
+
leftContent: Widget | null;
|
|
9
|
+
rightContent: Widget | null;
|
|
10
|
+
|
|
11
|
+
leftWidth: number | null;
|
|
12
|
+
rightWidth: number | null;
|
|
13
|
+
|
|
14
|
+
handler: Widget;
|
|
15
|
+
draggable: Draggable;
|
|
16
|
+
|
|
17
|
+
constructor(id: string, parent: Widget | null = null) {
|
|
18
|
+
super(id, "div", parent);
|
|
19
|
+
this.setAlign(WidgetAlignTypes.HORIZONTAL);
|
|
20
|
+
this.setType(WidgetTypes.FILL);
|
|
21
|
+
|
|
22
|
+
this.handler = new Widget(id + ".handler", "div", null);
|
|
23
|
+
this.handler.addClass("WUIHPanelHandler");
|
|
24
|
+
|
|
25
|
+
this.draggable = new Draggable(this.handler, "horizontal");
|
|
26
|
+
this.draggable.setDraggingClass("WUIHPanelDragging");
|
|
27
|
+
this.draggable.setBackgroundCursor("col-resize");
|
|
28
|
+
|
|
29
|
+
this.handler.subscribe({
|
|
30
|
+
event: "drag",
|
|
31
|
+
then: (_e, _w) => {
|
|
32
|
+
this.updateSizeFromHandlerPosition();
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
this.subscribe({
|
|
37
|
+
event: "mousemove",
|
|
38
|
+
then: (e, _w) => {
|
|
39
|
+
this.updateHandlerOpacity(e as MouseEvent);
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
this.leftContent = null;
|
|
44
|
+
this.rightContent = null;
|
|
45
|
+
|
|
46
|
+
this.leftWidth = null;
|
|
47
|
+
this.rightWidth = null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private updateHandlerOpacity(e: MouseEvent): void {
|
|
51
|
+
const handlerX = this.handler.getX();
|
|
52
|
+
const mouseX = e.clientX;
|
|
53
|
+
const umbral = 100; //Distancia donde comienza a aparecer.
|
|
54
|
+
const minDistance = 20; //Distancia a la que toma 100 de opacidad
|
|
55
|
+
const distance = Math.abs(mouseX - handlerX);
|
|
56
|
+
|
|
57
|
+
if (distance < umbral && distance > minDistance) {
|
|
58
|
+
const ratio = 1 - distance / umbral;
|
|
59
|
+
this.handler.getBody().style.opacity = ratio.toString();
|
|
60
|
+
} else if (distance < minDistance) {
|
|
61
|
+
this.handler.getBody().style.opacity = "1";
|
|
62
|
+
} else {
|
|
63
|
+
this.handler.getBody().style.opacity = "0";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public setLeft(content: Widget, fixWidth: number | null = null): void {
|
|
68
|
+
this.leftContent = content;
|
|
69
|
+
this.leftWidth = fixWidth;
|
|
70
|
+
if (fixWidth !== null) {
|
|
71
|
+
this.rightWidth = null;
|
|
72
|
+
this.leftContent.setFixedSize(fixWidth);
|
|
73
|
+
}
|
|
74
|
+
this.addChild(content);
|
|
75
|
+
|
|
76
|
+
const spacer = new Widget("spacer." + Date.now().toString(), "div", null);
|
|
77
|
+
spacer.setType(WidgetTypes.FILL);
|
|
78
|
+
spacer.setFixedSize(HPANEL_HANDLER_SIZE);
|
|
79
|
+
this.addChild(spacer);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
public setRight(content: Widget, fixWidth: number | null = null): void {
|
|
83
|
+
this.rightContent = content;
|
|
84
|
+
this.rightWidth = fixWidth;
|
|
85
|
+
if (fixWidth !== null) {
|
|
86
|
+
this.leftWidth = null;
|
|
87
|
+
this.rightContent.setFixedSize(fixWidth);
|
|
88
|
+
}
|
|
89
|
+
this.addChild(content);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private updateSizeFromHandlerPosition(): void {
|
|
93
|
+
if (this.leftWidth !== null) {
|
|
94
|
+
const leftX = this.leftContent ? this.leftContent.getX(true) : 0;
|
|
95
|
+
this.leftWidth = this.handler.getX() - leftX;
|
|
96
|
+
} else if (this.rightWidth !== null) {
|
|
97
|
+
this.rightWidth = this.getW() - this.handler.getX();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
this.render();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
public render(): void {
|
|
104
|
+
super.render();
|
|
105
|
+
this.handler.setW(HPANEL_HANDLER_SIZE);
|
|
106
|
+
this.handler.setH(this.getH());
|
|
107
|
+
|
|
108
|
+
if (this.leftWidth !== null) {
|
|
109
|
+
const leftX = this.leftContent ? this.leftContent.getX(true) : 0;
|
|
110
|
+
this.handler.setX(leftX + this.leftWidth);
|
|
111
|
+
this.leftContent?.setFixedSize(this.leftWidth);
|
|
112
|
+
} else if (this.rightWidth !== null) {
|
|
113
|
+
const rightX = this.rightContent ? this.rightContent.getX(true) : 0;
|
|
114
|
+
this.handler.setX(rightX + this.rightWidth);
|
|
115
|
+
this.rightContent?.setFixedSize(this.rightWidth);
|
|
116
|
+
} else {
|
|
117
|
+
if (this.leftWidth === null) {
|
|
118
|
+
this.leftWidth = this.getW() / 2 - HPANEL_HANDLER_SIZE / 2;
|
|
119
|
+
}
|
|
120
|
+
const leftX = this.leftContent ? this.leftContent.getX(true) : 0;
|
|
121
|
+
this.handler.setX(leftX + this.leftWidth);
|
|
122
|
+
this.leftContent?.setFixedSize(this.leftWidth);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
this.handler.setY(this.getY(true));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { IconButton } from "./IconButton.ui";
|
|
2
|
+
import { Menu } from "./menu.ui";
|
|
3
|
+
import { SelectItem } from "./select.ui";
|
|
4
|
+
|
|
5
|
+
export class IconButtonMenu extends IconButton {
|
|
6
|
+
menu: Menu;
|
|
7
|
+
items: Array<SelectItem>;
|
|
8
|
+
selectedItem: SelectItem | null;
|
|
9
|
+
|
|
10
|
+
public constructor(id: string, icon: string) {
|
|
11
|
+
super(id, icon);
|
|
12
|
+
|
|
13
|
+
this.menu = new Menu(this.id + ".menu", this.id, null);
|
|
14
|
+
|
|
15
|
+
this.items = new Array<SelectItem>();
|
|
16
|
+
this.selectedItem = null;
|
|
17
|
+
|
|
18
|
+
this.subscribe({
|
|
19
|
+
event: "click",
|
|
20
|
+
then: () => {
|
|
21
|
+
this.menu.clearOptions();
|
|
22
|
+
this.items.forEach((item) => {
|
|
23
|
+
this.menu.addOption(item.id, item.icon, item.label);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
this.menu.wakeUp();
|
|
27
|
+
|
|
28
|
+
if (this.getW() > this.menu.getW()) {
|
|
29
|
+
this.menu.setW(this.getBody().clientWidth);
|
|
30
|
+
console.log("cambiando ancho...");
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
/*this.menu.subscribe({
|
|
36
|
+
event: "option-clicked",
|
|
37
|
+
then: (_e, clickedOption) => {
|
|
38
|
+
const option = clickedOption as IconButton;
|
|
39
|
+
|
|
40
|
+
const fintOption = this.items.find((item) => item.id === option.id);
|
|
41
|
+
|
|
42
|
+
if (fintOption) {
|
|
43
|
+
this.selectedItem = fintOption;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const selectedText = this.selectedItem?.label;
|
|
47
|
+
if (selectedText) {
|
|
48
|
+
this.setText(selectedText);
|
|
49
|
+
} else {
|
|
50
|
+
this.setText("");
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
});*/
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public addItem(id: string, label: string, icon: string): void {
|
|
57
|
+
this.items.push(new SelectItem(id, label, icon));
|
|
58
|
+
}
|
|
59
|
+
}
|
package/src/ui/index.ts
CHANGED
|
@@ -1,29 +1,57 @@
|
|
|
1
|
+
import { Accordion } from "./accordion";
|
|
1
2
|
import { Button } from "./button.ui";
|
|
2
|
-
import {
|
|
3
|
+
import { ButtonColor } from "./buttonColor.ui";
|
|
4
|
+
import { ButtonMenu } from "./buttonmenu.ui";
|
|
5
|
+
import { ButtonStack } from "./buttonstack.ui";
|
|
6
|
+
import { Checkbox } from "./checkbox.ui";
|
|
7
|
+
import { WidgetAlignTypes, WidgetTypes, Widget } from "./widget.ui";
|
|
3
8
|
import { Dialog } from "./dialog";
|
|
9
|
+
import { HPanel } from "./hpanel.ui";
|
|
4
10
|
import { Icon } from "./Icon.ui";
|
|
5
11
|
import { IconButton } from "./IconButton.ui";
|
|
6
12
|
import { Label } from "./label.ui";
|
|
7
13
|
import { Menu } from "./menu.ui";
|
|
14
|
+
import { ProgressBar } from "./progressbar.ui";
|
|
8
15
|
import { Select } from "./select.ui";
|
|
16
|
+
import { Switch } from "./switch.ui";
|
|
9
17
|
import { Textbox } from "./textbox.ui";
|
|
10
18
|
import { Tabs } from "./tabs.ui";
|
|
19
|
+
import { TextArea } from "./textarea.ui";
|
|
11
20
|
import { Toolbar } from "./toolbar.ui";
|
|
12
21
|
import { DataGrid } from "./datagrid.ui";
|
|
22
|
+
import { RadioButton } from "./radiobutton";
|
|
23
|
+
import { ValueBar } from "./valuebar.ui";
|
|
24
|
+
import { VPanel } from "./vpanel.ui";
|
|
13
25
|
import { createWidget } from "./widget.builder.ui";
|
|
26
|
+
import { IconButtonMenu } from "./iconButtonMenu.ui";
|
|
14
27
|
|
|
15
28
|
export {
|
|
29
|
+
Accordion,
|
|
16
30
|
Button,
|
|
17
|
-
|
|
31
|
+
ButtonColor,
|
|
32
|
+
ButtonMenu,
|
|
33
|
+
ButtonStack,
|
|
34
|
+
Checkbox,
|
|
18
35
|
Dialog,
|
|
36
|
+
HPanel,
|
|
19
37
|
Icon,
|
|
20
38
|
IconButton,
|
|
39
|
+
IconButtonMenu,
|
|
21
40
|
Label,
|
|
22
41
|
Menu,
|
|
42
|
+
ProgressBar,
|
|
43
|
+
RadioButton,
|
|
23
44
|
Select,
|
|
45
|
+
Switch,
|
|
24
46
|
Tabs,
|
|
47
|
+
TextArea,
|
|
25
48
|
Textbox,
|
|
26
49
|
Toolbar,
|
|
50
|
+
ValueBar,
|
|
51
|
+
VPanel,
|
|
27
52
|
DataGrid,
|
|
53
|
+
Widget,
|
|
54
|
+
WidgetAlignTypes,
|
|
55
|
+
WidgetTypes,
|
|
28
56
|
createWidget,
|
|
29
57
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "./styles/loading.css";
|
|
2
|
+
import { Widget } from "./widget.ui";
|
|
3
|
+
|
|
4
|
+
export class Loading extends Widget {
|
|
5
|
+
constructor(id: string, parent: Widget | null = null) {
|
|
6
|
+
super(id, "div", parent);
|
|
7
|
+
this.addClass("WUILoading");
|
|
8
|
+
this.setVisible(false);
|
|
9
|
+
}
|
|
10
|
+
}
|
package/src/ui/menu.ui.ts
CHANGED
|
@@ -3,13 +3,16 @@ import { IWidget } from "../interfaces/widget.interface";
|
|
|
3
3
|
import { IconButton } from "./IconButton.ui";
|
|
4
4
|
import { Widget, WidgetAlignTypes, WidgetTypes } from "./widget.ui";
|
|
5
5
|
|
|
6
|
+
const MENU_OPTION_HEIGHT = 40;
|
|
7
|
+
|
|
6
8
|
export class Menu extends Widget {
|
|
7
9
|
background: Widget;
|
|
8
10
|
options: Map<string, IconButton>;
|
|
11
|
+
optionsWidth: Array<number>;
|
|
9
12
|
triggeredById: string | null;
|
|
10
13
|
triggeredBy: IWidget | null;
|
|
11
14
|
triggeredBySearchCode: any;
|
|
12
|
-
|
|
15
|
+
|
|
13
16
|
constructor(id: string, trigeredById: string | null, parent: IWidget | null = null) {
|
|
14
17
|
super(id, "div", parent);
|
|
15
18
|
|
|
@@ -20,16 +23,17 @@ export class Menu extends Widget {
|
|
|
20
23
|
|
|
21
24
|
this.triggeredById = trigeredById;
|
|
22
25
|
this.setType(WidgetTypes.CUSTOM);
|
|
26
|
+
this.setAlign(WidgetAlignTypes.VERTICAL);
|
|
27
|
+
this.setPadding(4);
|
|
23
28
|
|
|
24
29
|
this.triggeredBy = null;
|
|
25
30
|
|
|
26
31
|
this.options = new Map<string, IconButton>();
|
|
32
|
+
this.optionsWidth = new Array<number>();
|
|
27
33
|
|
|
28
34
|
this.addClass("WUIMenu");
|
|
29
35
|
this.addClass("WUIMenuTransparent");
|
|
30
36
|
|
|
31
|
-
this.withCalculation = false;
|
|
32
|
-
|
|
33
37
|
this.triggeredBySearchCode = setInterval(() => {
|
|
34
38
|
if (!this.triggeredById) {
|
|
35
39
|
clearInterval(this.triggeredBySearchCode);
|
|
@@ -64,44 +68,26 @@ export class Menu extends Widget {
|
|
|
64
68
|
this.background.setVisible(false);
|
|
65
69
|
}
|
|
66
70
|
|
|
67
|
-
private setFreeOptionWidth(): void {
|
|
68
|
-
for (const [, dataOption] of this.options) {
|
|
69
|
-
const option = dataOption as IconButton;
|
|
70
|
-
option.deleteClass("WUIMenuOptions100w");
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
71
|
private getMaxWidth(): number {
|
|
75
|
-
this.
|
|
76
|
-
this.deleteClass("WUIMenuHidden");
|
|
77
|
-
this.addClass("WUIMenuTransparent");
|
|
78
|
-
let maxWidth = 0;
|
|
79
|
-
for (const [, dataOption] of this.options) {
|
|
80
|
-
const option = dataOption as IconButton;
|
|
81
|
-
const optionWidth = option.getBody().clientWidth;
|
|
82
|
-
|
|
83
|
-
if (optionWidth > maxWidth) {
|
|
84
|
-
maxWidth = optionWidth;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return maxWidth;
|
|
72
|
+
return Math.max(...this.optionsWidth) * 1.1;
|
|
88
73
|
}
|
|
89
74
|
|
|
90
75
|
wakeUp(): void {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
76
|
+
const maxWidth = this.getMaxWidth();
|
|
77
|
+
let menuWidth = 0;
|
|
78
|
+
if (this.triggeredBy) {
|
|
79
|
+
const triggerWidth = this.triggeredBy.getBody().clientWidth;
|
|
80
|
+
if (triggerWidth > maxWidth) {
|
|
81
|
+
menuWidth = triggerWidth;
|
|
82
|
+
} else {
|
|
83
|
+
menuWidth = maxWidth;
|
|
98
84
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
this.setW(maxWidth);
|
|
102
|
-
this.withCalculation = true;
|
|
85
|
+
} else {
|
|
86
|
+
menuWidth = maxWidth;
|
|
103
87
|
}
|
|
104
88
|
|
|
89
|
+
this.setW(menuWidth);
|
|
90
|
+
|
|
105
91
|
this.background.setVisible(true);
|
|
106
92
|
this.background.raisteTop();
|
|
107
93
|
|
|
@@ -110,6 +96,8 @@ export class Menu extends Widget {
|
|
|
110
96
|
this.deleteClass("WUIMenuHidden");
|
|
111
97
|
this.addClass("WUIMenuVisible");
|
|
112
98
|
|
|
99
|
+
this.render();
|
|
100
|
+
|
|
113
101
|
if (this.triggeredBy) {
|
|
114
102
|
const position = this.triggeredBy.getPosition(false);
|
|
115
103
|
|
|
@@ -118,7 +106,7 @@ export class Menu extends Widget {
|
|
|
118
106
|
|
|
119
107
|
const screenW = window.innerWidth;
|
|
120
108
|
const screenH = window.innerHeight;
|
|
121
|
-
const menuW =
|
|
109
|
+
const menuW = menuWidth;
|
|
122
110
|
const menuH = this.getBody().clientHeight;
|
|
123
111
|
let positionX = position.x;
|
|
124
112
|
let positionY = position.y;
|
|
@@ -126,8 +114,8 @@ export class Menu extends Widget {
|
|
|
126
114
|
let openRight = true;
|
|
127
115
|
let openBottom = true;
|
|
128
116
|
|
|
129
|
-
if (position.x + menuW
|
|
130
|
-
positionX = screenW - menuW
|
|
117
|
+
if (position.x + menuW > screenW) {
|
|
118
|
+
positionX = screenW - menuW;
|
|
131
119
|
openRight = false;
|
|
132
120
|
}
|
|
133
121
|
|
|
@@ -140,18 +128,16 @@ export class Menu extends Widget {
|
|
|
140
128
|
this.setX(positionX);
|
|
141
129
|
this.setY(positionY + triggerH);
|
|
142
130
|
} else if (openRight && !openBottom) {
|
|
143
|
-
this.setX(positionX
|
|
131
|
+
this.setX(positionX);
|
|
144
132
|
this.setY(positionY);
|
|
145
133
|
} else if (!openRight && openBottom) {
|
|
146
134
|
/*abajo izq: Works!*/
|
|
147
|
-
this.setX(positionX
|
|
135
|
+
this.setX(positionX);
|
|
148
136
|
this.setY(positionY + triggerH);
|
|
149
137
|
} else if (!openRight && !openBottom) {
|
|
150
|
-
this.setX(positionX
|
|
138
|
+
this.setX(positionX);
|
|
151
139
|
this.setY(positionY - triggerH);
|
|
152
140
|
}
|
|
153
|
-
|
|
154
|
-
//this.setY(positionY);
|
|
155
141
|
}
|
|
156
142
|
}
|
|
157
143
|
|
|
@@ -165,17 +151,19 @@ export class Menu extends Widget {
|
|
|
165
151
|
}
|
|
166
152
|
|
|
167
153
|
public clearOptions(): void {
|
|
154
|
+
this.optionsWidth = new Array<number>();
|
|
168
155
|
this.options.clear();
|
|
169
156
|
this.removeAllChilds();
|
|
170
|
-
this.withCalculation = false;
|
|
171
157
|
}
|
|
172
158
|
|
|
173
159
|
addOption(id: string, icon: string, label: string) {
|
|
174
|
-
const newOption = new IconButton(id, icon,
|
|
175
|
-
newOption.setType(WidgetTypes.
|
|
176
|
-
newOption.setAlign(WidgetAlignTypes.
|
|
160
|
+
const newOption = new IconButton(id, icon, null);
|
|
161
|
+
newOption.setType(WidgetTypes.FILL);
|
|
162
|
+
newOption.setAlign(WidgetAlignTypes.VERTICAL);
|
|
177
163
|
newOption.setText(label);
|
|
178
|
-
newOption.
|
|
164
|
+
newOption.setFixedSize(MENU_OPTION_HEIGHT);
|
|
165
|
+
//newOption.addClass("WUIMenuOptions");
|
|
166
|
+
//newOption.setH(MENU_OPTION_HEIGHT);
|
|
179
167
|
|
|
180
168
|
newOption.subscribe({
|
|
181
169
|
event: "click",
|
|
@@ -187,5 +175,11 @@ export class Menu extends Widget {
|
|
|
187
175
|
});
|
|
188
176
|
|
|
189
177
|
this.options.set(id, newOption);
|
|
178
|
+
|
|
179
|
+
const width = newOption.getBody().clientWidth;
|
|
180
|
+
this.optionsWidth.push(width);
|
|
181
|
+
const height = this.options.size * MENU_OPTION_HEIGHT;
|
|
182
|
+
this.addChild(newOption);
|
|
183
|
+
this.setH(height);
|
|
190
184
|
}
|
|
191
185
|
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Label } from "./label.ui";
|
|
2
|
+
import "./styles/progressbar.css";
|
|
3
|
+
import { Widget } from "./widget.ui";
|
|
4
|
+
|
|
5
|
+
const PROGRESS_BAR_HEIGHT = 40;
|
|
6
|
+
|
|
7
|
+
//icono para el progress bar interactivo humidity_high
|
|
8
|
+
|
|
9
|
+
export class ProgressBar extends Widget {
|
|
10
|
+
private value: number;
|
|
11
|
+
private paddingBar: number;
|
|
12
|
+
|
|
13
|
+
private bar: Widget;
|
|
14
|
+
private lblValue: Label;
|
|
15
|
+
|
|
16
|
+
public constructor(id: string, parent: Widget | null = null) {
|
|
17
|
+
super(id, "div", parent);
|
|
18
|
+
|
|
19
|
+
this.setH(PROGRESS_BAR_HEIGHT);
|
|
20
|
+
|
|
21
|
+
this.paddingBar = 0;
|
|
22
|
+
|
|
23
|
+
this.bar = new Widget(id + ".bar", "div", this);
|
|
24
|
+
this.bar.addClass("WUIProgressBarBar");
|
|
25
|
+
|
|
26
|
+
this.value = 0;
|
|
27
|
+
this.addClass("WUIProgressBarContainer");
|
|
28
|
+
|
|
29
|
+
this.lblValue = new Label(id + ".value", "span", this);
|
|
30
|
+
this.lblValue.setText(this.value + "%");
|
|
31
|
+
|
|
32
|
+
this.lblValue.addClass("WUIProgressBarLabel");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public setPaddingBar(p: number): void {
|
|
36
|
+
this.paddingBar = p;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public hideLabel(): void {
|
|
40
|
+
this.lblValue.setVisible(false);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public displayLabel(): void {
|
|
44
|
+
this.lblValue.setVisible(true);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public render(): void {
|
|
48
|
+
super.render();
|
|
49
|
+
|
|
50
|
+
const padding = this.paddingBar;
|
|
51
|
+
const width = this.getW() - padding;
|
|
52
|
+
const height = this.getH();
|
|
53
|
+
const widthBar = width * (this.value / 100);
|
|
54
|
+
|
|
55
|
+
this.lblValue.setX(width / 2 - this.lblValue.getW() / 2);
|
|
56
|
+
this.lblValue.setY(height / 2 - this.lblValue.getH() / 2);
|
|
57
|
+
this.lblValue.raisteTop();
|
|
58
|
+
|
|
59
|
+
this.bar.setX(padding);
|
|
60
|
+
this.bar.setY(padding);
|
|
61
|
+
this.bar.setW(widthBar);
|
|
62
|
+
this.bar.setH(height - padding * 2);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public setValue(value: number): void {
|
|
66
|
+
this.value = value;
|
|
67
|
+
this.lblValue.setText(this.value + "%");
|
|
68
|
+
this.render();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public getValue(): number {
|
|
72
|
+
return this.value;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ToggleButton } from "./toggle.ui";
|
|
2
|
+
import { Widget } from "./widget.ui";
|
|
3
|
+
|
|
4
|
+
export class RadioButton extends ToggleButton {
|
|
5
|
+
constructor(id: string, text: string = "", parent: Widget | null = null) {
|
|
6
|
+
super(id, text, "radio_button_unchecked", "radio_button_checked", parent);
|
|
7
|
+
}
|
|
8
|
+
}
|
package/src/ui/scroll.ui.ts
CHANGED
|
@@ -22,7 +22,6 @@ type ScrollData = {
|
|
|
22
22
|
export class Scroll extends Widget {
|
|
23
23
|
contentArea: Widget;
|
|
24
24
|
orientation: OrientationTypes;
|
|
25
|
-
|
|
26
25
|
drag: Draggable;
|
|
27
26
|
|
|
28
27
|
constructor(id: string, contentArea: Widget, orientation: OrientationTypes = "vertical") {
|
|
@@ -134,7 +133,7 @@ export class Scroll extends Widget {
|
|
|
134
133
|
return;
|
|
135
134
|
}
|
|
136
135
|
|
|
137
|
-
this.setX(this.contentArea.getW() - SCROLL_SIZE - 1);
|
|
136
|
+
this.setX(this.contentArea.getX() + this.contentArea.getW() - SCROLL_SIZE - 1);
|
|
138
137
|
this.setY(1 + this.contentArea.getY() + scrollData.position);
|
|
139
138
|
this.setH(scrollData.scrollBarHeight);
|
|
140
139
|
this.setW(SCROLL_SIZE);
|
package/src/ui/select.ui.ts
CHANGED
|
@@ -37,8 +37,11 @@ export class Select extends Textbox {
|
|
|
37
37
|
|
|
38
38
|
this.menu.wakeUp();
|
|
39
39
|
|
|
40
|
+
console.log(this.getBody().clientWidth, this.menu.getBody().clientWidth);
|
|
41
|
+
|
|
40
42
|
if (this.getBody().clientWidth > this.menu.getBody().clientWidth) {
|
|
41
43
|
this.menu.setW(this.getBody().clientWidth);
|
|
44
|
+
this.menu.resize();
|
|
42
45
|
}
|
|
43
46
|
},
|
|
44
47
|
});
|
package/src/ui/styles/button.css
CHANGED
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
border-radius: 0.25rem;
|
|
13
13
|
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,
|
|
14
14
|
border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
|
|
15
|
-
text-transform: uppercase;
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
.WUIButton-text-color-primary {
|
|
@@ -89,7 +88,6 @@
|
|
|
89
88
|
border-radius: 0.25rem;
|
|
90
89
|
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,
|
|
91
90
|
border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
|
|
92
|
-
text-transform: uppercase;
|
|
93
91
|
}
|
|
94
92
|
|
|
95
93
|
.WUIButton-outlined-color-primary {
|
|
@@ -173,7 +171,6 @@
|
|
|
173
171
|
border-radius: 0.25rem;
|
|
174
172
|
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,
|
|
175
173
|
border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
|
|
176
|
-
text-transform: uppercase;
|
|
177
174
|
}
|
|
178
175
|
|
|
179
176
|
.WUIButton-contained-color-primary {
|
|
@@ -1,10 +1,36 @@
|
|
|
1
|
+
.WUIDataGrid {
|
|
2
|
+
background-color: transparent;
|
|
3
|
+
border-left: solid 0.13rem;
|
|
4
|
+
border-top: solid 0.13rem;
|
|
5
|
+
border-bottom: solid 0.13rem;
|
|
6
|
+
border-right: solid 0.13rem;
|
|
7
|
+
border-radius: 0.25rem;
|
|
8
|
+
border-color: var(--palette-divider);
|
|
9
|
+
}
|
|
10
|
+
|
|
1
11
|
.WUIDataGrid-Header {
|
|
2
|
-
border-bottom: solid 1px var(--palette-
|
|
12
|
+
border-bottom: solid 1px var(--palette-divider);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.WUIDataGrid-HeaderLabel:hover {
|
|
16
|
+
border-bottom: solid 1px var(--palette-divider);
|
|
17
|
+
background-color: var(--palette-action-hover) !important;
|
|
18
|
+
cursor: default;
|
|
3
19
|
}
|
|
4
20
|
|
|
5
21
|
.WUIDataGrid-HeaderLabel {
|
|
6
|
-
border-right: solid 1px var(--palette-
|
|
22
|
+
border-right: solid 1px var(--palette-divider);
|
|
7
23
|
/*border-bottom: solid 1px var(--palette-primary-text-light);*/
|
|
8
24
|
padding-left: 5px;
|
|
9
25
|
font-weight: bold;
|
|
10
26
|
}
|
|
27
|
+
|
|
28
|
+
.WUIDataGrid-Row {
|
|
29
|
+
border-bottom: solid 1px var(--palette-divider);
|
|
30
|
+
background-color: transparent;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.WUIDataGrid-Row:hover {
|
|
34
|
+
border-bottom: solid 1px var(--palette-divider);
|
|
35
|
+
background-color: var(--palette-action-hover) !important;
|
|
36
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
.WUILoading {
|
|
2
|
+
background-color: var(--palette-background-default);
|
|
3
|
+
background-image: url("loading.svg");
|
|
4
|
+
background-position: center;
|
|
5
|
+
background-repeat: no-repeat;
|
|
6
|
+
position: absolute !important;
|
|
7
|
+
left: 0px;
|
|
8
|
+
top: 0px;
|
|
9
|
+
right: 0px;
|
|
10
|
+
bottom: 0px;
|
|
11
|
+
opacity: 0.8;
|
|
12
|
+
}
|