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.
Files changed (65) hide show
  1. package/README.md +7 -4
  2. package/dist/cedro-logo.png +0 -0
  3. package/dist/fangio.jpg +0 -0
  4. package/package.json +4 -2
  5. package/src/core/application.builder.tsx +121 -60
  6. package/src/core/application.core.tsx +110 -11
  7. package/src/core/themes.core.ts +160 -1
  8. package/src/core/uid.ts +3 -3
  9. package/src/interfaces/application.interface.ts +3 -2
  10. package/src/interfaces/widget.interface.ts +3 -0
  11. package/src/types/select.item.type.ts +11 -0
  12. package/src/ui/Icon.ui.tsx +158 -0
  13. package/src/ui/IconButton.ui.tsx +51 -9
  14. package/src/ui/{textbox.ui.tsx → Textbox.ui.tsx} +23 -15
  15. package/src/ui/accordion.ui.tsx +152 -0
  16. package/src/ui/button.ui.tsx +56 -14
  17. package/src/ui/buttonColor.ui.tsx +87 -0
  18. package/src/ui/buttonmenu.ui.tsx +134 -0
  19. package/src/ui/{buttonstack.ui.ts → buttonstack.ui.tsx} +67 -1
  20. package/src/ui/checkbox.ui.tsx +9 -13
  21. package/src/ui/container.ui.tsx +141 -76
  22. package/src/ui/datagrid.ui.tsx +518 -0
  23. package/src/ui/dialog.tsx +143 -56
  24. package/src/ui/hpanel.ui.tsx +37 -11
  25. package/src/ui/iconButtonMenu.ui.tsx +176 -0
  26. package/src/ui/image.ui.tsx +123 -112
  27. package/src/ui/index.ts +8 -8
  28. package/src/ui/label.ui.tsx +61 -3
  29. package/src/ui/loading.ui.ts +10 -10
  30. package/src/ui/menu.ui.ts +2 -2
  31. package/src/ui/progressbar.ui.tsx +9 -8
  32. package/src/ui/{radiobutton.tsx → radiobutton.ui.tsx} +9 -13
  33. package/src/ui/scroll.ui.ts +13 -12
  34. package/src/ui/select.ui.tsx +143 -0
  35. package/src/ui/styles/button.css +114 -32
  36. package/src/ui/styles/buttoncolor.css +8 -8
  37. package/src/ui/styles/container.css +29 -0
  38. package/src/ui/styles/icon.css +29 -0
  39. package/src/ui/styles/image.css +19 -19
  40. package/src/ui/styles/label.css +63 -0
  41. package/src/ui/styles/loading.css +12 -12
  42. package/src/ui/styles/main.css +5 -0
  43. package/src/ui/styles/progressbar.css +2 -1
  44. package/src/ui/styles/select.css +13 -0
  45. package/src/ui/styles/stackbutton.css +36 -0
  46. package/src/ui/styles/tabs.css +5 -7
  47. package/src/ui/styles/textarea.css +13 -13
  48. package/src/ui/switch.ui.tsx +9 -13
  49. package/src/ui/tabs.ui.tsx +43 -22
  50. package/src/ui/textarea.ui.tsx +48 -0
  51. package/src/ui/toolbar.ui.tsx +17 -12
  52. package/src/ui/valuebar.ui.tsx +11 -13
  53. package/src/ui/vpanel.ui.tsx +19 -13
  54. package/src/ui/widget.builder.ts +243 -159
  55. package/src/ui/widget.collection.ts +24 -2
  56. package/src/ui/widget.ui.ts +79 -19
  57. package/src/ui/Icon.ui.ts +0 -64
  58. package/src/ui/accordion.ui.ts +0 -71
  59. package/src/ui/buttonColor.ui.ts +0 -24
  60. package/src/ui/buttonmenu.ui.ts +0 -59
  61. package/src/ui/datagrid.ui.ts +0 -231
  62. package/src/ui/iconButtonMenu.ui.ts +0 -59
  63. package/src/ui/select.ui.ts +0 -73
  64. package/src/ui/textarea.ui.ts +0 -20
  65. /package/src/ui/{toggle.ui.ts → toggle.ui.tsx} +0 -0
@@ -1,76 +1,141 @@
1
- import { OrientationTypes } from "src/types/orientation.type";
2
- import { Widget, WidgetAlignTypes, WidgetTypes } from "./widget.ui";
3
- import { UID } from "../core/uid";
4
- import { WidgetProps, createWidget } from "./widget.builder";
5
-
6
- export type ContainerParams = {
7
- orientation?: OrientationTypes;
8
- parent?: Widget | null;
9
- size?: number | null;
10
- padding?: number | null;
11
- };
12
-
13
- export class Container extends Widget {
14
- constructor(params: ContainerParams) {
15
- const { orientation = "horizontal", parent = null, size = null, padding = null } = params;
16
-
17
- super(UID(), "div", parent);
18
-
19
- if (orientation === "horizontal") {
20
- this.setAlign(WidgetAlignTypes.HORIZONTAL);
21
- } else {
22
- this.setAlign(WidgetAlignTypes.VERTICAL);
23
- }
24
-
25
- if (size !== null) {
26
- this.setFixedSize(size);
27
- }
28
-
29
- if (padding !== null) {
30
- this.setPadding(padding);
31
- }
32
-
33
- this.setType(WidgetTypes.FILL);
34
- }
35
- }
36
-
37
- export function Spacer(): Container {
38
- return new Container({});
39
- }
40
-
41
- export type ContainerProps = Omit<WidgetProps, "id"> & {
42
- children: any;
43
- };
44
-
45
- export const WContainer = (props: ContainerProps) => {
46
- return (
47
- <div
48
- w-container
49
- w-class={props.classNames}
50
- w-orientation={props.orientation}
51
- w-fixed-size={props.fixedSize}
52
- w-padding={props.padding}
53
- w-type={props.type}
54
- >
55
- {props.children}
56
- </div>
57
- );
58
- };
59
-
60
- export function createContainer(content: any, parent: Widget | null = null): Container {
61
- const dataOrientation = content.getAttribute("w-orientation");
62
-
63
- let orientation: OrientationTypes = dataOrientation ? dataOrientation : "horizontal";
64
-
65
- let newContainer = new Container({ orientation, parent });
66
-
67
- content.childNodes.forEach((item: HTMLElement) => {
68
- const widget = createWidget(item);
69
-
70
- if (widget !== null) {
71
- newContainer.addChild(widget);
72
- }
73
- });
74
-
75
- return newContainer;
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
+ }