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
package/src/ui/dialog.tsx CHANGED
@@ -1,7 +1,10 @@
1
+ import { UID } from "../core/uid";
1
2
  import { WUICallback } from "../interfaces/widget.interface";
2
3
  import { Button } from "./button.ui";
4
+ import { Spacer } from "./container.ui";
3
5
  import { Label } from "./label.ui";
4
6
  import "./styles/dialog.css";
7
+ import { createWidget, normalizeWidget, WidgetProps } from "./widget.builder";
5
8
  import { Widget, WidgetAlignTypes, WidgetTypes } from "./widget.ui";
6
9
 
7
10
  const TITLE_BAR_HEIGHT = 40;
@@ -34,6 +37,9 @@ export class Dialog extends Widget {
34
37
  draging: boolean;
35
38
  resizing: boolean;
36
39
 
40
+ startX: number;
41
+ startY: number;
42
+
37
43
  constructor(
38
44
  id: string,
39
45
  parent: Widget | null = null,
@@ -42,6 +48,9 @@ export class Dialog extends Widget {
42
48
  ) {
43
49
  super(id, "div", parent);
44
50
 
51
+ this.startX = -1;
52
+ this.startY = -1;
53
+
45
54
  this.buttonContainer = null;
46
55
  this.handlerResizable = null;
47
56
 
@@ -71,23 +80,11 @@ export class Dialog extends Widget {
71
80
  this.setType(WidgetTypes.CUSTOM);
72
81
  this.setAlign(WidgetAlignTypes.VERTICAL);
73
82
 
74
- this.titleContainer = new Widget(
75
- this.id + ".titleContainer",
76
- "div",
77
- this
78
- );
79
- this.contentCntainer = new Widget(
80
- this.id + ".contentCntainer",
81
- "div",
82
- this
83
- );
83
+ this.titleContainer = new Widget(this.id + ".titleContainer", "div", null);
84
+ this.contentCntainer = new Widget(this.id + ".contentCntainer", "div", null);
84
85
 
85
86
  if (hasButtons) {
86
- this.buttonContainer = new Widget(
87
- this.id + ".buttonContainer",
88
- "div",
89
- this
90
- );
87
+ this.buttonContainer = new Widget(this.id + ".buttonContainer", "div", null);
91
88
 
92
89
  this.buttonContainer.setType(WidgetTypes.FILL);
93
90
  this.buttonContainer.setAlign(WidgetAlignTypes.HORIZONTAL);
@@ -96,11 +93,7 @@ export class Dialog extends Widget {
96
93
  }
97
94
 
98
95
  if (resizable) {
99
- this.handlerResizable = new Widget(
100
- this.id + ".handlerResizable",
101
- "div",
102
- this
103
- );
96
+ this.handlerResizable = new Widget(this.id + ".handlerResizable", "div", this);
104
97
  this.handlerResizable.setType(WidgetTypes.CUSTOM);
105
98
  this.handlerResizable.getBody().innerHTML = " ";
106
99
  this.handlerResizable.addClass("WUIDialogResizeHandler");
@@ -117,55 +110,37 @@ export class Dialog extends Widget {
117
110
 
118
111
  this.titleContainer.setFixedSize(TITLE_BAR_HEIGHT);
119
112
 
120
- this.titleBar = new Label(
121
- this.id + ".titleBar",
122
- "span",
123
- this.titleContainer
124
- );
113
+ this.titleBar = new Label(this.id + ".titleBar", "span", null);
125
114
  this.titleBar.setType(WidgetTypes.FILL);
126
115
  this.titleBar.setText("Title");
127
116
  this.titleBar.addClass("WUITitlebar");
128
117
 
129
- this.close = new Button(this.id + ".close", this.titleContainer);
118
+ this.close = new Button(this.id + ".close", null);
130
119
  this.close.setType(WidgetTypes.FILL);
131
120
  this.close.setColor("primary");
132
121
  this.close.setVariant("text");
133
122
  this.close.setText("X");
134
123
  this.close.setFixedSize(40);
135
124
 
136
- this.btnSpacerLeft = new Widget(
137
- this.id + ".btnSpacerLeft",
138
- "div",
139
- this.buttonContainer
140
- );
141
- this.btnSpacerLeft.setType(WidgetTypes.FILL);
142
- this.btnSpacerLeft.setAlign(WidgetAlignTypes.HORIZONTAL);
143
-
144
125
  if (this.buttonContainer) {
145
- this.cancell = new Button(
146
- this.id + ".cancell",
147
- this.buttonContainer
148
- );
126
+ this.cancell = new Button(this.id + ".cancell", null);
149
127
  this.cancell.setType(WidgetTypes.FILL);
150
128
  this.cancell.setColor("error");
151
129
  this.cancell.setText("Cancel");
152
130
  this.cancell.setVariant("contained");
153
131
  this.cancell.setFixedSize(100);
154
132
 
155
- this.ok = new Button(this.id + ".ok", this.buttonContainer);
133
+ this.ok = new Button(this.id + ".ok", null);
156
134
  this.ok.setType(WidgetTypes.FILL);
157
135
  this.ok.setText("OK");
158
136
  this.ok.setVariant("contained");
159
137
  this.ok.setColor("success");
160
138
  this.ok.setFixedSize(100);
161
139
 
162
- this.btnSpacerRight = new Widget(
163
- this.id + ".btnSpacerRight",
164
- "div",
165
- this.buttonContainer
166
- );
167
- this.btnSpacerRight.setType(WidgetTypes.FILL);
168
- this.btnSpacerRight.setAlign(WidgetAlignTypes.HORIZONTAL);
140
+ this.buttonContainer.addChild(Spacer());
141
+ this.buttonContainer.addChild(this.cancell);
142
+ this.buttonContainer.addChild(this.ok);
143
+ this.buttonContainer.addChild(Spacer());
169
144
 
170
145
  this.ok.subscribe({
171
146
  event: "click",
@@ -256,12 +231,8 @@ export class Dialog extends Widget {
256
231
  if (!this.handlerResizable) return;
257
232
  const mouseX = (e as MouseEvent).clientX;
258
233
  const mouseY = (e as MouseEvent).clientY;
259
- this.dragDistX = Math.abs(
260
- this.handlerResizable.getPosition().x - mouseX
261
- );
262
- this.dragDistY = Math.abs(
263
- this.handlerResizable.getPosition().y - mouseY
264
- );
234
+ this.dragDistX = Math.abs(this.handlerResizable.getPosition().x - mouseX);
235
+ this.dragDistY = Math.abs(this.handlerResizable.getPosition().y - mouseY);
265
236
 
266
237
  this.resizing = true;
267
238
  this.background.setVisible(true);
@@ -272,6 +243,13 @@ export class Dialog extends Widget {
272
243
  });
273
244
  }
274
245
 
246
+ this.titleContainer.addChild(this.titleBar);
247
+ this.titleContainer.addChild(this.close);
248
+
249
+ this.addChild(this.titleContainer);
250
+ this.addChild(this.contentCntainer);
251
+ if (hasButtons) this.addChild(this.buttonContainer);
252
+
275
253
  this.init();
276
254
  }
277
255
 
@@ -322,7 +300,13 @@ export class Dialog extends Widget {
322
300
  this.deleteClass("WUIDialogHide");
323
301
  this.addClass("WUIDialogDisplayed");
324
302
  this.render();
325
- this.center();
303
+
304
+ if (this.startX > 0 && this.startY > 0) {
305
+ this.setX(this.startX);
306
+ this.setY(this.startY);
307
+ } else {
308
+ this.center();
309
+ }
326
310
 
327
311
  this.background.setVisible(true);
328
312
  this.background.raisteTop();
@@ -345,7 +329,7 @@ export class Dialog extends Widget {
345
329
  this.raiseBottom();
346
330
  }
347
331
 
348
- init() {
332
+ public init() {
349
333
  super.init();
350
334
  }
351
335
 
@@ -354,7 +338,7 @@ export class Dialog extends Widget {
354
338
  *
355
339
  * @param {number} height - The height of the title bar.
356
340
  */
357
- setTitlebarHeight(height: number) {
341
+ public setTitlebarHeight(height: number) {
358
342
  this.titleBarHeight = height;
359
343
  }
360
344
 
@@ -363,7 +347,7 @@ export class Dialog extends Widget {
363
347
  *
364
348
  * @param {number} height - The height of the button bar.
365
349
  */
366
- setButtonbarHeight(height: number) {
350
+ public setButtonbarHeight(height: number) {
367
351
  this.buttonBarHeight = height;
368
352
  }
369
353
 
@@ -395,4 +379,107 @@ export class Dialog extends Widget {
395
379
  if (!this.cancell) return;
396
380
  this.cancell.subscribe({ event: "click", then: cb.then });
397
381
  }
382
+
383
+ public setStartX(x: number): void {
384
+ this.startX = x;
385
+ }
386
+
387
+ public setStartY(y: number): void {
388
+ this.startY = y;
389
+ }
390
+ }
391
+
392
+ export type WDialogProps = Omit<WidgetProps, "orientation" | "hidden"> & {
393
+ hasButtons?: boolean;
394
+ resizable?: boolean;
395
+ visible?: boolean;
396
+ titleBarHeight?: number;
397
+ buttonBarHeight?: number;
398
+ positionX?: number;
399
+ positionY?: number;
400
+ width?: number;
401
+ height?: number;
402
+ children: any;
403
+ };
404
+
405
+ export const WDialog = (props: WDialogProps) => {
406
+ if (!props.id) {
407
+ props.id = "Dialog." + UID();
408
+ }
409
+
410
+ return normalizeWidget(
411
+ <div
412
+ id={props.id}
413
+ w-dialog
414
+ w-position-x={props.positionX}
415
+ w-position-y={props.positionY}
416
+ w-dialog-width={props.width}
417
+ w-dialog-height={props.height}
418
+ w-has-buttons={props.hasButtons}
419
+ w-resizable={props.resizable}
420
+ w-visible={props.visible}
421
+ w-titlebar-height={props.titleBarHeight}
422
+ w-buttonbar-height={props.buttonBarHeight}
423
+ >
424
+ {props.children}
425
+ </div>,
426
+ props
427
+ );
428
+ };
429
+
430
+ export function createDialog(id: string, content: any, _parent: Widget | null = null): Dialog {
431
+ const dataHasButtons = content.getAttribute("w-has-buttons") ? true : false;
432
+ const dataResizable = content.getAttribute("w-resizable") ? true : false;
433
+ const dataVisible = content.getAttribute("w-visible") ? true : false;
434
+ const dataTitlebarHeight = content.getAttribute("w-titlebar-height")
435
+ ? parseInt(content.getAttribute("w-titlebar-height"))
436
+ : null;
437
+ const dataButtonbarHeight = content.getAttribute("w-buttonbar-height")
438
+ ? parseInt(content.getAttribute("w-buttonbar-height"))
439
+ : null;
440
+
441
+ const dataPositionX = content.getAttribute("w-position-x")
442
+ ? parseInt(content.getAttribute("w-position-x"))
443
+ : null;
444
+
445
+ const dataPositionY = content.getAttribute("w-position-y")
446
+ ? parseInt(content.getAttribute("w-position-y"))
447
+ : null;
448
+
449
+ const dataWidth = content.getAttribute("w-dialog-width")
450
+ ? parseInt(content.getAttribute("w-dialog-width"))
451
+ : null;
452
+
453
+ const dataHeight = content.getAttribute("w-dialog-height")
454
+ ? parseInt(content.getAttribute("w-dialog-height"))
455
+ : null;
456
+
457
+ let newDialog = new Dialog(id, null, dataHasButtons, dataResizable);
458
+
459
+ if (dataTitlebarHeight !== null) newDialog.setTitlebarHeight(dataTitlebarHeight);
460
+ if (dataButtonbarHeight !== null) newDialog.setButtonbarHeight(dataButtonbarHeight);
461
+ if (dataPositionX !== null) newDialog.setStartX(dataPositionX);
462
+ if (dataPositionY !== null) newDialog.setStartY(dataPositionY);
463
+ if (dataHeight !== null) newDialog.setY(dataHeight);
464
+ if (dataWidth !== null) newDialog.setW(dataWidth);
465
+
466
+ if (content.childNodes.length > 1) {
467
+ throw new Error("Dialog must have only one child");
468
+ }
469
+
470
+ const childWidget = content.firstChild;
471
+
472
+ if (childWidget !== null) {
473
+ const widget = createWidget(childWidget);
474
+ if (widget) {
475
+ newDialog.getContentCntainer().setPadding(0);
476
+ newDialog.getContentCntainer().attachWidget(widget);
477
+ }
478
+ }
479
+
480
+ if (dataVisible) newDialog.show();
481
+
482
+ newDialog.background.setVisible(false);
483
+
484
+ return newDialog;
398
485
  }
@@ -1,7 +1,14 @@
1
+ import { UID } from "../core/uid";
1
2
  import { Draggable } from "./draggable.ui";
2
3
  import "./styles/hpanel.css";
3
- import { WidgetProps, createWidget } from "./widget.builder";
4
- import { Widget, WidgetAlignTypes, WidgetTypes } from "./widget.ui";
4
+ import { WidgetProps, createWidget, normalizeWidget } from "./widget.builder";
5
+ import {
6
+ connectWidgetCallback,
7
+ getOnlyEventProps,
8
+ Widget,
9
+ WidgetAlignTypes,
10
+ WidgetTypes,
11
+ } from "./widget.ui";
5
12
 
6
13
  const HPANEL_HANDLER_SIZE = 4;
7
14
 
@@ -101,6 +108,16 @@ export class HPanel extends Widget {
101
108
  this.render();
102
109
  }
103
110
 
111
+ public setLeftWidth(width: number): void {
112
+ this.leftWidth = width;
113
+ this.rightWidth = null;
114
+ }
115
+
116
+ public setRightWidth(width: number): void {
117
+ this.leftWidth = null;
118
+ this.rightWidth = width;
119
+ }
120
+
104
121
  public render(): void {
105
122
  super.render();
106
123
  this.handler.setW(HPANEL_HANDLER_SIZE);
@@ -125,6 +142,14 @@ export class HPanel extends Widget {
125
142
 
126
143
  this.handler.setY(this.getY(true));
127
144
  }
145
+
146
+ public free(): void {
147
+ this.handler.free();
148
+ this.leftContent?.free();
149
+ this.rightContent?.free();
150
+ //this.draggable.free();
151
+ super.free();
152
+ }
128
153
  }
129
154
 
130
155
  export type WHPanelProps = WidgetProps & {
@@ -132,16 +157,17 @@ export type WHPanelProps = WidgetProps & {
132
157
  };
133
158
 
134
159
  export const WHPanel = (props: WHPanelProps) => {
135
- return (
136
- <div
137
- w-hpanel
138
- w-class={props.classNames}
139
- w-fixed-size={props.fixedSize}
140
- w-padding={props.padding}
141
- w-type={props.type}
142
- >
160
+ if (!props.id) {
161
+ props.id = "Icon." + UID();
162
+ }
163
+
164
+ connectWidgetCallback(props.id, getOnlyEventProps(props));
165
+
166
+ return normalizeWidget(
167
+ <div id={props.id} w-hpanel>
143
168
  {props.children}
144
- </div>
169
+ </div>,
170
+ props
145
171
  );
146
172
  };
147
173
 
@@ -0,0 +1,175 @@
1
+ import { IconButton, wIconButtonProps } from "./IconButton.ui";
2
+ import { Menu } from "./menu.ui";
3
+ import { SelectItem } from "../types/select.item.type";
4
+ import { normalizeWidget, WidgetProps } from "./widget.builder";
5
+ import { connectWidgetCallback, getOnlyEventProps, Widget } from "./widget.ui";
6
+ import { UID } from "../core/uid";
7
+ import { connectCustomWidget } from "./widget.collection";
8
+ import { IWidget } from "../interfaces/widget.interface";
9
+
10
+ export class IconButtonMenu extends IconButton {
11
+ menu: Menu;
12
+ items: Array<SelectItem>;
13
+ selectedItem: SelectItem | null;
14
+
15
+ whenOptionClicked: (args: any) => {} | void;
16
+
17
+ public constructor(id: string, icon: string) {
18
+ super(id, icon);
19
+
20
+ this.whenOptionClicked = () => {};
21
+
22
+ this.menu = new Menu(this.id + ".menu", this.id, null);
23
+
24
+ this.items = new Array<SelectItem>();
25
+ this.selectedItem = null;
26
+
27
+ this.subscribe({
28
+ event: "click",
29
+ then: () => {
30
+ this.menu.clearOptions();
31
+ this.items.forEach((item) => {
32
+ this.menu.addOption(item.id, item.icon, item.label);
33
+ });
34
+
35
+ this.menu.wakeUp();
36
+
37
+ if (this.getW() > this.menu.getW()) {
38
+ this.menu.setW(this.getBody().clientWidth);
39
+ }
40
+ },
41
+ });
42
+
43
+ this.menu.subscribe({
44
+ event: "option-clicked",
45
+ then: (_e, clickedOption) => {
46
+ const option = clickedOption as IconButton;
47
+ const fintOption = this.items.find((item) => item.id === option.id);
48
+
49
+ if (fintOption) {
50
+ this.selectedItem = fintOption;
51
+ this.whenOptionClicked({ id: fintOption.id });
52
+ }
53
+
54
+ // const selectedText = this.selectedItem?.label;
55
+ // if (selectedText) {
56
+ // this.setText(selectedText);
57
+ // } else {
58
+ // this.setText("");
59
+ // }
60
+ },
61
+ });
62
+ }
63
+
64
+ public setOnOptionClicked(cb: ({}) => {} | void) {
65
+ this.whenOptionClicked = cb;
66
+ }
67
+
68
+ public addItem(id: string, label: string, icon: string): void {
69
+ this.items.push(new SelectItem(id, label, icon));
70
+ }
71
+ }
72
+
73
+ export type WIconButtonMenuProps = WidgetProps &
74
+ wIconButtonProps & {
75
+ icon?: string | null;
76
+ onOptionClicked?: (args: any) => {} | void;
77
+ children: any;
78
+ };
79
+
80
+ export type WIconButtonMenuItemProps = {
81
+ id: string;
82
+ label?: string | null;
83
+ icon?: string | null;
84
+ };
85
+
86
+ export const WIconButtonMenu = (props: WIconButtonMenuProps) => {
87
+ if (!props.id) {
88
+ props.id = "IconButtonMenu." + UID();
89
+ }
90
+
91
+ connectWidgetCallback(props.id, getOnlyEventProps(props));
92
+
93
+ connectCustomWidget("widget-custom-added-" + props.id, {
94
+ event: "widget-load",
95
+ then: (_e: Event, _w: IWidget | null) => {
96
+ if (!props.id) return;
97
+ const widget = w.get(props.id) as IconButtonMenu;
98
+
99
+ if (props.onOptionClicked) {
100
+ widget.setOnOptionClicked(props.onOptionClicked);
101
+ }
102
+ },
103
+ });
104
+
105
+ return normalizeWidget(
106
+ <div
107
+ id={props.id}
108
+ w-icon-button-menu
109
+ w-text={props.text}
110
+ w-icon={props.icon}
111
+ w-variant={props.variant}
112
+ w-color={props.color}
113
+ w-width={props.width}
114
+ w-height={props.height}
115
+ >
116
+ {props.children}
117
+ </div>,
118
+ props
119
+ );
120
+ };
121
+
122
+ export const WIconButtonMenuItem = (props: WIconButtonMenuItemProps) => {
123
+ return (
124
+ <div w-icon-button-menu-item id={props.id} w-label={props.label} w-icon={props.icon}></div>
125
+ );
126
+ };
127
+
128
+ export function createIconButtonMenu(
129
+ id: string,
130
+ content: any,
131
+ _parent: Widget | null = null
132
+ ): IconButtonMenu {
133
+ const btnIcon = content.getAttribute("w-icon");
134
+ const btnText = content.getAttribute("w-text");
135
+ const btnColor = content.getAttribute("w-color");
136
+ const btnVariant = content.getAttribute("w-variant");
137
+ const dataWidth = content.getAttribute("w-width");
138
+ const dataHeight = content.getAttribute("w-height");
139
+
140
+ let newIconButtonMenu = new IconButtonMenu(id, btnIcon || "home");
141
+
142
+ if (btnText) {
143
+ newIconButtonMenu.setText(btnText);
144
+ }
145
+
146
+ if (btnColor) {
147
+ newIconButtonMenu.setColor(btnColor);
148
+ }
149
+
150
+ if (btnVariant) {
151
+ newIconButtonMenu.setVariant(btnVariant);
152
+ }
153
+
154
+ if (dataWidth) {
155
+ newIconButtonMenu.setInitialW(dataWidth);
156
+ }
157
+
158
+ if (dataHeight) {
159
+ newIconButtonMenu.setInitialH(dataHeight);
160
+ }
161
+
162
+ content.childNodes.forEach((menuItem: HTMLElement, index: number) => {
163
+ if (menuItem.getAttribute("w-icon-button-menu-item") !== null) {
164
+ const itemId = menuItem.getAttribute("id");
165
+ const itemLabel = menuItem.getAttribute("w-label");
166
+ const itemIcon = menuItem.getAttribute("w-icon");
167
+
168
+ if (itemId !== null) {
169
+ newIconButtonMenu.addItem(itemId, itemLabel || "Unnamed" + index, itemIcon || "");
170
+ }
171
+ }
172
+ });
173
+
174
+ return newIconButtonMenu;
175
+ }