cedro 0.1.9 → 0.1.10
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/README.md +7 -4
- package/dist/cedro-logo.png +0 -0
- package/dist/fangio.jpg +0 -0
- package/package.json +4 -2
- package/src/core/application.builder.tsx +121 -60
- package/src/core/application.core.tsx +110 -11
- package/src/core/themes.core.ts +160 -1
- package/src/core/uid.ts +3 -3
- package/src/interfaces/application.interface.ts +3 -2
- package/src/interfaces/widget.interface.ts +3 -0
- package/src/types/select.item.type.ts +11 -0
- package/src/ui/Icon.ui.tsx +158 -0
- package/src/ui/IconButton.ui.tsx +51 -9
- package/src/ui/{textbox.ui.tsx → Textbox.ui.tsx} +23 -15
- package/src/ui/accordion.ui.tsx +152 -0
- package/src/ui/button.ui.tsx +56 -14
- package/src/ui/buttonColor.ui.tsx +87 -0
- package/src/ui/buttonmenu.ui.tsx +134 -0
- package/src/ui/{buttonstack.ui.ts → buttonstack.ui.tsx} +67 -1
- package/src/ui/checkbox.ui.tsx +9 -13
- package/src/ui/container.ui.tsx +141 -76
- package/src/ui/datagrid.ui.tsx +518 -0
- package/src/ui/dialog.tsx +143 -56
- package/src/ui/hpanel.ui.tsx +37 -11
- package/src/ui/iconButtonMenu.ui.tsx +176 -0
- package/src/ui/image.ui.tsx +123 -112
- package/src/ui/index.ts +8 -8
- package/src/ui/label.ui.tsx +61 -3
- package/src/ui/loading.ui.ts +10 -10
- package/src/ui/menu.ui.ts +2 -2
- package/src/ui/progressbar.ui.tsx +9 -8
- package/src/ui/{radiobutton.tsx → radiobutton.ui.tsx} +9 -13
- package/src/ui/scroll.ui.ts +13 -12
- package/src/ui/select.ui.tsx +143 -0
- package/src/ui/styles/button.css +114 -32
- package/src/ui/styles/buttoncolor.css +8 -8
- package/src/ui/styles/container.css +29 -0
- package/src/ui/styles/icon.css +29 -0
- package/src/ui/styles/image.css +19 -19
- package/src/ui/styles/label.css +63 -0
- package/src/ui/styles/loading.css +12 -12
- package/src/ui/styles/main.css +5 -0
- package/src/ui/styles/progressbar.css +2 -1
- package/src/ui/styles/select.css +13 -0
- package/src/ui/styles/stackbutton.css +36 -0
- package/src/ui/styles/tabs.css +5 -7
- package/src/ui/styles/textarea.css +13 -13
- package/src/ui/switch.ui.tsx +9 -13
- package/src/ui/tabs.ui.tsx +43 -22
- package/src/ui/textarea.ui.tsx +48 -0
- package/src/ui/toolbar.ui.tsx +17 -12
- package/src/ui/valuebar.ui.tsx +11 -13
- package/src/ui/vpanel.ui.tsx +19 -13
- package/src/ui/widget.builder.ts +243 -159
- package/src/ui/widget.collection.ts +24 -2
- package/src/ui/widget.ui.ts +79 -19
- package/src/ui/Icon.ui.ts +0 -64
- package/src/ui/accordion.ui.ts +0 -71
- package/src/ui/buttonColor.ui.ts +0 -24
- package/src/ui/buttonmenu.ui.ts +0 -59
- package/src/ui/datagrid.ui.ts +0 -231
- package/src/ui/iconButtonMenu.ui.ts +0 -59
- package/src/ui/select.ui.ts +0 -73
- package/src/ui/textarea.ui.ts +0 -20
- /package/src/ui/{toggle.ui.ts → toggle.ui.tsx} +0 -0
package/src/ui/image.ui.tsx
CHANGED
|
@@ -1,112 +1,123 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
this.
|
|
15
|
-
|
|
16
|
-
this.image
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.imageContainer.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
this.image.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
this.image.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
1
|
+
import { UID } from "../core/uid";
|
|
2
|
+
import "./styles/image.css";
|
|
3
|
+
import { normalizeWidget, WidgetProps } from "./widget.builder";
|
|
4
|
+
import { Widget, WidgetTypes, connectWidgetCallback, getOnlyEventProps } from "./widget.ui";
|
|
5
|
+
import { decode } from "html-entities";
|
|
6
|
+
|
|
7
|
+
export class Image extends Widget {
|
|
8
|
+
imageContainer: Widget;
|
|
9
|
+
image: Widget;
|
|
10
|
+
constructor(id: string, src: string = "", parent: Widget | null = null) {
|
|
11
|
+
super(id, "div", parent);
|
|
12
|
+
|
|
13
|
+
this.imageContainer = new Widget(id + ".imageContainer", "div", this);
|
|
14
|
+
this.imageContainer.addClass("WUIImageContainer");
|
|
15
|
+
|
|
16
|
+
this.image = new Widget(id + ".image", "img", this.imageContainer);
|
|
17
|
+
this.image.setType(WidgetTypes.CUSTOM);
|
|
18
|
+
this.image.getBody().setAttribute("src", src);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public render(): void {
|
|
22
|
+
super.render();
|
|
23
|
+
|
|
24
|
+
this.imageContainer.setX(0);
|
|
25
|
+
this.imageContainer.setY(0);
|
|
26
|
+
this.imageContainer.setWH(this.getW(), this.getH());
|
|
27
|
+
|
|
28
|
+
this.image.getBody().style.position = "relative";
|
|
29
|
+
|
|
30
|
+
const imageH = this.image.getH();
|
|
31
|
+
|
|
32
|
+
this.image.setX(0);
|
|
33
|
+
this.image.setY(this.getH() / 2 - imageH / 2);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public fillWidth(): void {
|
|
37
|
+
this.image.addClass("WUIImageFillWidth");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public fillHeight(): void {
|
|
41
|
+
this.image.addClass("WUIImageFillHeight");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public setAlternateText(text: string): void {
|
|
45
|
+
this.image.getBody().setAttribute("alt", text);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public setImageUrl(url: string): void {
|
|
49
|
+
this.image.getBody().setAttribute("src", url);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public getImageUrl(): string | null {
|
|
53
|
+
return this.image.getBody().getAttribute("src");
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public getAlternateText(): string | null {
|
|
57
|
+
return this.image.getBody().getAttribute("alt");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type wImageProps = WidgetProps & {
|
|
62
|
+
src: string;
|
|
63
|
+
alt?: string | null;
|
|
64
|
+
fillWidth?: boolean | null;
|
|
65
|
+
fillHeight?: boolean | null;
|
|
66
|
+
width?: number | null;
|
|
67
|
+
height?: number | null;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const WImage = (props: wImageProps) => {
|
|
71
|
+
if (!props.id) {
|
|
72
|
+
props.id = "Image." + UID();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
connectWidgetCallback(props.id, getOnlyEventProps(props));
|
|
76
|
+
|
|
77
|
+
return normalizeWidget(
|
|
78
|
+
<div
|
|
79
|
+
id={props.id}
|
|
80
|
+
w-image
|
|
81
|
+
w-src={props.src}
|
|
82
|
+
w-alt={props.alt}
|
|
83
|
+
w-fill-width={props.fillWidth}
|
|
84
|
+
w-fill-height={props.fillHeight}
|
|
85
|
+
w-width={props.width}
|
|
86
|
+
w-height={props.height}
|
|
87
|
+
></div>,
|
|
88
|
+
props
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export function createImage(id: string, content: any, parent: Widget | null = null): Image {
|
|
93
|
+
const dataSrc = content.getAttribute("w-src");
|
|
94
|
+
const dataAlt = content.getAttribute("w-alt");
|
|
95
|
+
const dataFillWidth = content.getAttribute("w-fill-width");
|
|
96
|
+
const dataFillHeight = content.getAttribute("w-fill-height");
|
|
97
|
+
const dataWidth = content.getAttribute("w-width");
|
|
98
|
+
const dataHeight = content.getAttribute("w-height");
|
|
99
|
+
|
|
100
|
+
let newImage = new Image(id, decode(dataSrc), parent);
|
|
101
|
+
|
|
102
|
+
if (dataAlt) {
|
|
103
|
+
newImage.setAlternateText(dataAlt);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (dataFillWidth) {
|
|
107
|
+
newImage.fillWidth();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (dataFillHeight) {
|
|
111
|
+
newImage.fillHeight();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (dataWidth) {
|
|
115
|
+
newImage.setInitialW(dataWidth);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (dataHeight) {
|
|
119
|
+
newImage.setInitialH(dataHeight);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return newImage;
|
|
123
|
+
}
|
package/src/ui/index.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
+
import { WidgetAlignTypes, WidgetTypes, Widget } from "./widget.ui";
|
|
2
|
+
import { Textbox } from "./Textbox.ui";
|
|
3
|
+
import { Select } from "./select.ui";
|
|
1
4
|
import { Accordion } from "./accordion.ui";
|
|
2
5
|
import { Button } from "./button.ui";
|
|
3
6
|
import { ButtonColor } from "./buttonColor.ui";
|
|
4
7
|
import { ButtonMenu } from "./buttonmenu.ui";
|
|
5
8
|
import { ButtonStack } from "./buttonstack.ui";
|
|
9
|
+
import { IconButton } from "./IconButton.ui";
|
|
6
10
|
import { Checkbox } from "./checkbox.ui";
|
|
7
11
|
import { Container, Spacer, ContainerParams } from "./container.ui";
|
|
8
|
-
import { WidgetAlignTypes, WidgetTypes, Widget } from "./widget.ui";
|
|
9
12
|
import { Dialog } from "./dialog";
|
|
10
13
|
import { HPanel } from "./hpanel.ui";
|
|
11
14
|
import { Icon } from "./Icon.ui";
|
|
12
|
-
import { IconButton } from "./IconButton.ui";
|
|
13
15
|
import { Image } from "./image.ui";
|
|
14
16
|
import { Label } from "./label.ui";
|
|
15
17
|
import { Menu } from "./menu.ui";
|
|
16
18
|
import { ProgressBar } from "./progressbar.ui";
|
|
17
|
-
import { Select } from "./select.ui";
|
|
18
19
|
import { Switch } from "./switch.ui";
|
|
19
|
-
import { Textbox } from "./textbox.ui";
|
|
20
20
|
import { Tabs } from "./tabs.ui";
|
|
21
21
|
import { TextArea } from "./textarea.ui";
|
|
22
22
|
import { Toolbar } from "./toolbar.ui";
|
|
23
23
|
import { DataGrid } from "./datagrid.ui";
|
|
24
|
-
import { RadioButton } from "./radiobutton";
|
|
24
|
+
import { RadioButton } from "./radiobutton.ui";
|
|
25
25
|
import { ValueBar } from "./valuebar.ui";
|
|
26
26
|
import { VPanel } from "./vpanel.ui";
|
|
27
27
|
import { createWidget } from "./widget.builder";
|
|
@@ -30,18 +30,19 @@ import { IconButtonMenu } from "./iconButtonMenu.ui";
|
|
|
30
30
|
export type { ContainerParams };
|
|
31
31
|
|
|
32
32
|
export {
|
|
33
|
+
Textbox,
|
|
33
34
|
Accordion,
|
|
34
35
|
Button,
|
|
35
36
|
ButtonColor,
|
|
36
37
|
ButtonMenu,
|
|
37
38
|
ButtonStack,
|
|
39
|
+
IconButton,
|
|
40
|
+
IconButtonMenu,
|
|
38
41
|
Checkbox,
|
|
39
42
|
Container,
|
|
40
43
|
Dialog,
|
|
41
44
|
HPanel,
|
|
42
45
|
Icon,
|
|
43
|
-
IconButton,
|
|
44
|
-
IconButtonMenu,
|
|
45
46
|
Image,
|
|
46
47
|
Label,
|
|
47
48
|
Menu,
|
|
@@ -52,7 +53,6 @@ export {
|
|
|
52
53
|
Switch,
|
|
53
54
|
Tabs,
|
|
54
55
|
TextArea,
|
|
55
|
-
Textbox,
|
|
56
56
|
Toolbar,
|
|
57
57
|
ValueBar,
|
|
58
58
|
VPanel,
|
package/src/ui/label.ui.tsx
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./styles/label.css";
|
|
2
|
+
import { normalizeWidget, WidgetProps } from "./widget.builder";
|
|
2
3
|
import { Colors } from "./colors.ui";
|
|
3
4
|
import { Widget, connectWidgetCallback, getOnlyEventProps } from "./widget.ui";
|
|
5
|
+
import { UID } from "../core/uid";
|
|
4
6
|
|
|
5
7
|
export type LabelVariants = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span";
|
|
6
8
|
|
|
@@ -9,12 +11,16 @@ export class Label extends Widget {
|
|
|
9
11
|
color: Colors;
|
|
10
12
|
text: string;
|
|
11
13
|
|
|
14
|
+
requiredWidth: number;
|
|
15
|
+
|
|
12
16
|
isHCentered: boolean;
|
|
13
17
|
isVCentered: boolean;
|
|
14
18
|
|
|
15
19
|
constructor(id: string, variant: LabelVariants = "span", parent: Widget | null = null) {
|
|
16
20
|
super(id, variant, parent);
|
|
17
21
|
|
|
22
|
+
this.requiredWidth = -1;
|
|
23
|
+
|
|
18
24
|
this.isHCentered = false;
|
|
19
25
|
this.isVCentered = false;
|
|
20
26
|
|
|
@@ -22,6 +28,12 @@ export class Label extends Widget {
|
|
|
22
28
|
this.color = "primary";
|
|
23
29
|
this.text = "";
|
|
24
30
|
|
|
31
|
+
this.setColor(this.color);
|
|
32
|
+
|
|
33
|
+
//this.getBody().style.margin = "0px";
|
|
34
|
+
|
|
35
|
+
this.setVariant(this.variant);
|
|
36
|
+
|
|
25
37
|
this.init();
|
|
26
38
|
}
|
|
27
39
|
|
|
@@ -29,6 +41,19 @@ export class Label extends Widget {
|
|
|
29
41
|
super.init();
|
|
30
42
|
}
|
|
31
43
|
|
|
44
|
+
private updateRequiredWidth(): void {
|
|
45
|
+
const div = document.createElement("div");
|
|
46
|
+
div.id = this.id + ".requiredWidth";
|
|
47
|
+
div.innerHTML = this.text;
|
|
48
|
+
div.classList.add("WUILabel" + this.variant);
|
|
49
|
+
div.classList.add("WUILabel-" + this.color);
|
|
50
|
+
div.style.position = "absolute";
|
|
51
|
+
div.style.overflow = "hidden";
|
|
52
|
+
document.body.appendChild(div);
|
|
53
|
+
this.requiredWidth = div.clientWidth;
|
|
54
|
+
div.parentNode?.removeChild(div);
|
|
55
|
+
}
|
|
56
|
+
|
|
32
57
|
public setHCentered(isHCentered: boolean = true): void {
|
|
33
58
|
this.isHCentered = isHCentered;
|
|
34
59
|
}
|
|
@@ -59,14 +84,26 @@ export class Label extends Widget {
|
|
|
59
84
|
public setText(text: string): void {
|
|
60
85
|
this.text = text;
|
|
61
86
|
this.body.innerHTML = text;
|
|
87
|
+
this.updateRequiredWidth();
|
|
62
88
|
}
|
|
63
89
|
|
|
64
90
|
public setVariant(variant: LabelVariants = "span"): void {
|
|
91
|
+
if (this.variant !== variant) {
|
|
92
|
+
this.deleteClass("WUILabel" + this.variant);
|
|
93
|
+
}
|
|
94
|
+
|
|
65
95
|
this.variant = variant;
|
|
96
|
+
this.addClass("WUILabel-" + this.variant);
|
|
97
|
+
this.updateRequiredWidth();
|
|
66
98
|
}
|
|
67
99
|
|
|
68
100
|
public setColor(color: Colors = "primary"): void {
|
|
101
|
+
if (this.color !== color) {
|
|
102
|
+
this.deleteClass("WUILabel-" + this.color);
|
|
103
|
+
}
|
|
69
104
|
this.color = color;
|
|
105
|
+
this.addClass("WUILabel-" + this.color);
|
|
106
|
+
this.updateRequiredWidth();
|
|
70
107
|
}
|
|
71
108
|
|
|
72
109
|
public getVariant(): LabelVariants {
|
|
@@ -80,25 +117,38 @@ export class Label extends Widget {
|
|
|
80
117
|
public getText(): string {
|
|
81
118
|
return this.text;
|
|
82
119
|
}
|
|
120
|
+
|
|
121
|
+
public getRequiredWidth(): number {
|
|
122
|
+
return this.requiredWidth;
|
|
123
|
+
}
|
|
83
124
|
}
|
|
84
125
|
|
|
85
126
|
export type wLabelProps = WidgetProps & {
|
|
86
127
|
variant?: string | null;
|
|
87
128
|
color?: Colors | null;
|
|
88
129
|
text?: string | null;
|
|
130
|
+
centerX?: boolean | null;
|
|
131
|
+
centerY?: boolean | null;
|
|
89
132
|
};
|
|
90
133
|
|
|
91
134
|
export const WLabel = (props: wLabelProps) => {
|
|
135
|
+
if (!props.id) {
|
|
136
|
+
props.id = "Label." + UID();
|
|
137
|
+
}
|
|
138
|
+
|
|
92
139
|
connectWidgetCallback(props.id, getOnlyEventProps(props));
|
|
93
140
|
|
|
94
|
-
return (
|
|
141
|
+
return normalizeWidget(
|
|
95
142
|
<div
|
|
96
143
|
id={props.id}
|
|
97
144
|
w-label
|
|
98
145
|
w-text={props.text}
|
|
99
146
|
w-variant={props.variant}
|
|
100
147
|
w-color={props.color}
|
|
101
|
-
|
|
148
|
+
w-centerX={props.centerX}
|
|
149
|
+
w-centerY={props.centerY}
|
|
150
|
+
></div>,
|
|
151
|
+
props
|
|
102
152
|
);
|
|
103
153
|
};
|
|
104
154
|
|
|
@@ -122,5 +172,13 @@ export function createLabel(id: string, content: any, parent: Widget | null = nu
|
|
|
122
172
|
newLabel.setColor(dataColor);
|
|
123
173
|
}
|
|
124
174
|
|
|
175
|
+
if (content.getAttribute("w-centerX")) {
|
|
176
|
+
newLabel.setHCentered(true);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (content.getAttribute("w-centerY")) {
|
|
180
|
+
newLabel.setVCentered(true);
|
|
181
|
+
}
|
|
182
|
+
|
|
125
183
|
return newLabel;
|
|
126
184
|
}
|
package/src/ui/loading.ui.ts
CHANGED
|
@@ -1,10 +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
|
-
}
|
|
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
|
@@ -101,7 +101,7 @@ export class Menu extends Widget {
|
|
|
101
101
|
if (this.triggeredBy) {
|
|
102
102
|
const position = this.triggeredBy.getPosition(false);
|
|
103
103
|
|
|
104
|
-
const triggerW = this.triggeredBy.getBody().clientWidth;
|
|
104
|
+
//const triggerW = this.triggeredBy.getBody().clientWidth;
|
|
105
105
|
const triggerH = this.triggeredBy.getBody().clientHeight;
|
|
106
106
|
|
|
107
107
|
const screenW = window.innerWidth;
|
|
@@ -162,7 +162,7 @@ export class Menu extends Widget {
|
|
|
162
162
|
newOption.setAlign(WidgetAlignTypes.VERTICAL);
|
|
163
163
|
newOption.setText(label);
|
|
164
164
|
newOption.setFixedSize(MENU_OPTION_HEIGHT);
|
|
165
|
-
|
|
165
|
+
newOption.addClass("WUIMenuOptions"); //Esta linea estaba comentada. Con esto se soliciono el ancho del menu
|
|
166
166
|
//newOption.setH(MENU_OPTION_HEIGHT);
|
|
167
167
|
|
|
168
168
|
newOption.subscribe({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { UID } from "../core/uid";
|
|
1
2
|
import { Label } from "./label.ui";
|
|
2
3
|
import "./styles/progressbar.css";
|
|
3
|
-
import { WidgetProps } from "./widget.builder";
|
|
4
|
+
import { normalizeWidget, WidgetProps } from "./widget.builder";
|
|
4
5
|
import { Widget, WidgetTypes, connectWidgetCallback, getOnlyEventProps } from "./widget.ui";
|
|
5
6
|
|
|
6
7
|
const PROGRESS_BAR_HEIGHT = 40;
|
|
@@ -87,21 +88,21 @@ export type wProgressBarProps = WidgetProps & {
|
|
|
87
88
|
};
|
|
88
89
|
|
|
89
90
|
export const WProgressBar = (props: wProgressBarProps) => {
|
|
91
|
+
if (!props.id) {
|
|
92
|
+
props.id = "ProgressBar." + UID();
|
|
93
|
+
}
|
|
94
|
+
|
|
90
95
|
connectWidgetCallback(props.id, getOnlyEventProps(props));
|
|
91
96
|
|
|
92
|
-
return (
|
|
97
|
+
return normalizeWidget(
|
|
93
98
|
<div
|
|
94
99
|
id={props.id}
|
|
95
100
|
w-progressbar
|
|
96
101
|
w-value={props.value}
|
|
97
102
|
w-padding-bar={props.paddingBar}
|
|
98
103
|
w-hide-label={props.hideLabel}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
w-fixed-size={props.fixedSize}
|
|
102
|
-
w-padding={props.padding}
|
|
103
|
-
w-type={props.type}
|
|
104
|
-
></div>
|
|
104
|
+
></div>,
|
|
105
|
+
props
|
|
105
106
|
);
|
|
106
107
|
};
|
|
107
108
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { UID } from "../core/uid";
|
|
1
2
|
import { ToggleButton } from "./toggle.ui";
|
|
2
|
-
import { WidgetProps } from "./widget.builder";
|
|
3
|
+
import { normalizeWidget, WidgetProps } from "./widget.builder";
|
|
3
4
|
import { Widget, connectWidgetCallback, getOnlyEventProps } from "./widget.ui";
|
|
4
5
|
|
|
5
6
|
export class RadioButton extends ToggleButton {
|
|
@@ -14,20 +15,15 @@ export type wRadioButtonProps = WidgetProps & {
|
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
export const WRadioButton = (props: wRadioButtonProps) => {
|
|
18
|
+
if (!props.id) {
|
|
19
|
+
props.id = "RadioButton." + UID();
|
|
20
|
+
}
|
|
21
|
+
|
|
17
22
|
connectWidgetCallback(props.id, getOnlyEventProps(props));
|
|
18
23
|
|
|
19
|
-
return (
|
|
20
|
-
<div
|
|
21
|
-
|
|
22
|
-
w-radiobutton
|
|
23
|
-
w-text={props.text}
|
|
24
|
-
w-checked={props.checked}
|
|
25
|
-
w-class={props.classNames}
|
|
26
|
-
w-orientation={props.orientation}
|
|
27
|
-
w-fixed-size={props.fixedSize}
|
|
28
|
-
w-padding={props.padding}
|
|
29
|
-
w-type={props.type}
|
|
30
|
-
/>
|
|
24
|
+
return normalizeWidget(
|
|
25
|
+
<div id={props.id} w-radiobutton w-text={props.text} w-checked={props.checked} />,
|
|
26
|
+
props
|
|
31
27
|
);
|
|
32
28
|
};
|
|
33
29
|
|
package/src/ui/scroll.ui.ts
CHANGED
|
@@ -25,7 +25,7 @@ export class Scroll extends Widget {
|
|
|
25
25
|
drag: Draggable;
|
|
26
26
|
|
|
27
27
|
constructor(id: string, contentArea: Widget, orientation: OrientationTypes = "vertical") {
|
|
28
|
-
super(id, "div"
|
|
28
|
+
super(id, "div");
|
|
29
29
|
|
|
30
30
|
this.contentArea = contentArea;
|
|
31
31
|
this.orientation = orientation;
|
|
@@ -33,7 +33,7 @@ export class Scroll extends Widget {
|
|
|
33
33
|
this.setType(WidgetTypes.CUSTOM);
|
|
34
34
|
|
|
35
35
|
this.getBody().style.overflow = "hidden";
|
|
36
|
-
this.getBody().style.position = "
|
|
36
|
+
this.getBody().style.position = "fixed";
|
|
37
37
|
|
|
38
38
|
this.addClass("WUIScrollbar");
|
|
39
39
|
|
|
@@ -110,14 +110,15 @@ export class Scroll extends Widget {
|
|
|
110
110
|
if (this.orientation === "vertical") {
|
|
111
111
|
const recorrido = scrollData.scrollHeight - scrollData.areaHeight;
|
|
112
112
|
const maxY = this.drag.maxY ? this.drag.maxY : 1;
|
|
113
|
-
const ratio = (this.getY() - this.contentArea.getY()) / maxY;
|
|
113
|
+
const ratio = (this.getY() - this.contentArea.getY(true)) / maxY;
|
|
114
114
|
this.contentArea.getBody().scrollTop = recorrido * ratio;
|
|
115
115
|
} else if (this.orientation === "horizontal") {
|
|
116
116
|
const recorrido = scrollData.scrollWidth - scrollData.areaWidth;
|
|
117
117
|
const maxX = this.drag.maxX ? this.drag.maxX : 1;
|
|
118
|
-
const ratio = (this.getX() - this.contentArea.getX()) / maxX;
|
|
118
|
+
const ratio = (this.getX() - this.contentArea.getX(true)) / maxX;
|
|
119
119
|
this.contentArea.getBody().scrollLeft = recorrido * ratio;
|
|
120
120
|
}
|
|
121
|
+
this.run("scroll");
|
|
121
122
|
}
|
|
122
123
|
|
|
123
124
|
public render(): void {
|
|
@@ -133,14 +134,14 @@ export class Scroll extends Widget {
|
|
|
133
134
|
return;
|
|
134
135
|
}
|
|
135
136
|
|
|
136
|
-
this.setX(this.contentArea.getX() + this.contentArea.getW() - SCROLL_SIZE - 1);
|
|
137
|
-
this.setY(1 + this.contentArea.getY() + scrollData.position);
|
|
137
|
+
this.setX(this.contentArea.getX(true) + this.contentArea.getW() - SCROLL_SIZE - 1);
|
|
138
|
+
this.setY(1 + this.contentArea.getY(true) + scrollData.position);
|
|
138
139
|
this.setH(scrollData.scrollBarHeight);
|
|
139
140
|
this.setW(SCROLL_SIZE);
|
|
140
141
|
this.raisteTop();
|
|
141
142
|
|
|
142
|
-
const minY = 1 + this.contentArea.getY();
|
|
143
|
-
const maxY = this.contentArea.getY() + scrollData.availablePositionSize;
|
|
143
|
+
const minY = 1 + this.contentArea.getY(true);
|
|
144
|
+
const maxY = this.contentArea.getY(true) + scrollData.availablePositionSize;
|
|
144
145
|
|
|
145
146
|
this.drag.setMinY(minY);
|
|
146
147
|
this.drag.setMaxY(maxY);
|
|
@@ -160,14 +161,14 @@ export class Scroll extends Widget {
|
|
|
160
161
|
return;
|
|
161
162
|
}
|
|
162
163
|
|
|
163
|
-
this.setX(1 + this.contentArea.getX() + scrollData.position);
|
|
164
|
-
this.setY(scrollData.scrollPositionY - SCROLL_SIZE - 1);
|
|
164
|
+
this.setX(1 + this.contentArea.getX(true) + scrollData.position);
|
|
165
|
+
this.setY(this.contentArea.getY(true) + scrollData.scrollPositionY - SCROLL_SIZE - 1);
|
|
165
166
|
this.setW(scrollData.scrollBarWidth);
|
|
166
167
|
this.setH(SCROLL_SIZE);
|
|
167
168
|
this.raisteTop();
|
|
168
169
|
|
|
169
|
-
const minX = 1 + this.contentArea.getX();
|
|
170
|
-
const maxX = this.contentArea.getX() + scrollData.availablePositionSize;
|
|
170
|
+
const minX = 1 + this.contentArea.getX(true);
|
|
171
|
+
const maxX = this.contentArea.getX(true) + scrollData.availablePositionSize;
|
|
171
172
|
|
|
172
173
|
this.drag.setMinX(minX);
|
|
173
174
|
this.drag.setMaxX(maxX);
|