cedro 0.1.3 → 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 +10 -3
- package/src/types/orientation.type.ts +1 -0
- 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 +231 -0
- package/src/ui/draggable.ui.ts +165 -0
- package/src/ui/hpanel.ui.ts +127 -0
- package/src/ui/iconButtonMenu.ui.ts +59 -0
- package/src/ui/index.ts +46 -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 +184 -0
- 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 +36 -0
- package/src/ui/styles/draggable.css +9 -0
- 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 +4 -0
- package/src/ui/styles/stackbutton.css +205 -0
- package/src/ui/styles/tabs.css +78 -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 +182 -0
- 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 +38 -10
- package/src/ui/valuebar.ui.ts +116 -0
- package/src/ui/vpanel.ui.ts +128 -0
- package/src/ui/widget.ui.ts +63 -4
package/src/ui/widget.ui.ts
CHANGED
|
@@ -113,6 +113,30 @@ export class Widget implements IWidget {
|
|
|
113
113
|
});
|
|
114
114
|
});
|
|
115
115
|
|
|
116
|
+
this.body.addEventListener("wheel", (e) => {
|
|
117
|
+
this.subscribers.forEach((callback) => {
|
|
118
|
+
if (callback.event == "wheel") {
|
|
119
|
+
callback.then(e, this);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
this.body.addEventListener("mouseout", (e) => {
|
|
125
|
+
this.subscribers.forEach((callback) => {
|
|
126
|
+
if (callback.event == "mouseout") {
|
|
127
|
+
callback.then(e, this);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
this.body.addEventListener("mouseleave", (e) => {
|
|
133
|
+
this.subscribers.forEach((callback) => {
|
|
134
|
+
if (callback.event == "mouseleave") {
|
|
135
|
+
callback.then(e, this);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
116
140
|
this.init();
|
|
117
141
|
|
|
118
142
|
this.getMaxZIndex();
|
|
@@ -120,8 +144,25 @@ export class Widget implements IWidget {
|
|
|
120
144
|
window.w.set(this.id, this);
|
|
121
145
|
}
|
|
122
146
|
|
|
147
|
+
public dispose(): void {
|
|
148
|
+
this.removeAllChilds();
|
|
149
|
+
const body = this.getBody();
|
|
150
|
+
const parent = body.parentNode;
|
|
151
|
+
parent?.removeChild(body);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
public run(eventId: WUIEvent): void {
|
|
155
|
+
this.subscribers.forEach((callback) => {
|
|
156
|
+
if (callback.event == eventId) {
|
|
157
|
+
callback.then(new Event(eventId), this);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
123
162
|
public subscribe(cb: WUICallback) {
|
|
124
|
-
const randomId =
|
|
163
|
+
const randomId =
|
|
164
|
+
Math.random().toString(36).substring(2, 15) +
|
|
165
|
+
Math.random().toString(36).substring(2, 15);
|
|
125
166
|
|
|
126
167
|
this.subscribers.set(`${randomId}.${cb.event}`, cb);
|
|
127
168
|
}
|
|
@@ -225,7 +266,7 @@ export class Widget implements IWidget {
|
|
|
225
266
|
});
|
|
226
267
|
}
|
|
227
268
|
|
|
228
|
-
public setFixedSize(s: number): void {
|
|
269
|
+
public setFixedSize(s: number | null): void {
|
|
229
270
|
this.fixedSize = s;
|
|
230
271
|
}
|
|
231
272
|
|
|
@@ -405,7 +446,16 @@ export class Widget implements IWidget {
|
|
|
405
446
|
*
|
|
406
447
|
* @return {number} The value of the 'left' property.
|
|
407
448
|
*/
|
|
408
|
-
public getX(): number {
|
|
449
|
+
public getX(recursive: boolean = false): number {
|
|
450
|
+
if (!recursive) {
|
|
451
|
+
return this.left;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
const parent = this.getParent();
|
|
455
|
+
|
|
456
|
+
if (parent) {
|
|
457
|
+
return this.left + parent.getX(true);
|
|
458
|
+
}
|
|
409
459
|
return this.left;
|
|
410
460
|
}
|
|
411
461
|
|
|
@@ -414,7 +464,16 @@ export class Widget implements IWidget {
|
|
|
414
464
|
*
|
|
415
465
|
* @return {number} The value of Y.
|
|
416
466
|
*/
|
|
417
|
-
public getY(): number {
|
|
467
|
+
public getY(recursive: boolean = false): number {
|
|
468
|
+
if (!recursive) {
|
|
469
|
+
return this.top;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
const parent = this.getParent();
|
|
473
|
+
|
|
474
|
+
if (parent) {
|
|
475
|
+
return this.top + parent.getY(true);
|
|
476
|
+
}
|
|
418
477
|
return this.top;
|
|
419
478
|
}
|
|
420
479
|
|