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/container.ui.tsx
CHANGED
|
@@ -1,76 +1,141 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
1
|
+
import "./styles/container.css";
|
|
2
|
+
import { OrientationTypes } from "../types/orientation.type";
|
|
3
|
+
import {
|
|
4
|
+
connectWidgetCallback,
|
|
5
|
+
getOnlyEventProps,
|
|
6
|
+
Widget,
|
|
7
|
+
WidgetAlignTypes,
|
|
8
|
+
WidgetTypes,
|
|
9
|
+
} from "./widget.ui";
|
|
10
|
+
import { UID } from "../core/uid";
|
|
11
|
+
import { WidgetProps, createWidget, normalizeWidget } from "./widget.builder";
|
|
12
|
+
import { Scroll } from "./scroll.ui";
|
|
13
|
+
|
|
14
|
+
export type ContainerVariants = "plain" | "contained" | "outlined";
|
|
15
|
+
|
|
16
|
+
export type ContainerParams = {
|
|
17
|
+
orientation?: OrientationTypes;
|
|
18
|
+
parent?: Widget | null;
|
|
19
|
+
size?: number | null;
|
|
20
|
+
padding?: number | null;
|
|
21
|
+
variant?: ContainerVariants | null;
|
|
22
|
+
id?: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export class Container extends Widget {
|
|
26
|
+
variant: ContainerVariants = "plain";
|
|
27
|
+
verticalScrollbar: Scroll | null;
|
|
28
|
+
constructor(params: ContainerParams) {
|
|
29
|
+
const {
|
|
30
|
+
id = "",
|
|
31
|
+
orientation = "horizontal",
|
|
32
|
+
parent = null,
|
|
33
|
+
size = null,
|
|
34
|
+
padding = null,
|
|
35
|
+
variant = null,
|
|
36
|
+
} = params;
|
|
37
|
+
|
|
38
|
+
super(id.length > 0 ? id : UID(), "div", parent);
|
|
39
|
+
|
|
40
|
+
this.verticalScrollbar = null;
|
|
41
|
+
|
|
42
|
+
if (orientation === "horizontal") {
|
|
43
|
+
this.setAlign(WidgetAlignTypes.HORIZONTAL);
|
|
44
|
+
} else {
|
|
45
|
+
this.setAlign(WidgetAlignTypes.VERTICAL);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (size !== null) {
|
|
49
|
+
this.setFixedSize(size);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (padding !== null) {
|
|
53
|
+
this.setPadding(padding);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (variant !== null) {
|
|
57
|
+
this.setVariant(variant);
|
|
58
|
+
} else {
|
|
59
|
+
this.setVariant("plain");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
this.setType(WidgetTypes.FILL);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public setVerticalScrollbar() {
|
|
66
|
+
this.verticalScrollbar = new Scroll(this.id + ".VerticalScrollbar", this);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public setVariant(variant: ContainerVariants) {
|
|
70
|
+
if (this.variant !== variant) {
|
|
71
|
+
this.deleteClass("WUIPanel-" + this.variant);
|
|
72
|
+
}
|
|
73
|
+
this.variant = variant;
|
|
74
|
+
this.addClass("WUIPanel-" + variant);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public free(): void {
|
|
78
|
+
super.free();
|
|
79
|
+
if (this.verticalScrollbar) this.verticalScrollbar.free();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function Spacer(): Container {
|
|
84
|
+
return new Container({});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export type ContainerProps = WidgetProps & {
|
|
88
|
+
variant?: ContainerVariants | null;
|
|
89
|
+
scrollY?: boolean | null;
|
|
90
|
+
children?: any;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const WContainer = (props: Omit<ContainerProps, "id"> & { id?: string }) => {
|
|
94
|
+
if (!props.id) {
|
|
95
|
+
props.id = "Container." + UID();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
connectWidgetCallback(props.id, getOnlyEventProps(props));
|
|
99
|
+
|
|
100
|
+
return normalizeWidget(
|
|
101
|
+
<div id={props.id} w-container w-variant={props.variant} w-scroll-y={props.scrollY}>
|
|
102
|
+
{props.children}
|
|
103
|
+
</div>,
|
|
104
|
+
props
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const WSpacer = (props: Omit<ContainerProps, "id">) => {
|
|
109
|
+
return normalizeWidget(<div w-container>{props.children}</div>, { id: UID(), ...props });
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export function createContainer(content: any, parent: Widget | null = null): Container {
|
|
113
|
+
const dataOrientation = content.getAttribute("w-orientation");
|
|
114
|
+
const dataVariant = content.getAttribute("w-variant");
|
|
115
|
+
const dataScrollY = content.getAttribute("w-scroll-y");
|
|
116
|
+
const dataId = content.getAttribute("id") || UID();
|
|
117
|
+
|
|
118
|
+
let orientation: OrientationTypes = dataOrientation ? dataOrientation : "horizontal";
|
|
119
|
+
let variant: ContainerVariants = dataVariant ? dataVariant : "plain";
|
|
120
|
+
|
|
121
|
+
let newContainer = new Container({ id: dataId, orientation, parent, variant });
|
|
122
|
+
|
|
123
|
+
if (dataScrollY) {
|
|
124
|
+
console.log("setVerticalScrollbar");
|
|
125
|
+
newContainer.setVerticalScrollbar();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
content.childNodes.forEach((item: HTMLElement) => {
|
|
129
|
+
const widget = createWidget(item);
|
|
130
|
+
|
|
131
|
+
if (widget !== null) {
|
|
132
|
+
newContainer.addChild(widget);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
if (parent) {
|
|
137
|
+
parent.addChild(newContainer);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return newContainer;
|
|
141
|
+
}
|