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
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
border-color: var(--palette-divider);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
.WUIButton-stack-start-color-primary:hover span {
|
|
35
|
+
color: var(--palette-primary-text-light);
|
|
36
|
+
}
|
|
37
|
+
|
|
34
38
|
/****************************************************************************/
|
|
35
39
|
/***********************************STACK-MIDDLE******************************/
|
|
36
40
|
/****************************************************************************/
|
|
@@ -64,6 +68,10 @@
|
|
|
64
68
|
border-color: var(--palette-divider);
|
|
65
69
|
}
|
|
66
70
|
|
|
71
|
+
.WUIButton-stack-middle-color-primary:hover span {
|
|
72
|
+
color: var(--palette-primary-text-light);
|
|
73
|
+
}
|
|
74
|
+
|
|
67
75
|
/**************************************************************************/
|
|
68
76
|
/***********************************STACK-END******************************/
|
|
69
77
|
/**************************************************************************/
|
|
@@ -99,6 +107,10 @@
|
|
|
99
107
|
border-color: var(--palette-divider);
|
|
100
108
|
}
|
|
101
109
|
|
|
110
|
+
.WUIButton-stack-end-color-primary:hover span {
|
|
111
|
+
color: var(--palette-primary-text-light);
|
|
112
|
+
}
|
|
113
|
+
|
|
102
114
|
/************************************************************************/
|
|
103
115
|
/******************************STACK-START-ACTIVE************************/
|
|
104
116
|
/************************************************************************/
|
|
@@ -127,12 +139,20 @@
|
|
|
127
139
|
border-color: var(--palette-divider);
|
|
128
140
|
}
|
|
129
141
|
|
|
142
|
+
.WUIButton-stack-start-active-color-primary span {
|
|
143
|
+
color: var(--palette-primary-text-light);
|
|
144
|
+
}
|
|
145
|
+
|
|
130
146
|
.WUIButton-stack-start-active-color-primary:hover {
|
|
131
147
|
color: var(--palette-primary-text-light);
|
|
132
148
|
background-color: var(--palette-primary-light);
|
|
133
149
|
border-color: var(--palette-divider);
|
|
134
150
|
}
|
|
135
151
|
|
|
152
|
+
.WUIButton-stack-start-active-color-primary:hover span {
|
|
153
|
+
color: var(--palette-primary-text-light);
|
|
154
|
+
}
|
|
155
|
+
|
|
136
156
|
/*************************************************************************/
|
|
137
157
|
/**************************STACK-MIDDLE-ACTIVE****************************/
|
|
138
158
|
/*************************************************************************/
|
|
@@ -161,12 +181,20 @@
|
|
|
161
181
|
border-color: var(--palette-divider);
|
|
162
182
|
}
|
|
163
183
|
|
|
184
|
+
.WUIButton-stack-middle-active-color-primary span {
|
|
185
|
+
color: var(--palette-primary-text-light);
|
|
186
|
+
}
|
|
187
|
+
|
|
164
188
|
.WUIButton-stack-middle-active-color-primary:hover {
|
|
165
189
|
color: var(--palette-primary-text-light);
|
|
166
190
|
background-color: var(--palette-primary-light);
|
|
167
191
|
border-color: var(--palette-divider);
|
|
168
192
|
}
|
|
169
193
|
|
|
194
|
+
.WUIButton-stack-middle-active-color-primary:hover span {
|
|
195
|
+
color: var(--palette-primary-text-light);
|
|
196
|
+
}
|
|
197
|
+
|
|
170
198
|
/**************************************************************************/
|
|
171
199
|
/********************************STACK-END-ACTIVE**************************/
|
|
172
200
|
/**************************************************************************/
|
|
@@ -198,8 +226,16 @@
|
|
|
198
226
|
border-color: var(--palette-divider);
|
|
199
227
|
}
|
|
200
228
|
|
|
229
|
+
.WUIButton-stack-end-active-color-primary span {
|
|
230
|
+
color: var(--palette-primary-text-light);
|
|
231
|
+
}
|
|
232
|
+
|
|
201
233
|
.WUIButton-stack-end-active-color-primary:hover {
|
|
202
234
|
color: var(--palette-primary-text-light);
|
|
203
235
|
background-color: var(--palette-primary-light);
|
|
204
236
|
border-color: var(--palette-divider);
|
|
205
237
|
}
|
|
238
|
+
|
|
239
|
+
.WUIButton-stack-end-active-color-primary:hover span {
|
|
240
|
+
color: var(--palette-primary-text-light);
|
|
241
|
+
}
|
package/src/ui/styles/tabs.css
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
border-radius: 0px !important;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
.WUITabContainer {
|
|
42
|
+
.WUITabContainer-horizontal {
|
|
43
43
|
border-top: solid 1px var(--palette-divider);
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -60,19 +60,17 @@
|
|
|
60
60
|
|
|
61
61
|
.WUITabControlActiveIcon_VL {
|
|
62
62
|
border-top: none !important;
|
|
63
|
-
border-
|
|
64
|
-
border-
|
|
63
|
+
border-right: none !important;
|
|
64
|
+
border-left: solid 2px var(--palette-primary-dark) !important;
|
|
65
65
|
border-bottom: none !important;
|
|
66
66
|
background-color: var(--palette-divider);
|
|
67
67
|
box-sizing: border-box;
|
|
68
68
|
font-weight: bold;
|
|
69
69
|
text-align: center;
|
|
70
70
|
cursor: default;
|
|
71
|
-
padding-left: 15px;
|
|
72
|
-
padding-right: 15px;
|
|
73
71
|
border-radius: 0px !important;
|
|
74
72
|
}
|
|
75
73
|
|
|
76
|
-
.
|
|
77
|
-
border-
|
|
74
|
+
.WUITabContainer-vertical {
|
|
75
|
+
border-left: solid 1px var(--palette-divider);
|
|
78
76
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
.WUITextArea {
|
|
2
|
-
outline: none;
|
|
3
|
-
/*border-collapse: collapse;*/
|
|
4
|
-
border: 2px solid var(--palette-action-disabled);
|
|
5
|
-
border-radius: 4px;
|
|
6
|
-
box-sizing: border-box;
|
|
7
|
-
font-size: 1rem;
|
|
8
|
-
padding-left: 20px;
|
|
9
|
-
z-index: 1000;
|
|
10
|
-
background-color: var(--palette-background-default);
|
|
11
|
-
color: var(--palette-text-primary);
|
|
12
|
-
overflow-y: auto;
|
|
13
|
-
}
|
|
1
|
+
.WUITextArea {
|
|
2
|
+
outline: none;
|
|
3
|
+
/*border-collapse: collapse;*/
|
|
4
|
+
border: 2px solid var(--palette-action-disabled);
|
|
5
|
+
border-radius: 4px;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
font-size: 1rem;
|
|
8
|
+
padding-left: 20px;
|
|
9
|
+
z-index: 1000;
|
|
10
|
+
background-color: var(--palette-background-default);
|
|
11
|
+
color: var(--palette-text-primary);
|
|
12
|
+
overflow-y: auto;
|
|
13
|
+
}
|
package/src/ui/switch.ui.tsx
CHANGED
|
@@ -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
|
export class Switch extends ToggleButton {
|
|
5
6
|
constructor(id: string, text: string = "", parent: Widget | null = null) {
|
|
@@ -13,20 +14,15 @@ export type wSwitchProps = WidgetProps & {
|
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
export const WSwitch = (props: wSwitchProps) => {
|
|
17
|
+
if (!props.id) {
|
|
18
|
+
props.id = "Switch." + UID();
|
|
19
|
+
}
|
|
20
|
+
|
|
16
21
|
connectWidgetCallback(props.id, getOnlyEventProps(props));
|
|
17
22
|
|
|
18
|
-
return (
|
|
19
|
-
<div
|
|
20
|
-
|
|
21
|
-
w-switch
|
|
22
|
-
w-text={props.text}
|
|
23
|
-
w-checked={props.checked}
|
|
24
|
-
w-class={props.classNames}
|
|
25
|
-
w-orientation={props.orientation}
|
|
26
|
-
w-fixed-size={props.fixedSize}
|
|
27
|
-
w-padding={props.padding}
|
|
28
|
-
w-type={props.type}
|
|
29
|
-
/>
|
|
23
|
+
return normalizeWidget(
|
|
24
|
+
<div id={props.id} w-switch w-text={props.text} w-checked={props.checked} />,
|
|
25
|
+
props
|
|
30
26
|
);
|
|
31
27
|
};
|
|
32
28
|
|
package/src/ui/tabs.ui.tsx
CHANGED
|
@@ -4,9 +4,10 @@ import { OrientationTypes } from "src/types/orientation.type";
|
|
|
4
4
|
import { Widget, WidgetAlignTypes, WidgetTypes } from "./widget.ui";
|
|
5
5
|
import { Toolbar } from "./toolbar.ui";
|
|
6
6
|
import { Label } from "./label.ui";
|
|
7
|
-
import {
|
|
7
|
+
import { Icon } from "./Icon.ui";
|
|
8
8
|
import { Scroll } from "./scroll.ui";
|
|
9
|
-
import { WidgetProps, createWidget } from "./widget.builder";
|
|
9
|
+
import { WidgetProps, createWidget, normalizeWidget } from "./widget.builder";
|
|
10
|
+
import { UID } from "../core/uid";
|
|
10
11
|
|
|
11
12
|
const TAB_HEADER_SIZE = 40;
|
|
12
13
|
|
|
@@ -35,14 +36,15 @@ export class Tabs extends Widget {
|
|
|
35
36
|
|
|
36
37
|
this.content = new Widget(id + ".content", "div");
|
|
37
38
|
this.content.setType(WidgetTypes.FILL);
|
|
38
|
-
this.content.addClass("WUITabContainer");
|
|
39
39
|
|
|
40
40
|
this.setType(WidgetTypes.FILL);
|
|
41
41
|
|
|
42
42
|
if (this.orientation === "horizontal") {
|
|
43
43
|
this.setAlign(WidgetAlignTypes.VERTICAL);
|
|
44
|
+
this.content.addClass("WUITabContainer-horizontal");
|
|
44
45
|
} else {
|
|
45
46
|
this.setAlign(WidgetAlignTypes.HORIZONTAL);
|
|
47
|
+
this.content.addClass("WUITabContainer-vertical");
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
this.items = new Map<string, TabItem>();
|
|
@@ -60,7 +62,11 @@ export class Tabs extends Widget {
|
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
public setOrientation(orientation: OrientationTypes) {
|
|
65
|
+
if (this.orientation !== orientation) {
|
|
66
|
+
this.content.deleteClass("WUITabContainer-" + this.orientation);
|
|
67
|
+
}
|
|
63
68
|
this.orientation = orientation;
|
|
69
|
+
this.content.addClass("WUITabContainer-" + this.orientation);
|
|
64
70
|
}
|
|
65
71
|
|
|
66
72
|
public addTab(id: string, title: string, content: Widget, scrollable: boolean = false) {
|
|
@@ -98,9 +104,19 @@ export class Tabs extends Widget {
|
|
|
98
104
|
this.items.set(id, { title: icon, content });
|
|
99
105
|
this.itemsScrollable.set(id, scrollable);
|
|
100
106
|
|
|
101
|
-
const itemControl = new
|
|
102
|
-
|
|
103
|
-
|
|
107
|
+
const itemControl = new Icon(id + ".itemControl", icon);
|
|
108
|
+
|
|
109
|
+
if (this.orientation === "horizontal") {
|
|
110
|
+
itemControl.setH(TAB_HEADER_SIZE);
|
|
111
|
+
itemControl.getBody().style.lineHeight = TAB_HEADER_SIZE + "px";
|
|
112
|
+
} else if (this.orientation === "vertical") {
|
|
113
|
+
itemControl.getBody().style.writingMode = "vertical-rl";
|
|
114
|
+
itemControl.getBody().style.transform = "scale(-1,-1)";
|
|
115
|
+
itemControl.getBody().style.paddingTop = "12px";
|
|
116
|
+
itemControl.getBody().style.paddingBottom = "12px";
|
|
117
|
+
itemControl.getBody().style.paddingRight = "10px";
|
|
118
|
+
itemControl.setW(TAB_HEADER_SIZE);
|
|
119
|
+
}
|
|
104
120
|
|
|
105
121
|
itemControl.subscribe({
|
|
106
122
|
event: "click",
|
|
@@ -125,7 +141,7 @@ export class Tabs extends Widget {
|
|
|
125
141
|
ctrlTab.deleteClass("WUITabControlActive");
|
|
126
142
|
ctrlTab.addClass("WUITabControl");
|
|
127
143
|
} else if (this.orientation === "vertical") {
|
|
128
|
-
if (ctrlTab instanceof
|
|
144
|
+
if (ctrlTab instanceof Icon) {
|
|
129
145
|
ctrlTab.deleteClass("WUITabControlActiveIcon_VL");
|
|
130
146
|
} else if (ctrlTab instanceof Label) {
|
|
131
147
|
ctrlTab.deleteClass("WUITabControlActive_VL");
|
|
@@ -139,7 +155,7 @@ export class Tabs extends Widget {
|
|
|
139
155
|
if (this.orientation === "horizontal") {
|
|
140
156
|
ctrlTab.addClass("WUITabControlActive");
|
|
141
157
|
} else if (this.orientation === "vertical") {
|
|
142
|
-
if (ctrlTab instanceof
|
|
158
|
+
if (ctrlTab instanceof Icon) {
|
|
143
159
|
ctrlTab.addClass("WUITabControlActiveIcon_VL");
|
|
144
160
|
} else if (ctrlTab instanceof Label) {
|
|
145
161
|
ctrlTab.addClass("WUITabControlActive_VL");
|
|
@@ -186,6 +202,7 @@ export type TabItemType = "text" | "icon-tab";
|
|
|
186
202
|
|
|
187
203
|
export type WTabProps = Omit<WidgetProps, "orientation"> & {
|
|
188
204
|
orientation?: OrientationTypes;
|
|
205
|
+
selectedTab?: number | null;
|
|
189
206
|
children: any;
|
|
190
207
|
};
|
|
191
208
|
|
|
@@ -198,18 +215,14 @@ export type WTabItemProps = {
|
|
|
198
215
|
};
|
|
199
216
|
|
|
200
217
|
export const WTab = (props: WTabProps) => {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
w-orientation={props.orientation}
|
|
207
|
-
w-fixed-size={props.fixedSize}
|
|
208
|
-
w-padding={props.padding}
|
|
209
|
-
w-type={props.type}
|
|
210
|
-
>
|
|
218
|
+
if (!props.id) {
|
|
219
|
+
props.id = "Tabs." + UID();
|
|
220
|
+
}
|
|
221
|
+
return normalizeWidget(
|
|
222
|
+
<div id={props.id} w-tab w-class={props.classNames} w-selected-tab={props.selectedTab}>
|
|
211
223
|
{props.children}
|
|
212
|
-
</div
|
|
224
|
+
</div>,
|
|
225
|
+
props
|
|
213
226
|
);
|
|
214
227
|
};
|
|
215
228
|
|
|
@@ -224,6 +237,7 @@ export const WTabItem = (props: WTabItemProps) => {
|
|
|
224
237
|
export function createTab(id: string, content: any, parent: Widget | null = null): Tabs {
|
|
225
238
|
const dataOrientation = content.getAttribute("w-orientation");
|
|
226
239
|
const dataScrollable = content.getAttribute("w-scrollable") ? true : false;
|
|
240
|
+
const dataSelectedTab = content.getAttribute("w-selected-tab");
|
|
227
241
|
|
|
228
242
|
let orientation: OrientationTypes = dataOrientation ? dataOrientation : "horizontal";
|
|
229
243
|
|
|
@@ -244,14 +258,14 @@ export function createTab(id: string, content: any, parent: Widget | null = null
|
|
|
244
258
|
if (widget !== null) {
|
|
245
259
|
if (tabType === "text") {
|
|
246
260
|
newTab.addTab(
|
|
247
|
-
"
|
|
261
|
+
newTab.id + ".Item." + index,
|
|
248
262
|
tabTitle || "Untitled",
|
|
249
263
|
widget,
|
|
250
264
|
dataScrollable
|
|
251
265
|
);
|
|
252
266
|
} else if (tabType === "icon-tab") {
|
|
253
267
|
newTab.addIconTab(
|
|
254
|
-
"
|
|
268
|
+
newTab.id + ".Item." + index,
|
|
255
269
|
tabIcon || "home",
|
|
256
270
|
widget,
|
|
257
271
|
dataScrollable
|
|
@@ -261,7 +275,14 @@ export function createTab(id: string, content: any, parent: Widget | null = null
|
|
|
261
275
|
}
|
|
262
276
|
});
|
|
263
277
|
|
|
264
|
-
|
|
278
|
+
if (dataSelectedTab !== null) {
|
|
279
|
+
const selectedTab = parseInt(dataSelectedTab);
|
|
280
|
+
if (selectedTab < newTab.items.size) {
|
|
281
|
+
newTab.setTab(newTab.id + ".Item." + selectedTab);
|
|
282
|
+
}
|
|
283
|
+
} else {
|
|
284
|
+
newTab.setTab(newTab.id + ".Item.0");
|
|
285
|
+
}
|
|
265
286
|
|
|
266
287
|
return newTab;
|
|
267
288
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { UID } from "../core/uid";
|
|
2
|
+
import "./styles/textarea.css";
|
|
3
|
+
import { normalizeWidget, WidgetProps } from "./widget.builder";
|
|
4
|
+
import { connectWidgetCallback, getOnlyEventProps, Widget } from "./widget.ui";
|
|
5
|
+
|
|
6
|
+
export class TextArea extends Widget {
|
|
7
|
+
constructor(id: string, parent: Widget | null = null) {
|
|
8
|
+
super(id, "textarea", parent);
|
|
9
|
+
|
|
10
|
+
this.addClass("WUITextArea");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public setText(text: string): void {
|
|
14
|
+
const textArea = this.getBody() as HTMLTextAreaElement;
|
|
15
|
+
textArea.value = text;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public getText(): string {
|
|
19
|
+
const textArea = this.getBody() as HTMLTextAreaElement;
|
|
20
|
+
return textArea.value;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type wTextareaProps = WidgetProps & {
|
|
25
|
+
text: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const WTextarea = (props: wTextareaProps) => {
|
|
29
|
+
if (!props.id) {
|
|
30
|
+
props.id = "Textarea." + UID();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
connectWidgetCallback(props.id, getOnlyEventProps(props));
|
|
34
|
+
|
|
35
|
+
return normalizeWidget(<div id={props.id} w-textarea w-text={props.text}></div>, props);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export function createTextarea(id: string, content: any, parent: Widget | null = null): TextArea {
|
|
39
|
+
let newTextarea = new TextArea(id, parent);
|
|
40
|
+
|
|
41
|
+
const dataText = content.getAttribute("w-text");
|
|
42
|
+
|
|
43
|
+
if (dataText) {
|
|
44
|
+
newTextarea.setText(dataText);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return newTextarea;
|
|
48
|
+
}
|
package/src/ui/toolbar.ui.tsx
CHANGED
|
@@ -3,7 +3,8 @@ import { IWidget } from "src/interfaces/widget.interface";
|
|
|
3
3
|
import { Widget, WidgetAlignTypes, WidgetTypes } from "./widget.ui";
|
|
4
4
|
import { IconButton } from "./IconButton.ui";
|
|
5
5
|
import { OrientationTypes } from "src/types/orientation.type";
|
|
6
|
-
import { WidgetProps, createWidget } from "./widget.builder";
|
|
6
|
+
import { WidgetProps, createWidget, normalizeWidget } from "./widget.builder";
|
|
7
|
+
import { UID } from "../core/uid";
|
|
7
8
|
|
|
8
9
|
export type ToolbarVariants = "contained" | "outlined";
|
|
9
10
|
|
|
@@ -39,7 +40,7 @@ export class Toolbar extends Widget {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
this.setType(WidgetTypes.FILL);
|
|
42
|
-
this.setFixedSize(TOOLBAR_SIZE);
|
|
43
|
+
//this.setFixedSize(TOOLBAR_SIZE);
|
|
43
44
|
this.addClass("WUIToolbar-" + this.variant);
|
|
44
45
|
|
|
45
46
|
this.itemsContainer = new Widget(this.id + ".itemsContainer", "div", this);
|
|
@@ -232,31 +233,35 @@ export class Toolbar extends Widget {
|
|
|
232
233
|
}
|
|
233
234
|
|
|
234
235
|
export type ToolbarProps = WidgetProps & {
|
|
236
|
+
variant?: ToolbarVariants;
|
|
235
237
|
children: any;
|
|
236
238
|
};
|
|
237
239
|
|
|
238
240
|
export const WToolbar = (props: ToolbarProps) => {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
w-padding={props.padding}
|
|
246
|
-
w-type={props.type}
|
|
247
|
-
>
|
|
241
|
+
if (!props.id) {
|
|
242
|
+
props.id = "Toolbar." + UID();
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return normalizeWidget(
|
|
246
|
+
<div w-toolbar id={props.id} w-variant={props.variant}>
|
|
248
247
|
{props.children}
|
|
249
|
-
</div
|
|
248
|
+
</div>,
|
|
249
|
+
props
|
|
250
250
|
);
|
|
251
251
|
};
|
|
252
252
|
|
|
253
253
|
export function createToolbar(id: string, content: any, parent: Widget | null = null): Toolbar {
|
|
254
254
|
const dataOrientation = content.getAttribute("w-orientation");
|
|
255
|
+
const dataVariant = content.getAttribute("w-variant");
|
|
255
256
|
|
|
256
257
|
let orientation: OrientationTypes = dataOrientation ? dataOrientation : "horizontal";
|
|
257
258
|
|
|
258
259
|
let newToolbar = new Toolbar(id, parent, orientation);
|
|
259
260
|
|
|
261
|
+
if (dataVariant) {
|
|
262
|
+
newToolbar.setVariant(dataVariant);
|
|
263
|
+
}
|
|
264
|
+
|
|
260
265
|
content.childNodes.forEach((item: HTMLElement) => {
|
|
261
266
|
const widget = createWidget(item);
|
|
262
267
|
|
package/src/ui/valuebar.ui.tsx
CHANGED
|
@@ -2,7 +2,8 @@ import "./styles/valuebar.css";
|
|
|
2
2
|
import { OrientationTypes } from "src/types/orientation.type";
|
|
3
3
|
import { Widget, connectWidgetCallback, getOnlyEventProps } from "./widget.ui";
|
|
4
4
|
import { Draggable } from "./draggable.ui";
|
|
5
|
-
import { WidgetProps } from "./widget.builder";
|
|
5
|
+
import { normalizeWidget, WidgetProps } from "./widget.builder";
|
|
6
|
+
import { UID } from "../core/uid";
|
|
6
7
|
|
|
7
8
|
export class ValueBar extends Widget {
|
|
8
9
|
orientation: OrientationTypes;
|
|
@@ -49,6 +50,10 @@ export class ValueBar extends Widget {
|
|
|
49
50
|
this.render();
|
|
50
51
|
}
|
|
51
52
|
|
|
53
|
+
public getValue(): number {
|
|
54
|
+
return this.value;
|
|
55
|
+
}
|
|
56
|
+
|
|
52
57
|
public updateValueFromHandlerPosition(): void {
|
|
53
58
|
if (this.orientation === "horizontal") {
|
|
54
59
|
const maxX = this.draggable.maxX ? this.draggable.maxX : 1;
|
|
@@ -121,20 +126,13 @@ export type wValueBarProps = WidgetProps & {
|
|
|
121
126
|
};
|
|
122
127
|
|
|
123
128
|
export const WValueBar = (props: wValueBarProps) => {
|
|
129
|
+
if (!props.id) {
|
|
130
|
+
props.id = "ValueBar." + UID();
|
|
131
|
+
}
|
|
132
|
+
|
|
124
133
|
connectWidgetCallback(props.id, getOnlyEventProps(props));
|
|
125
134
|
|
|
126
|
-
return (
|
|
127
|
-
<div
|
|
128
|
-
id={props.id}
|
|
129
|
-
w-valuebar
|
|
130
|
-
w-value={props.value}
|
|
131
|
-
w-class={props.classNames}
|
|
132
|
-
w-orientation={props.orientation}
|
|
133
|
-
w-fixed-size={props.fixedSize}
|
|
134
|
-
w-padding={props.padding}
|
|
135
|
-
w-type={props.type}
|
|
136
|
-
></div>
|
|
137
|
-
);
|
|
135
|
+
return normalizeWidget(<div id={props.id} w-valuebar w-value={props.value}></div>, props);
|
|
138
136
|
};
|
|
139
137
|
|
|
140
138
|
export function createValueBar(id: string, content: any, parent: Widget | null = null): ValueBar {
|
package/src/ui/vpanel.ui.tsx
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { Draggable } from "./draggable.ui";
|
|
2
2
|
import "./styles/vpanel.css";
|
|
3
|
-
import { WidgetProps, createWidget } from "./widget.builder";
|
|
4
|
-
import {
|
|
3
|
+
import { WidgetProps, createWidget, normalizeWidget } from "./widget.builder";
|
|
4
|
+
import {
|
|
5
|
+
connectWidgetCallback,
|
|
6
|
+
getOnlyEventProps,
|
|
7
|
+
Widget,
|
|
8
|
+
WidgetAlignTypes,
|
|
9
|
+
WidgetTypes,
|
|
10
|
+
} from "./widget.ui";
|
|
5
11
|
|
|
6
12
|
const VPANEL_HANDLER_SIZE = 4;
|
|
7
13
|
|
|
@@ -126,6 +132,14 @@ export class VPanel extends Widget {
|
|
|
126
132
|
|
|
127
133
|
this.handler.setX(this.getX(true));
|
|
128
134
|
}
|
|
135
|
+
|
|
136
|
+
public free(): void {
|
|
137
|
+
this.handler.free();
|
|
138
|
+
this.topContent?.free();
|
|
139
|
+
this.bottomContent?.free();
|
|
140
|
+
//this.draggable.free();
|
|
141
|
+
super.free();
|
|
142
|
+
}
|
|
129
143
|
}
|
|
130
144
|
|
|
131
145
|
export type WVPanelProps = WidgetProps & {
|
|
@@ -133,17 +147,9 @@ export type WVPanelProps = WidgetProps & {
|
|
|
133
147
|
};
|
|
134
148
|
|
|
135
149
|
export const WVPanel = (props: WVPanelProps) => {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
w-class={props.classNames}
|
|
140
|
-
w-fixed-size={props.fixedSize}
|
|
141
|
-
w-padding={props.padding}
|
|
142
|
-
w-type={props.type}
|
|
143
|
-
>
|
|
144
|
-
{props.children}
|
|
145
|
-
</div>
|
|
146
|
-
);
|
|
150
|
+
connectWidgetCallback(props.id, getOnlyEventProps(props));
|
|
151
|
+
|
|
152
|
+
return normalizeWidget(<div w-vpanel>{props.children}</div>, props);
|
|
147
153
|
};
|
|
148
154
|
|
|
149
155
|
export function createVPanel(id: string, content: any, parent: Widget | null = null): VPanel {
|