cedro 0.1.9 → 0.1.11

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 (254) hide show
  1. package/README.md +7 -4
  2. package/dist/assets/_virtual/_commonjsHelpers.js +1 -0
  3. package/dist/assets/_virtual/index.js +1 -0
  4. package/dist/assets/_virtual/modulepreload-polyfill.js +1 -0
  5. package/dist/assets/_virtual/named-references.js +1 -0
  6. package/dist/assets/_virtual/numeric-unicode-map.js +1 -0
  7. package/dist/assets/_virtual/surrogate-pairs.js +1 -0
  8. package/dist/assets/core/application.builder.js +1 -0
  9. package/dist/assets/core/application.core.js +1 -0
  10. package/dist/assets/core/jsxsupport.js +1 -0
  11. package/dist/assets/core/screeen.core.js +1 -0
  12. package/dist/assets/core/seo.js +1 -0
  13. package/dist/assets/core/themes.core.js +1 -0
  14. package/dist/assets/core/uid.js +1 -0
  15. package/dist/assets/index.js +1 -0
  16. package/dist/assets/material-icons-outlined.woff +0 -0
  17. package/dist/assets/material-icons-outlined.woff2 +0 -0
  18. package/dist/assets/material-icons-round.woff +0 -0
  19. package/dist/assets/material-icons-round.woff2 +0 -0
  20. package/dist/assets/material-icons-sharp.woff +0 -0
  21. package/dist/assets/material-icons-sharp.woff2 +0 -0
  22. package/dist/assets/material-icons-two-tone.woff +0 -0
  23. package/dist/assets/material-icons-two-tone.woff2 +0 -0
  24. package/dist/assets/material-icons.woff +0 -0
  25. package/dist/assets/material-icons.woff2 +0 -0
  26. package/dist/assets/node_modules/@fontsource/roboto/100.css +1 -0
  27. package/dist/assets/node_modules/@fontsource/roboto/300.css +1 -0
  28. package/dist/assets/node_modules/@fontsource/roboto/400.css +1 -0
  29. package/dist/assets/node_modules/@fontsource/roboto/500.css +1 -0
  30. package/dist/assets/node_modules/@fontsource/roboto/700.css +1 -0
  31. package/dist/assets/node_modules/@fontsource/roboto/900.css +1 -0
  32. package/dist/assets/node_modules/html-entities/lib/index.js +1 -0
  33. package/dist/assets/node_modules/html-entities/lib/named-references.js +2 -0
  34. package/dist/assets/node_modules/html-entities/lib/numeric-unicode-map.js +1 -0
  35. package/dist/assets/node_modules/html-entities/lib/surrogate-pairs.js +1 -0
  36. package/dist/assets/node_modules/material-icons/iconfont/material-icons.css +1 -0
  37. package/dist/assets/node_modules/navigo/lib/es/Q.js +1 -0
  38. package/dist/assets/node_modules/navigo/lib/es/constants.js +1 -0
  39. package/dist/assets/node_modules/navigo/lib/es/index.js +1 -0
  40. package/dist/assets/node_modules/navigo/lib/es/lifecycles.js +1 -0
  41. package/dist/assets/node_modules/navigo/lib/es/middlewares/callHandler.js +1 -0
  42. package/dist/assets/node_modules/navigo/lib/es/middlewares/checkForAfterHook.js +1 -0
  43. package/dist/assets/node_modules/navigo/lib/es/middlewares/checkForAlreadyHook.js +1 -0
  44. package/dist/assets/node_modules/navigo/lib/es/middlewares/checkForBeforeHook.js +1 -0
  45. package/dist/assets/node_modules/navigo/lib/es/middlewares/checkForDeprecationMethods.js +1 -0
  46. package/dist/assets/node_modules/navigo/lib/es/middlewares/checkForForceOp.js +1 -0
  47. package/dist/assets/node_modules/navigo/lib/es/middlewares/checkForLeaveHook.js +1 -0
  48. package/dist/assets/node_modules/navigo/lib/es/middlewares/checkForNotFoundHandler.js +1 -0
  49. package/dist/assets/node_modules/navigo/lib/es/middlewares/errorOut.js +1 -0
  50. package/dist/assets/node_modules/navigo/lib/es/middlewares/flushCurrent.js +1 -0
  51. package/dist/assets/node_modules/navigo/lib/es/middlewares/matchPathToRegisteredRoutes.js +1 -0
  52. package/dist/assets/node_modules/navigo/lib/es/middlewares/processMatches.js +1 -0
  53. package/dist/assets/node_modules/navigo/lib/es/middlewares/setLocationPath.js +1 -0
  54. package/dist/assets/node_modules/navigo/lib/es/middlewares/updateBrowserURL.js +1 -0
  55. package/dist/assets/node_modules/navigo/lib/es/middlewares/updateState.js +1 -0
  56. package/dist/assets/node_modules/navigo/lib/es/middlewares/waitingList.js +1 -0
  57. package/dist/assets/node_modules/navigo/lib/es/utils.js +1 -0
  58. package/dist/assets/roboto-cyrillic-100-normal.woff +0 -0
  59. package/dist/assets/roboto-cyrillic-100-normal.woff2 +0 -0
  60. package/dist/assets/roboto-cyrillic-300-normal.woff +0 -0
  61. package/dist/assets/roboto-cyrillic-300-normal.woff2 +0 -0
  62. package/dist/assets/roboto-cyrillic-400-normal.woff +0 -0
  63. package/dist/assets/roboto-cyrillic-400-normal.woff2 +0 -0
  64. package/dist/assets/roboto-cyrillic-500-normal.woff +0 -0
  65. package/dist/assets/roboto-cyrillic-500-normal.woff2 +0 -0
  66. package/dist/assets/roboto-cyrillic-700-normal.woff +0 -0
  67. package/dist/assets/roboto-cyrillic-700-normal.woff2 +0 -0
  68. package/dist/assets/roboto-cyrillic-900-normal.woff +0 -0
  69. package/dist/assets/roboto-cyrillic-900-normal.woff2 +0 -0
  70. package/dist/assets/roboto-cyrillic-ext-100-normal.woff +0 -0
  71. package/dist/assets/roboto-cyrillic-ext-100-normal.woff2 +0 -0
  72. package/dist/assets/roboto-cyrillic-ext-300-normal.woff +0 -0
  73. package/dist/assets/roboto-cyrillic-ext-300-normal.woff2 +0 -0
  74. package/dist/assets/roboto-cyrillic-ext-400-normal.woff +0 -0
  75. package/dist/assets/roboto-cyrillic-ext-400-normal.woff2 +0 -0
  76. package/dist/assets/roboto-cyrillic-ext-500-normal.woff +0 -0
  77. package/dist/assets/roboto-cyrillic-ext-500-normal.woff2 +0 -0
  78. package/dist/assets/roboto-cyrillic-ext-700-normal.woff +0 -0
  79. package/dist/assets/roboto-cyrillic-ext-700-normal.woff2 +0 -0
  80. package/dist/assets/roboto-cyrillic-ext-900-normal.woff +0 -0
  81. package/dist/assets/roboto-cyrillic-ext-900-normal.woff2 +0 -0
  82. package/dist/assets/roboto-greek-100-normal.woff +0 -0
  83. package/dist/assets/roboto-greek-100-normal.woff2 +0 -0
  84. package/dist/assets/roboto-greek-300-normal.woff +0 -0
  85. package/dist/assets/roboto-greek-300-normal.woff2 +0 -0
  86. package/dist/assets/roboto-greek-400-normal.woff +0 -0
  87. package/dist/assets/roboto-greek-400-normal.woff2 +0 -0
  88. package/dist/assets/roboto-greek-500-normal.woff +0 -0
  89. package/dist/assets/roboto-greek-500-normal.woff2 +0 -0
  90. package/dist/assets/roboto-greek-700-normal.woff +0 -0
  91. package/dist/assets/roboto-greek-700-normal.woff2 +0 -0
  92. package/dist/assets/roboto-greek-900-normal.woff +0 -0
  93. package/dist/assets/roboto-greek-900-normal.woff2 +0 -0
  94. package/dist/assets/roboto-latin-100-normal.woff +0 -0
  95. package/dist/assets/roboto-latin-100-normal.woff2 +0 -0
  96. package/dist/assets/roboto-latin-300-normal.woff +0 -0
  97. package/dist/assets/roboto-latin-300-normal.woff2 +0 -0
  98. package/dist/assets/roboto-latin-400-normal.woff +0 -0
  99. package/dist/assets/roboto-latin-400-normal.woff2 +0 -0
  100. package/dist/assets/roboto-latin-500-normal.woff +0 -0
  101. package/dist/assets/roboto-latin-500-normal.woff2 +0 -0
  102. package/dist/assets/roboto-latin-700-normal.woff +0 -0
  103. package/dist/assets/roboto-latin-700-normal.woff2 +0 -0
  104. package/dist/assets/roboto-latin-900-normal.woff +0 -0
  105. package/dist/assets/roboto-latin-900-normal.woff2 +0 -0
  106. package/dist/assets/roboto-latin-ext-100-normal.woff +0 -0
  107. package/dist/assets/roboto-latin-ext-100-normal.woff2 +0 -0
  108. package/dist/assets/roboto-latin-ext-300-normal.woff +0 -0
  109. package/dist/assets/roboto-latin-ext-300-normal.woff2 +0 -0
  110. package/dist/assets/roboto-latin-ext-400-normal.woff +0 -0
  111. package/dist/assets/roboto-latin-ext-400-normal.woff2 +0 -0
  112. package/dist/assets/roboto-latin-ext-500-normal.woff +0 -0
  113. package/dist/assets/roboto-latin-ext-500-normal.woff2 +0 -0
  114. package/dist/assets/roboto-latin-ext-700-normal.woff +0 -0
  115. package/dist/assets/roboto-latin-ext-700-normal.woff2 +0 -0
  116. package/dist/assets/roboto-latin-ext-900-normal.woff +0 -0
  117. package/dist/assets/roboto-latin-ext-900-normal.woff2 +0 -0
  118. package/dist/assets/roboto-vietnamese-100-normal.woff +0 -0
  119. package/dist/assets/roboto-vietnamese-100-normal.woff2 +0 -0
  120. package/dist/assets/roboto-vietnamese-300-normal.woff +0 -0
  121. package/dist/assets/roboto-vietnamese-300-normal.woff2 +0 -0
  122. package/dist/assets/roboto-vietnamese-400-normal.woff +0 -0
  123. package/dist/assets/roboto-vietnamese-400-normal.woff2 +0 -0
  124. package/dist/assets/roboto-vietnamese-500-normal.woff +0 -0
  125. package/dist/assets/roboto-vietnamese-500-normal.woff2 +0 -0
  126. package/dist/assets/roboto-vietnamese-700-normal.woff +0 -0
  127. package/dist/assets/roboto-vietnamese-700-normal.woff2 +0 -0
  128. package/dist/assets/roboto-vietnamese-900-normal.woff +0 -0
  129. package/dist/assets/roboto-vietnamese-900-normal.woff2 +0 -0
  130. package/dist/assets/types/select.item.type.js +1 -0
  131. package/dist/assets/ui/Icon.ui.js +1 -0
  132. package/dist/assets/ui/IconButton.ui.js +1 -0
  133. package/dist/assets/ui/Textbox.ui.js +1 -0
  134. package/dist/assets/ui/accordion.ui.js +1 -0
  135. package/dist/assets/ui/button.ui.js +1 -0
  136. package/dist/assets/ui/buttonColor.ui.js +1 -0
  137. package/dist/assets/ui/buttonmenu.ui.js +1 -0
  138. package/dist/assets/ui/buttonstack.ui.js +1 -0
  139. package/dist/assets/ui/checkbox.ui.js +1 -0
  140. package/dist/assets/ui/container.ui.js +1 -0
  141. package/dist/assets/ui/datagrid.ui.js +1 -0
  142. package/dist/assets/ui/dialog.js +1 -0
  143. package/dist/assets/ui/draggable.ui.js +1 -0
  144. package/dist/assets/ui/hpanel.ui.js +1 -0
  145. package/dist/assets/ui/iconButtonMenu.ui.js +1 -0
  146. package/dist/assets/ui/image.ui.js +1 -0
  147. package/dist/assets/ui/label.ui.js +1 -0
  148. package/dist/assets/ui/loading.ui.js +1 -0
  149. package/dist/assets/ui/menu.ui.js +1 -0
  150. package/dist/assets/ui/progressbar.ui.js +1 -0
  151. package/dist/assets/ui/radiobutton.ui.js +1 -0
  152. package/dist/assets/ui/scroll.ui.js +1 -0
  153. package/dist/assets/ui/select.ui.js +1 -0
  154. package/dist/assets/ui/styles/accordion.css +1 -0
  155. package/dist/assets/ui/styles/button.css +1 -0
  156. package/dist/assets/ui/styles/buttoncolor.css +1 -0
  157. package/dist/assets/ui/styles/container.css +1 -0
  158. package/dist/assets/ui/styles/datagrid.css +1 -0
  159. package/dist/assets/ui/styles/dialog.css +1 -0
  160. package/dist/assets/ui/styles/draggable.css +1 -0
  161. package/dist/assets/ui/styles/hpanel.css +1 -0
  162. package/dist/assets/ui/styles/icon.css +1 -0
  163. package/dist/assets/ui/styles/image.css +1 -0
  164. package/dist/assets/ui/styles/label.css +1 -0
  165. package/dist/assets/ui/styles/loading.css +1 -0
  166. package/dist/assets/ui/styles/main.css +1 -0
  167. package/dist/assets/ui/styles/menu.css +1 -0
  168. package/dist/assets/ui/styles/progressbar.css +1 -0
  169. package/dist/assets/ui/styles/scroll.css +1 -0
  170. package/dist/assets/ui/styles/select.css +1 -0
  171. package/dist/assets/ui/styles/stackbutton.css +1 -0
  172. package/dist/assets/ui/styles/tabs.css +1 -0
  173. package/dist/assets/ui/styles/textarea.css +1 -0
  174. package/dist/assets/ui/styles/textbox.css +1 -0
  175. package/dist/assets/ui/styles/toolbar.css +1 -0
  176. package/dist/assets/ui/styles/valuebar.css +1 -0
  177. package/dist/assets/ui/styles/vpanel.css +1 -0
  178. package/dist/assets/ui/styles/vstackbutton.css +1 -0
  179. package/dist/assets/ui/switch.ui.js +1 -0
  180. package/dist/assets/ui/tabs.ui.js +1 -0
  181. package/dist/assets/ui/textarea.ui.js +1 -0
  182. package/dist/assets/ui/toggle.ui.js +1 -0
  183. package/dist/assets/ui/toolbar.ui.js +1 -0
  184. package/dist/assets/ui/valuebar.ui.js +1 -0
  185. package/dist/assets/ui/vpanel.ui.js +1 -0
  186. package/dist/assets/ui/widget.builder.js +1 -0
  187. package/dist/assets/ui/widget.collection.js +1 -0
  188. package/dist/assets/ui/widget.ui.js +1 -0
  189. package/dist/cedro-logo.png +0 -0
  190. package/dist/cedro-logo.svg +97 -0
  191. package/dist/fangio.jpg +0 -0
  192. package/dist/material-icons-list.json/357/200/272Zone.Identifier +3 -0
  193. package/package.json +4 -2
  194. package/src/core/application.builder.tsx +122 -60
  195. package/src/core/application.core.tsx +110 -11
  196. package/src/core/themes.core.ts +160 -1
  197. package/src/core/uid.ts +3 -3
  198. package/src/interfaces/application.interface.ts +3 -2
  199. package/src/interfaces/widget.interface.ts +3 -0
  200. package/src/types/select.item.type.ts +11 -0
  201. package/src/ui/Icon.ui.tsx +158 -0
  202. package/src/ui/IconButton.ui.tsx +51 -9
  203. package/src/ui/{textbox.ui.tsx → Textbox.ui.tsx} +23 -15
  204. package/src/ui/accordion.ui.tsx +152 -0
  205. package/src/ui/button.ui.tsx +55 -14
  206. package/src/ui/buttonColor.ui.tsx +87 -0
  207. package/src/ui/buttonmenu.ui.tsx +133 -0
  208. package/src/ui/{buttonstack.ui.ts → buttonstack.ui.tsx} +67 -1
  209. package/src/ui/checkbox.ui.tsx +9 -13
  210. package/src/ui/container.ui.tsx +140 -76
  211. package/src/ui/datagrid.ui.tsx +514 -0
  212. package/src/ui/dialog.tsx +143 -56
  213. package/src/ui/hpanel.ui.tsx +37 -11
  214. package/src/ui/iconButtonMenu.ui.tsx +175 -0
  215. package/src/ui/image.ui.tsx +123 -112
  216. package/src/ui/index.ts +8 -8
  217. package/src/ui/label.ui.tsx +61 -3
  218. package/src/ui/loading.ui.ts +10 -10
  219. package/src/ui/menu.ui.ts +2 -2
  220. package/src/ui/progressbar.ui.tsx +9 -8
  221. package/src/ui/{radiobutton.tsx → radiobutton.ui.tsx} +9 -13
  222. package/src/ui/scroll.ui.ts +13 -12
  223. package/src/ui/select.ui.tsx +143 -0
  224. package/src/ui/styles/button.css +114 -32
  225. package/src/ui/styles/buttoncolor.css +8 -8
  226. package/src/ui/styles/container.css +29 -0
  227. package/src/ui/styles/icon.css +29 -0
  228. package/src/ui/styles/image.css +19 -19
  229. package/src/ui/styles/label.css +63 -0
  230. package/src/ui/styles/loading.css +12 -12
  231. package/src/ui/styles/main.css +5 -0
  232. package/src/ui/styles/progressbar.css +2 -1
  233. package/src/ui/styles/select.css +13 -0
  234. package/src/ui/styles/stackbutton.css +36 -0
  235. package/src/ui/styles/tabs.css +5 -7
  236. package/src/ui/styles/textarea.css +13 -13
  237. package/src/ui/switch.ui.tsx +9 -13
  238. package/src/ui/tabs.ui.tsx +43 -22
  239. package/src/ui/textarea.ui.tsx +48 -0
  240. package/src/ui/toolbar.ui.tsx +17 -12
  241. package/src/ui/valuebar.ui.tsx +11 -13
  242. package/src/ui/vpanel.ui.tsx +19 -13
  243. package/src/ui/widget.builder.ts +243 -159
  244. package/src/ui/widget.collection.ts +24 -2
  245. package/src/ui/widget.ui.ts +79 -19
  246. package/src/ui/Icon.ui.ts +0 -64
  247. package/src/ui/accordion.ui.ts +0 -71
  248. package/src/ui/buttonColor.ui.ts +0 -24
  249. package/src/ui/buttonmenu.ui.ts +0 -59
  250. package/src/ui/datagrid.ui.ts +0 -231
  251. package/src/ui/iconButtonMenu.ui.ts +0 -59
  252. package/src/ui/select.ui.ts +0 -73
  253. package/src/ui/textarea.ui.ts +0 -20
  254. /package/src/ui/{toggle.ui.ts → toggle.ui.tsx} +0 -0
@@ -1,3 +1,4 @@
1
+ import { UID } from "../core/uid";
1
2
  import { IWidget, WUIEvent, WUICallback } from "../interfaces/widget.interface";
2
3
  import { Vector2D } from "../types/vector2d.type";
3
4
  import { WidgetEventProps, WidgetProps } from "./widget.builder";
@@ -44,8 +45,12 @@ export class Widget implements IWidget {
44
45
  bodyTagName: string;
45
46
  body: HTMLElement;
46
47
 
47
- constructor(id: string, bodyTagName: string = "div", parent: IWidget | null = null) {
48
- this.id = id;
48
+ constructor(
49
+ id: string | null = "",
50
+ bodyTagName: string = "div",
51
+ parent: IWidget | null = null
52
+ ) {
53
+ this.id = id ? id : UID();
49
54
 
50
55
  this.overflow = false;
51
56
 
@@ -289,9 +294,8 @@ export class Widget implements IWidget {
289
294
  }
290
295
 
291
296
  if (freeStyle) {
292
- //this.body.style.position = "relative";
297
+ this.deleteClass("WUINonFreePosition");
293
298
  this.addClass("WUIFixPosition");
294
- //this.body.style.overflow = "auto";
295
299
  this.body.style.left = "";
296
300
  this.body.style.top = "";
297
301
  this.body.style.width = "";
@@ -301,8 +305,10 @@ export class Widget implements IWidget {
301
305
  this.body.style.right = "";
302
306
  } else {
303
307
  if (this.type === WidgetTypes.CUSTOM || this.type === WidgetTypes.FILL) {
304
- this.body.style.position = "absolute";
305
- this.body.style.overflow = "hidden";
308
+ // this.body.style.position = "absolute";
309
+ // this.body.style.overflow = "hidden";
310
+ this.deleteClass("WUIFixPosition");
311
+ this.addClass("WUINonFreePosition");
306
312
  }
307
313
  }
308
314
 
@@ -362,6 +368,8 @@ export class Widget implements IWidget {
362
368
  this.parent = parent;
363
369
  this.parent?.body.appendChild(this.body);
364
370
 
371
+ this.setType(this.type); //TODO: revisar, se coloca para tratar de que reconozca al padre como freestyle en caso de serlo.
372
+
365
373
  //this.parent?.addChild(this);
366
374
  }
367
375
 
@@ -596,6 +604,7 @@ export class Widget implements IWidget {
596
604
  public addChild(child: IWidget | null = null): void {
597
605
  if (!child) return;
598
606
  this.childs.push(child);
607
+
599
608
  child.setParent(this);
600
609
 
601
610
  child.init();
@@ -603,6 +612,17 @@ export class Widget implements IWidget {
603
612
  child.render();*/
604
613
  }
605
614
 
615
+ public populate(): void {
616
+ //se agrega a si mismo a window.w y a sus hijos.
617
+ if (!window.w.get(this.id)) {
618
+ window.w.set(this.id, this);
619
+ }
620
+
621
+ for (const child of this.childs) {
622
+ child.populate();
623
+ }
624
+ }
625
+
606
626
  /**
607
627
  * Disables the selection feature.
608
628
  *
@@ -638,9 +658,25 @@ export class Widget implements IWidget {
638
658
  * @return {type} description of return value
639
659
  */
640
660
  public init(): void {
641
- if (this.type !== WidgetTypes.FREE) {
642
- this.body.style.position = "absolute";
643
- this.body.style.overflow = "hidden";
661
+ let freeStyle = false;
662
+
663
+ if (this.type === WidgetTypes.FREE) {
664
+ freeStyle = true;
665
+ }
666
+
667
+ const parent = this.getParent();
668
+
669
+ if (parent) {
670
+ if (parent.type === WidgetTypes.FREE) {
671
+ freeStyle = true;
672
+ }
673
+ }
674
+
675
+ if (!freeStyle) {
676
+ this.deleteClass("WUIFixPosition");
677
+ this.addClass("WUINonFreePosition");
678
+ // this.body.style.position = "absolute";
679
+ // this.body.style.overflow = "hidden";
644
680
  }
645
681
 
646
682
  this.initPosition();
@@ -758,6 +794,12 @@ export class Widget implements IWidget {
758
794
  currentPosition += elementSize;
759
795
  child.render();
760
796
  }
797
+
798
+ this.subscribers.forEach((callback) => {
799
+ if (callback.event == "render") {
800
+ callback.then(new Event("render"), this);
801
+ }
802
+ });
761
803
  }
762
804
 
763
805
  /**
@@ -855,7 +897,13 @@ export class Widget implements IWidget {
855
897
  child.free();
856
898
  }
857
899
  }
900
+
858
901
  window.w.delete(this.id);
902
+
903
+ const body = this.getBody();
904
+ const parent = body.parentNode;
905
+ if (!parent && !body) return;
906
+ parent?.removeChild(body);
859
907
  }
860
908
 
861
909
  public dispose(): void {
@@ -877,12 +925,17 @@ export function getOnlyEventProps(props: WidgetProps): WidgetEventProps {
877
925
  onMouseOut: props.onMouseOut,
878
926
  onMouseLeave: props.onMouseLeave,
879
927
  onWheel: props.onWheel,
928
+ onRender: props.onRender,
880
929
  };
881
930
 
882
931
  return eventProps;
883
932
  }
884
933
 
885
- export function connectWidgetCallback(id: string, props: WidgetEventProps): void {
934
+ export function connectWidgetCallback(
935
+ id: string | null | undefined,
936
+ props: WidgetEventProps
937
+ ): void {
938
+ if (!id) return;
886
939
  connectWidget("widget-added-" + id, {
887
940
  event: "widget-load",
888
941
  then: (_e, _w) => {
@@ -892,63 +945,70 @@ export function connectWidgetCallback(id: string, props: WidgetEventProps): void
892
945
  widget.subscribe({
893
946
  event: "click",
894
947
  then: (_e, _w) => {
895
- props.onClick ? props.onClick() : null;
948
+ props.onClick ? props.onClick({}) : null;
896
949
  },
897
950
  });
898
951
 
899
952
  widget.subscribe({
900
953
  event: "drag",
901
954
  then: (_e, _w) => {
902
- props.onDrag ? props.onDrag() : null;
955
+ props.onDrag ? props.onDrag({}) : null;
903
956
  },
904
957
  });
905
958
 
906
959
  widget.subscribe({
907
960
  event: "resize",
908
961
  then: (_e, _w) => {
909
- props.onResize ? props.onResize() : null;
962
+ props.onResize ? props.onResize({}) : null;
910
963
  },
911
964
  });
912
965
 
913
966
  widget.subscribe({
914
967
  event: "mousedown",
915
968
  then: (_e, _w) => {
916
- props.onMouseDown ? props.onMouseDown() : null;
969
+ props.onMouseDown ? props.onMouseDown({}) : null;
917
970
  },
918
971
  });
919
972
 
920
973
  widget.subscribe({
921
974
  event: "mouseup",
922
975
  then: (_e, _w) => {
923
- props.onMouseUp ? props.onMouseUp() : null;
976
+ props.onMouseUp ? props.onMouseUp({}) : null;
924
977
  },
925
978
  });
926
979
 
927
980
  widget.subscribe({
928
981
  event: "mousemove",
929
982
  then: (_e, _w) => {
930
- props.onMouseMove ? props.onMouseMove() : null;
983
+ props.onMouseMove ? props.onMouseMove({}) : null;
931
984
  },
932
985
  });
933
986
 
934
987
  widget.subscribe({
935
988
  event: "mouseout",
936
989
  then: (_e, _w) => {
937
- props.onMouseOut ? props.onMouseOut() : null;
990
+ props.onMouseOut ? props.onMouseOut({}) : null;
938
991
  },
939
992
  });
940
993
 
941
994
  widget.subscribe({
942
995
  event: "mouseleave",
943
996
  then: (_e, _w) => {
944
- props.onMouseLeave ? props.onMouseLeave() : null;
997
+ props.onMouseLeave ? props.onMouseLeave({}) : null;
945
998
  },
946
999
  });
947
1000
 
948
1001
  widget.subscribe({
949
1002
  event: "wheel",
950
1003
  then: (_e, _w) => {
951
- props.onWheel ? props.onWheel() : null;
1004
+ props.onWheel ? props.onWheel({}) : null;
1005
+ },
1006
+ });
1007
+
1008
+ widget.subscribe({
1009
+ event: "render",
1010
+ then: (_e, _w) => {
1011
+ props.onRender ? props.onRender({}) : null;
952
1012
  },
953
1013
  });
954
1014
  }
package/src/ui/Icon.ui.ts DELETED
@@ -1,64 +0,0 @@
1
- import { Colors } from "./colors.ui";
2
- import { Widget } from "./widget.ui";
3
-
4
- export type IconVariants = "Filled" | "Outlined" | "Round" | "Sharp" | "Two Tone";
5
-
6
- export class Icon extends Widget {
7
- variant: IconVariants;
8
- color: Colors;
9
- icon: string;
10
-
11
- constructor(
12
- id: string,
13
- icon: string,
14
- variant: IconVariants = "Filled",
15
- parent: Widget | null = null
16
- ) {
17
- super(id, "span", parent);
18
-
19
- this.variant = variant;
20
- this.color = "primary";
21
- this.icon = icon;
22
-
23
- if (this.variant === "Filled") {
24
- this.addClass("material-icons");
25
- } else {
26
- this.addClass(
27
- "material-icons-" + this.variant.toString().replace(" ", "-").toLowerCase()
28
- );
29
- }
30
-
31
- this.setIcon(icon);
32
-
33
- this.init();
34
- }
35
-
36
- public init(): void {
37
- super.init();
38
- }
39
-
40
- setIcon(icon: string): void {
41
- this.icon = icon;
42
- this.body.innerHTML = icon;
43
- }
44
-
45
- setVariant(variant: IconVariants = "Filled"): void {
46
- this.variant = variant;
47
- }
48
-
49
- setColor(color: Colors = "primary"): void {
50
- this.color = color;
51
- }
52
-
53
- getVariant(): IconVariants {
54
- return this.variant;
55
- }
56
-
57
- getColor(): Colors {
58
- return this.color;
59
- }
60
-
61
- getIcon(): string {
62
- return this.icon;
63
- }
64
- }
@@ -1,71 +0,0 @@
1
- import "./styles/accordion.css";
2
- import { IconButton } from "./IconButton.ui";
3
- import { Label } from "./label.ui";
4
- import { Widget, WidgetTypes } from "./widget.ui";
5
-
6
- const ACCORDION_HEADER_HEIGHT = 40;
7
-
8
- type AccordionItem = {
9
- header: Widget;
10
- content: Widget;
11
- };
12
-
13
- export class Accordion extends Widget {
14
- items: Map<string, AccordionItem>;
15
- selectedItemId: string | null;
16
- constructor(id: string, parent: Widget | null = null) {
17
- super(id, "div", parent);
18
-
19
- this.items = new Map<string, AccordionItem>();
20
-
21
- this.selectedItemId = null;
22
-
23
- this.addClass("WUIAccordion");
24
- }
25
-
26
- public selectItem(id: string): void {
27
- const selected = this.items.get(id);
28
-
29
- if (this.selectedItemId !== null) {
30
- //deseleccionamos
31
- const previous = this.items.get(this.selectedItemId);
32
-
33
- if (previous) {
34
- previous.content.setFixedSize(0);
35
- }
36
- }
37
-
38
- if (selected) {
39
- this.selectedItemId = id;
40
- selected.content.setFixedSize(null);
41
- }
42
-
43
- this.render();
44
- }
45
-
46
- public addItem(title: string, icon: string, content: Widget): void {
47
- const header =
48
- icon !== ""
49
- ? new IconButton(content.id + ".header", icon, null)
50
- : new Label(content.id + ".header", "span", null);
51
-
52
- header.setType(WidgetTypes.FILL);
53
- header.setFixedSize(ACCORDION_HEADER_HEIGHT);
54
- header.setText(title);
55
-
56
- header.subscribe({
57
- event: "click",
58
- then: (_e, _w) => {
59
- this.selectItem(content.id);
60
- },
61
- });
62
-
63
- content.setType(WidgetTypes.FILL);
64
- content.setFixedSize(0);
65
-
66
- this.items.set(content.id, { header, content });
67
-
68
- this.addChild(header);
69
- this.addChild(content);
70
- }
71
- }
@@ -1,24 +0,0 @@
1
- import "./styles/buttoncolor.css";
2
- import { Button } from "./button.ui";
3
- import { Widget } from "./widget.ui";
4
-
5
- export class ButtonColor extends Button {
6
- inputColor: Widget;
7
- constructor(id: string, parent: Widget | null = null) {
8
- super(id, parent);
9
-
10
- this.inputColor = new Widget(id + ".inputColor", "input", this);
11
- this.inputColor.getBody().setAttribute("type", "color");
12
- this.inputColor.addClass("WUIButtonColorInput");
13
- }
14
-
15
- public setValue(value: string): void {
16
- this.inputColor.getBody().setAttribute("value", value);
17
- }
18
-
19
- public getValue(): string {
20
- const value = this.inputColor.getBody().getAttribute("value");
21
-
22
- return value ? value : "";
23
- }
24
- }
@@ -1,59 +0,0 @@
1
- import { Button } from "./button.ui";
2
- import { Menu } from "./menu.ui";
3
- import { SelectItem } from "./select.ui";
4
-
5
- export class ButtonMenu extends Button {
6
- menu: Menu;
7
- items: Array<SelectItem>;
8
- selectedItem: SelectItem | null;
9
-
10
- public constructor(id: string) {
11
- super(id);
12
-
13
- this.menu = new Menu(this.id + ".menu", this.id, null);
14
-
15
- this.items = new Array<SelectItem>();
16
- this.selectedItem = null;
17
-
18
- this.subscribe({
19
- event: "click",
20
- then: () => {
21
- this.menu.clearOptions();
22
- this.items.forEach((item) => {
23
- this.menu.addOption(item.id, item.icon, item.label);
24
- });
25
-
26
- this.menu.wakeUp();
27
-
28
- if (this.getW() > this.menu.getW()) {
29
- this.menu.setW(this.getBody().clientWidth);
30
- console.log("cambiando ancho...");
31
- }
32
- },
33
- });
34
-
35
- /*this.menu.subscribe({
36
- event: "option-clicked",
37
- then: (_e, clickedOption) => {
38
- const option = clickedOption as IconButton;
39
-
40
- const fintOption = this.items.find((item) => item.id === option.id);
41
-
42
- if (fintOption) {
43
- this.selectedItem = fintOption;
44
- }
45
-
46
- const selectedText = this.selectedItem?.label;
47
- if (selectedText) {
48
- this.setText(selectedText);
49
- } else {
50
- this.setText("");
51
- }
52
- },
53
- });*/
54
- }
55
-
56
- public addItem(id: string, label: string, icon: string): void {
57
- this.items.push(new SelectItem(id, label, icon));
58
- }
59
- }
@@ -1,231 +0,0 @@
1
- import "./styles/datagrid.css";
2
- import { Label } from "./label.ui";
3
- import { Widget, WidgetAlignTypes, WidgetTypes } from "./widget.ui";
4
- import { Scroll } from "./scroll.ui";
5
-
6
- const DATA_GRID_HEADER_HEIGHT = 30;
7
- const DATA_GRID_FOOTER_HEIGHT = 40;
8
- const DATA_GRID_ROW_HEIGHT = 20;
9
- const DATA_GRID_MIN_COLUMN_WIDTH = 24;
10
-
11
- type DataGridColumn = {
12
- header: string;
13
- width: number | null;
14
- handler: (args: any) => void;
15
- };
16
-
17
- export class DataGrid extends Widget {
18
- headerContainer: Widget;
19
- dataContainer: Widget;
20
- footerContainer: Widget;
21
- data: Array<any>;
22
- verticalScrollbar: Scroll;
23
- horizontalScrollbar: Scroll;
24
-
25
- rowHeight: number;
26
-
27
- columns: Array<DataGridColumn>;
28
-
29
- constructor(id: string, parent: Widget | null = null) {
30
- super(id, "div", parent);
31
-
32
- this.rowHeight = DATA_GRID_ROW_HEIGHT;
33
-
34
- this.headerContainer = new Widget(id + ".header", "div");
35
- this.headerContainer.setType(WidgetTypes.FILL);
36
- this.headerContainer.setFixedSize(DATA_GRID_HEADER_HEIGHT);
37
- this.headerContainer.addClass("WUIDataGrid-Header");
38
-
39
- this.dataContainer = new Widget(id + ".data", "div");
40
- this.dataContainer.setType(WidgetTypes.FILL);
41
-
42
- this.footerContainer = new Widget(id + ".footer", "div");
43
- this.footerContainer.setType(WidgetTypes.FILL);
44
- this.footerContainer.setFixedSize(DATA_GRID_FOOTER_HEIGHT);
45
-
46
- this.setType(WidgetTypes.FILL);
47
- this.setAlign(WidgetAlignTypes.VERTICAL);
48
-
49
- this.addChild(this.headerContainer);
50
- this.addChild(this.dataContainer);
51
- this.addChild(this.footerContainer);
52
-
53
- this.verticalScrollbar = new Scroll(id + ".VerticalScrollbar", this.dataContainer);
54
- this.horizontalScrollbar = new Scroll(
55
- id + ".HorizontalScrollbar",
56
- this.dataContainer,
57
- "horizontal"
58
- );
59
-
60
- this.columns = new Array<DataGridColumn>();
61
-
62
- this.data = new Array<any>();
63
-
64
- this.addClass("WUIDataGrid");
65
- }
66
-
67
- public hideFooter(): void {
68
- this.footerContainer.setFixedSize(0);
69
- }
70
-
71
- public showFooter(): void {
72
- this.footerContainer.setFixedSize(DATA_GRID_FOOTER_HEIGHT);
73
- }
74
-
75
- private getFreeWidth(): number {
76
- let freeW = 0;
77
- for (let i = 0; i < this.columns.length; i++) {
78
- let width = this.columns[i].width;
79
- if (width) {
80
- freeW += width;
81
- }
82
- }
83
-
84
- freeW = this.dataContainer.getW() - freeW;
85
-
86
- if (freeW < DATA_GRID_MIN_COLUMN_WIDTH) {
87
- freeW = DATA_GRID_MIN_COLUMN_WIDTH;
88
- }
89
- return freeW;
90
- }
91
-
92
- private getAllColumnsWidth(): number {
93
- let returnValue = 0;
94
- for (let i = 0; i < this.columns.length; i++) {
95
- let width = this.columns[i].width;
96
- if (width) {
97
- returnValue += width;
98
- }
99
- }
100
- return returnValue;
101
- }
102
-
103
- public init(): void {
104
- super.init();
105
-
106
- this.createHeaders();
107
- }
108
-
109
- private createHeaders(): void {
110
- if (!this.columns) {
111
- return;
112
- }
113
-
114
- for (let i = 0; i < this.columns.length; i++) {
115
- const btn = new Label(this.id + "header." + i, "span");
116
- btn.addClass("WUIDataGrid-HeaderLabel");
117
- this.headerContainer.addChild(btn);
118
- }
119
-
120
- this.buildRows();
121
- this.renderHeaders();
122
- }
123
-
124
- private renderHeaders(): void {
125
- if (!this.columns) {
126
- return;
127
- }
128
-
129
- let startX = 0;
130
- for (let i = 0; i < this.columns.length; i++) {
131
- const column = this.columns[i];
132
- const btn = window.w.get(this.id + "header." + i) as Label;
133
- const width = column.width ? column.width : this.getFreeWidth();
134
- btn.setType(WidgetTypes.CUSTOM);
135
- btn.setX(startX);
136
- btn.setY(0);
137
- btn.setW(width);
138
- btn.setH(DATA_GRID_HEADER_HEIGHT);
139
- btn.getBody().style.lineHeight = DATA_GRID_HEADER_HEIGHT + "px";
140
- btn.setText(column.header);
141
- this.headerContainer.addChild(btn);
142
- startX += width;
143
- }
144
- }
145
-
146
- private buildRows(): void {
147
- let rowY = 0;
148
-
149
- for (let i = 0; i < this.data.length; i++) {
150
- const row = new Widget(this.id + ".row." + i, "div");
151
-
152
- row.setType(WidgetTypes.CUSTOM);
153
- row.getBody().style.position = "absolute";
154
- row.getBody().style.overflow = "hidden";
155
- row.addClass("WUIDataGrid-Row");
156
-
157
- this.dataContainer.addChild(row);
158
-
159
- for (let j = 0; j < this.columns.length; j++) {
160
- const column = this.columns[j];
161
- const fieldId = this.id + ".row." + i + ".column." + j;
162
- column.handler({
163
- data: this.data[i],
164
- index: i,
165
- fieldId: fieldId,
166
- row: row,
167
- });
168
- const columnWidget = window.w.get(fieldId) as Widget;
169
- columnWidget.getBody().style.position = "absolute";
170
- }
171
- rowY += this.rowHeight;
172
- }
173
- }
174
-
175
- private renderRows(): void {
176
- let rowY = 0;
177
-
178
- for (let i = 0; i < this.data.length; i++) {
179
- const row = window.w.get(this.id + ".row." + i) as Widget;
180
-
181
- row.setX(0);
182
- row.setY(rowY);
183
- row.setW(this.getAllColumnsWidth());
184
- row.setH(this.rowHeight);
185
-
186
- let widgetX = 0;
187
- for (let j = 0; j < this.columns.length; j++) {
188
- const column = this.columns[j];
189
- const fieldId = this.id + ".row." + i + ".column." + j;
190
- const columnWidget = window.w.get(fieldId) as Widget;
191
- columnWidget.setY(0);
192
- columnWidget.setX(widgetX);
193
- columnWidget.setH(this.rowHeight);
194
- if (column.width) {
195
- columnWidget.setW(column.width);
196
- } else {
197
- columnWidget.setW(this.getFreeWidth());
198
- }
199
- widgetX += column.width ? column.width : columnWidget.getW();
200
- }
201
- rowY += this.rowHeight;
202
- }
203
- }
204
-
205
- public render(): void {
206
- super.render();
207
- this.renderHeaders();
208
- this.renderRows();
209
- this.verticalScrollbar.render();
210
- this.horizontalScrollbar.render();
211
- }
212
-
213
- public setRowHeight(rowHeight: number): void {
214
- this.rowHeight = rowHeight;
215
- }
216
-
217
- public addColumn(header: string, width: number | null, handler: (args: any) => void) {
218
- this.columns.push({ header, width, handler });
219
- }
220
-
221
- public getHeader(index: number): Label {
222
- return window.w.get(this.id + "header." + index) as Label;
223
- }
224
-
225
- public setData(data: Array<any>): void {
226
- this.data = data;
227
-
228
- this.buildRows();
229
- this.renderRows();
230
- }
231
- }