jpf 4.2.18 → 5.0.6

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 (292) hide show
  1. package/dist/controls/codeMirror/Editor/Editor.d.ts +19 -0
  2. package/dist/controls/codeMirror/Editor/Editor.js +151 -0
  3. package/dist/controls/codeMirror/Editor/Editor.js.map +1 -0
  4. package/dist/controls/codeMirror/index.d.ts +1 -2
  5. package/dist/controls/codeMirror/index.js +1 -2
  6. package/dist/controls/codeMirror/index.js.map +1 -1
  7. package/dist/controls/custom/FileSelector/FileSelector.d.ts +18 -18
  8. package/dist/controls/custom/FileSelector/FileSelector.js +47 -46
  9. package/dist/controls/custom/FileSelector/FileSelector.js.map +1 -1
  10. package/dist/controls/custom/LabeledControl/LabeledControl.d.ts +15 -15
  11. package/dist/controls/custom/LabeledControl/LabeledControl.js +31 -36
  12. package/dist/controls/custom/LabeledControl/LabeledControl.js.map +1 -1
  13. package/dist/controls/custom/ListItem/ListItem.d.ts +37 -36
  14. package/dist/controls/custom/ListItem/ListItem.js +62 -62
  15. package/dist/controls/custom/ListItem/ListItem.js.map +1 -1
  16. package/dist/controls/custom/index.d.ts +3 -3
  17. package/dist/controls/custom/index.js +3 -3
  18. package/dist/controls/html/Button/Button.d.ts +16 -16
  19. package/dist/controls/html/Button/Button.js +47 -50
  20. package/dist/controls/html/Button/Button.js.map +1 -1
  21. package/dist/controls/html/Div/Div.d.ts +14 -14
  22. package/dist/controls/html/Div/Div.js +23 -24
  23. package/dist/controls/html/Div/Div.js.map +1 -1
  24. package/dist/controls/html/Image/Image.d.ts +16 -16
  25. package/dist/controls/html/Image/Image.js +29 -28
  26. package/dist/controls/html/Image/Image.js.map +1 -1
  27. package/dist/controls/html/Input/Input.d.ts +34 -34
  28. package/dist/controls/html/Input/Input.js +166 -170
  29. package/dist/controls/html/Input/Input.js.map +1 -1
  30. package/dist/controls/html/Select/Select.d.ts +30 -30
  31. package/dist/controls/html/Select/Select.js +109 -110
  32. package/dist/controls/html/Select/Select.js.map +1 -1
  33. package/dist/controls/html/Span/Span.d.ts +11 -11
  34. package/dist/controls/html/Span/Span.js +22 -22
  35. package/dist/controls/html/Span/Span.js.map +1 -1
  36. package/dist/controls/html/index.d.ts +6 -6
  37. package/dist/controls/html/index.js +6 -6
  38. package/dist/controls/index.d.ts +14 -14
  39. package/dist/controls/index.js +14 -14
  40. package/dist/controls/index.js.map +1 -1
  41. package/dist/controls/{jsonViewAwesome → jsonViewerAwesome}/index.d.ts +1 -1
  42. package/dist/controls/{jsonViewAwesome → jsonViewerAwesome}/index.js +1 -1
  43. package/dist/controls/jsonViewerAwesome/index.js.map +1 -0
  44. package/dist/controls/jsonViewerAwesome/jsonFormatter/JsonFormatter.d.ts +28 -0
  45. package/dist/controls/{jsonViewAwesome → jsonViewerAwesome}/jsonFormatter/JsonFormatter.js +65 -65
  46. package/dist/controls/jsonViewerAwesome/jsonFormatter/JsonFormatter.js.map +1 -0
  47. package/dist/controls/kendo/Chart/Chart.d.ts +19 -19
  48. package/dist/controls/kendo/Chart/Chart.js +62 -62
  49. package/dist/controls/kendo/Chart/Chart.js.map +1 -1
  50. package/dist/controls/kendo/Culture/Culture.d.ts +1 -1
  51. package/dist/controls/kendo/Culture/Culture.js +25 -25
  52. package/dist/controls/kendo/Culture/Culture.js.map +1 -1
  53. package/dist/controls/kendo/DataSource/DataSource.d.ts +4 -4
  54. package/dist/controls/kendo/DataSource/DataSource.js +1 -1
  55. package/dist/controls/kendo/Editor/Editor.d.ts +14 -19
  56. package/dist/controls/kendo/Editor/Editor.js +94 -104
  57. package/dist/controls/kendo/Editor/Editor.js.map +1 -1
  58. package/dist/controls/kendo/Grid/Grid.d.ts +54 -54
  59. package/dist/controls/kendo/Grid/Grid.js +201 -218
  60. package/dist/controls/kendo/Grid/Grid.js.map +1 -1
  61. package/dist/controls/kendo/Menu/Menu.d.ts +15 -15
  62. package/dist/controls/kendo/Menu/Menu.js +90 -90
  63. package/dist/controls/kendo/Menu/Menu.js.map +1 -1
  64. package/dist/controls/kendo/ObservableObject/ObservableObject.d.ts +0 -5
  65. package/dist/controls/kendo/ObservableObject/ObservableObject.js +0 -34
  66. package/dist/controls/kendo/ObservableObject/ObservableObject.js.map +1 -1
  67. package/dist/controls/kendo/Treeview/Treeview.d.ts +17 -0
  68. package/dist/controls/kendo/{Tree/Tree.js → Treeview/Treeview.js} +107 -107
  69. package/dist/controls/kendo/Treeview/Treeview.js.map +1 -0
  70. package/dist/controls/kendo/Window/Window.d.ts +14 -0
  71. package/dist/controls/kendo/{Dialog/Dialog.js → Window/Window.js} +49 -49
  72. package/dist/controls/kendo/Window/Window.js.map +1 -0
  73. package/dist/controls/kendo/index.d.ts +8 -9
  74. package/dist/controls/kendo/index.js +8 -9
  75. package/dist/controls/kendo/index.js.map +1 -1
  76. package/dist/controls/leaflet/LabelControl/LabelControl.d.ts +12 -12
  77. package/dist/controls/leaflet/LabelControl/LabelControl.js +33 -33
  78. package/dist/controls/leaflet/LabelControl/LabelControl.js.map +1 -1
  79. package/dist/controls/leaflet/Map/Map.d.ts +45 -45
  80. package/dist/controls/leaflet/Map/Map.js +116 -115
  81. package/dist/controls/leaflet/Map/Map.js.map +1 -1
  82. package/dist/controls/leaflet/OpenStreetMapTileLayer/OpenStreetMapTileLayer.d.ts +8 -8
  83. package/dist/controls/leaflet/OpenStreetMapTileLayer/OpenStreetMapTileLayer.js +13 -13
  84. package/dist/controls/leaflet/OpenStreetMapTileLayer/OpenStreetMapTileLayer.js.map +1 -1
  85. package/dist/controls/leaflet/PointerEvent/PointerEvent.d.ts +2 -2
  86. package/dist/controls/leaflet/PointerEvent/PointerEvent.js +7 -7
  87. package/dist/controls/leaflet/PointerEvent/PointerEvent.js.map +1 -1
  88. package/dist/controls/leaflet/index.d.ts +4 -4
  89. package/dist/controls/leaflet/index.js +4 -4
  90. package/dist/controls/svg/Circle/Circle.d.ts +12 -12
  91. package/dist/controls/svg/Circle/Circle.js +20 -20
  92. package/dist/controls/svg/Circle/Circle.js.map +1 -1
  93. package/dist/controls/svg/Ellipse/Ellipse.d.ts +13 -13
  94. package/dist/controls/svg/Ellipse/Ellipse.js +21 -21
  95. package/dist/controls/svg/Ellipse/Ellipse.js.map +1 -1
  96. package/dist/controls/svg/ForeignObject/ForeignObject.d.ts +15 -14
  97. package/dist/controls/svg/ForeignObject/ForeignObject.js +21 -22
  98. package/dist/controls/svg/ForeignObject/ForeignObject.js.map +1 -1
  99. package/dist/controls/svg/Group/Group.d.ts +15 -14
  100. package/dist/controls/svg/Group/Group.js +21 -22
  101. package/dist/controls/svg/Group/Group.js.map +1 -1
  102. package/dist/controls/svg/Line/Line.d.ts +13 -13
  103. package/dist/controls/svg/Line/Line.js +21 -21
  104. package/dist/controls/svg/Line/Line.js.map +1 -1
  105. package/dist/controls/svg/Pattern/Pattern.d.ts +22 -22
  106. package/dist/controls/svg/Pattern/Pattern.js +22 -23
  107. package/dist/controls/svg/Pattern/Pattern.js.map +1 -1
  108. package/dist/controls/svg/Polygon/Polygon.d.ts +11 -11
  109. package/dist/controls/svg/Polygon/Polygon.js +20 -20
  110. package/dist/controls/svg/Polygon/Polygon.js.map +1 -1
  111. package/dist/controls/svg/Polyline/Polyline.d.ts +11 -11
  112. package/dist/controls/svg/Polyline/Polyline.js +19 -19
  113. package/dist/controls/svg/Polyline/Polyline.js.map +1 -1
  114. package/dist/controls/svg/Rectangle/Rectangle.d.ts +13 -13
  115. package/dist/controls/svg/Rectangle/Rectangle.js +21 -21
  116. package/dist/controls/svg/Rectangle/Rectangle.js.map +1 -1
  117. package/dist/controls/svg/Svg/Svg.d.ts +17 -17
  118. package/dist/controls/svg/Svg/Svg.js +23 -24
  119. package/dist/controls/svg/Svg/Svg.js.map +1 -1
  120. package/dist/controls/svg/Text/Text.d.ts +14 -14
  121. package/dist/controls/svg/Text/Text.js +22 -22
  122. package/dist/controls/svg/Text/Text.js.map +1 -1
  123. package/dist/controls/svg/Title/Title.d.ts +10 -10
  124. package/dist/controls/svg/Title/Title.js +16 -16
  125. package/dist/controls/svg/Title/Title.js.map +1 -1
  126. package/dist/controls/svg/index.d.ts +13 -13
  127. package/dist/controls/svg/index.js +13 -13
  128. package/dist/controls/svg/svg.d.ts +6 -6
  129. package/dist/controls/svg/svg.js +12 -12
  130. package/dist/controls/svg/svg.js.map +1 -1
  131. package/dist/framework/attributes.d.ts +90 -90
  132. package/dist/framework/attributes.js +1 -1
  133. package/dist/framework/{View.d.ts → element.d.ts} +61 -62
  134. package/dist/framework/{View.js → element.js} +157 -150
  135. package/dist/framework/element.js.map +1 -0
  136. package/dist/framework/event.d.ts +80 -80
  137. package/dist/framework/event.js +25 -25
  138. package/dist/framework/event.js.map +1 -1
  139. package/dist/framework/observable.d.ts +37 -12
  140. package/dist/framework/observable.js +66 -58
  141. package/dist/framework/observable.js.map +1 -1
  142. package/dist/framework/properties.d.ts +40 -0
  143. package/dist/framework/{ViewModel.js → properties.js} +303 -312
  144. package/dist/framework/properties.js.map +1 -0
  145. package/dist/framework/root.d.ts +9 -0
  146. package/dist/framework/root.js +38 -0
  147. package/dist/framework/root.js.map +1 -0
  148. package/dist/framework/style.d.ts +657 -658
  149. package/dist/framework/style.js +146 -153
  150. package/dist/framework/style.js.map +1 -1
  151. package/dist/framework/types.d.ts +87 -87
  152. package/dist/framework/types.js +1 -1
  153. package/dist/index.d.ts +12 -12
  154. package/dist/index.js +12 -12
  155. package/dist/index.js.map +1 -1
  156. package/dist/utilities/blob/blob.d.ts +1 -1
  157. package/dist/utilities/blob/blob.js +17 -17
  158. package/dist/utilities/blob/blob.js.map +1 -1
  159. package/dist/utilities/contextMenu/contextMenu.d.ts +2 -0
  160. package/dist/utilities/contextMenu/contextMenu.js +11 -0
  161. package/dist/utilities/contextMenu/contextMenu.js.map +1 -0
  162. package/dist/utilities/cookie/cookie.d.ts +3 -3
  163. package/dist/utilities/cookie/cookie.js +26 -26
  164. package/dist/utilities/cookie/cookie.js.map +1 -1
  165. package/dist/utilities/dataReaderTable/dataReaderTable.d.ts +9 -9
  166. package/dist/utilities/dataReaderTable/dataReaderTable.js +23 -23
  167. package/dist/utilities/dataReaderTable/dataReaderTable.js.map +1 -1
  168. package/dist/utilities/fetch/fetch.d.ts +7 -8
  169. package/dist/utilities/fetch/fetch.js +139 -137
  170. package/dist/utilities/fetch/fetch.js.map +1 -1
  171. package/dist/utilities/float/float.d.ts +1 -1
  172. package/dist/utilities/float/float.js +3 -3
  173. package/dist/utilities/formData/formData.d.ts +1 -1
  174. package/dist/utilities/formData/formData.js +11 -11
  175. package/dist/utilities/formData/formData.js.map +1 -1
  176. package/dist/utilities/formatting/formatting.d.ts +4 -0
  177. package/dist/utilities/formatting/formatting.js +26 -0
  178. package/dist/utilities/formatting/formatting.js.map +1 -0
  179. package/dist/utilities/htmlElement/htmlElement.d.ts +1 -1
  180. package/dist/utilities/htmlElement/htmlElement.js +16 -16
  181. package/dist/utilities/htmlElement/htmlElement.js.map +1 -1
  182. package/dist/utilities/image/image.d.ts +1 -1
  183. package/dist/utilities/image/image.js +1 -1
  184. package/dist/utilities/index.d.ts +40 -36
  185. package/dist/utilities/index.js +40 -36
  186. package/dist/utilities/index.js.map +1 -1
  187. package/dist/utilities/integer/integer.d.ts +3 -3
  188. package/dist/utilities/integer/integer.js +27 -27
  189. package/dist/utilities/integer/integer.js.map +1 -1
  190. package/dist/utilities/key/key.d.ts +2 -2
  191. package/dist/utilities/key/key.js +6 -6
  192. package/dist/utilities/navigator/navigator.d.ts +1 -1
  193. package/dist/utilities/navigator/navigator.js +8 -8
  194. package/dist/utilities/navigator/navigator.js.map +1 -1
  195. package/dist/utilities/notification/notification.d.ts +5 -5
  196. package/dist/utilities/notification/notification.js +66 -66
  197. package/dist/utilities/notification/notification.js.map +1 -1
  198. package/dist/utilities/querystring/querystring.d.ts +6 -6
  199. package/dist/utilities/querystring/querystring.js +53 -53
  200. package/dist/utilities/querystring/querystring.js.map +1 -1
  201. package/dist/utilities/router/router.d.ts +19 -19
  202. package/dist/utilities/router/router.js +80 -80
  203. package/dist/utilities/router/router.js.map +1 -1
  204. package/dist/utilities/stylesheet/stylesheet.d.ts +2 -2
  205. package/dist/utilities/stylesheet/stylesheet.js +47 -47
  206. package/dist/utilities/stylesheet/stylesheet.js.map +1 -1
  207. package/dist/utilities/uniqueId/uniqueId.d.ts +1 -1
  208. package/dist/utilities/uniqueId/uniqueId.js +4 -4
  209. package/dist/{framework → utilities/userAgent}/userAgent.d.ts +31 -31
  210. package/dist/{framework → utilities/userAgent}/userAgent.js +46 -46
  211. package/dist/utilities/userAgent/userAgent.js.map +1 -0
  212. package/dist/utilities/webSocket/webSocket.d.ts +1 -1
  213. package/dist/utilities/webSocket/webSocket.js +54 -54
  214. package/dist/utilities/webSocket/webSocket.js.map +1 -1
  215. package/package.json +18 -14
  216. package/src/controls/codeMirror/Editor/Editor.ts +207 -0
  217. package/src/controls/codeMirror/index.ts +1 -2
  218. package/src/controls/custom/FileSelector/FileSelector.ts +30 -28
  219. package/src/controls/custom/LabeledControl/LabeledControl.ts +32 -36
  220. package/src/controls/custom/ListItem/ListItem.ts +36 -36
  221. package/src/controls/html/Button/Button.ts +36 -29
  222. package/src/controls/html/Div/Div.ts +20 -21
  223. package/src/controls/html/Image/Image.ts +22 -20
  224. package/src/controls/html/Input/Input.ts +59 -61
  225. package/src/controls/html/Select/Select.ts +37 -39
  226. package/src/controls/html/Span/Span.ts +14 -14
  227. package/src/controls/index.ts +2 -2
  228. package/src/controls/{jsonViewAwesome → jsonViewerAwesome}/jsonFormatter/JsonFormatter.ts +23 -23
  229. package/src/controls/kendo/Chart/Chart.ts +34 -34
  230. package/src/controls/kendo/DataSource/DataSource.ts +1 -1
  231. package/src/controls/kendo/Editor/Editor.ts +58 -68
  232. package/src/controls/kendo/Grid/Grid.ts +77 -80
  233. package/src/controls/kendo/Menu/Menu.ts +22 -22
  234. package/src/controls/kendo/ObservableObject/ObservableObject.ts +45 -45
  235. package/src/controls/kendo/{Tree/Tree.ts → Treeview/Treeview.ts} +15 -15
  236. package/src/controls/kendo/{Dialog/Dialog.ts → Window/Window.ts} +21 -19
  237. package/src/controls/kendo/index.ts +3 -3
  238. package/src/controls/leaflet/LabelControl/LabelControl.ts +10 -10
  239. package/src/controls/leaflet/Map/Map.ts +41 -38
  240. package/src/controls/leaflet/OpenStreetMapTileLayer/OpenStreetMapTileLayer.ts +3 -3
  241. package/src/controls/svg/Circle/Circle.ts +14 -14
  242. package/src/controls/svg/Ellipse/Ellipse.ts +15 -15
  243. package/src/controls/svg/ForeignObject/ForeignObject.ts +19 -20
  244. package/src/controls/svg/Group/Group.ts +19 -19
  245. package/src/controls/svg/Line/Line.ts +15 -15
  246. package/src/controls/svg/Pattern/Pattern.ts +25 -25
  247. package/src/controls/svg/Polygon/Polygon.ts +13 -13
  248. package/src/controls/svg/Polyline/Polyline.ts +13 -13
  249. package/src/controls/svg/Rectangle/Rectangle.ts +15 -15
  250. package/src/controls/svg/Svg/Svg.ts +19 -19
  251. package/src/controls/svg/Text/Text.ts +16 -16
  252. package/src/controls/svg/Title/Title.ts +12 -12
  253. package/src/controls/svg/svg.ts +4 -4
  254. package/src/framework/attributes.ts +46 -46
  255. package/src/framework/{View.ts → element.ts} +52 -39
  256. package/src/framework/event.ts +7 -7
  257. package/src/framework/observable.ts +94 -60
  258. package/src/framework/properties.ts +393 -0
  259. package/src/framework/root.ts +45 -0
  260. package/src/framework/style.ts +330 -340
  261. package/src/index.ts +4 -4
  262. package/src/utilities/contextMenu/contextMenu.ts +16 -0
  263. package/src/utilities/fetch/fetch.ts +16 -14
  264. package/src/utilities/formatting/formatting.ts +29 -0
  265. package/src/utilities/index.ts +7 -3
  266. package/src/utilities/router/router.ts +3 -3
  267. package/dist/controls/codeMirror/HtmlEditor/HtmlEditor.d.ts +0 -16
  268. package/dist/controls/codeMirror/HtmlEditor/HtmlEditor.js +0 -120
  269. package/dist/controls/codeMirror/HtmlEditor/HtmlEditor.js.map +0 -1
  270. package/dist/controls/codeMirror/JsonEditor/JsonEditor.d.ts +0 -16
  271. package/dist/controls/codeMirror/JsonEditor/JsonEditor.js +0 -104
  272. package/dist/controls/codeMirror/JsonEditor/JsonEditor.js.map +0 -1
  273. package/dist/controls/jsonViewAwesome/index.js.map +0 -1
  274. package/dist/controls/jsonViewAwesome/jsonFormatter/JsonFormatter.d.ts +0 -28
  275. package/dist/controls/jsonViewAwesome/jsonFormatter/JsonFormatter.js.map +0 -1
  276. package/dist/controls/kendo/Dialog/Dialog.d.ts +0 -14
  277. package/dist/controls/kendo/Dialog/Dialog.js.map +0 -1
  278. package/dist/controls/kendo/Tree/Tree.d.ts +0 -17
  279. package/dist/controls/kendo/Tree/Tree.js.map +0 -1
  280. package/dist/framework/View.js.map +0 -1
  281. package/dist/framework/ViewModel.d.ts +0 -42
  282. package/dist/framework/ViewModel.js.map +0 -1
  283. package/dist/framework/userAgent.js.map +0 -1
  284. package/dist/utilities/html/html.d.ts +0 -1
  285. package/dist/utilities/html/html.js +0 -8
  286. package/dist/utilities/html/html.js.map +0 -1
  287. package/src/controls/codeMirror/HtmlEditor/HtmlEditor.ts +0 -153
  288. package/src/controls/codeMirror/JsonEditor/JsonEditor.ts +0 -136
  289. package/src/framework/ViewModel.ts +0 -528
  290. package/src/utilities/html/html.ts +0 -8
  291. /package/src/controls/{jsonViewAwesome → jsonViewerAwesome}/index.ts +0 -0
  292. /package/src/{framework → utilities/userAgent}/userAgent.ts +0 -0
@@ -1,33 +1,33 @@
1
- import { isObservable, unwrap } from "knockout";
2
- import { View, getView, registerView } from "../../../framework/View";
3
- import { ViewModel, Properties, extendProperties } from "../../../framework/ViewModel";
1
+ import { Element, getElement, registerElement } from "../../../framework/element";
2
+ import { Properties, IProperties, extendProperties } from "../../../framework/properties";
3
+ import { isSubscribable, ISubscribable, unwrap } from "../../../framework/observable";
4
4
 
5
5
  //Do not change property names since they have to correspond to kendo listItems
6
6
  //so this type can be used in kendo list controls like menu and tree
7
7
 
8
- export interface ListItemProperties extends Properties {
8
+ export interface IListItemProperties extends IProperties {
9
9
  id: number | string;
10
- text?: string | ViewModel;
10
+ text?: string | ISubscribable<string> | Properties;
11
11
  select?: () => void;
12
12
  order?: number | string;
13
13
  }
14
14
 
15
- export interface HierarchicalListItemProperties extends ListItemProperties {
15
+ export interface IHierarchicalListItemProperties extends IListItemProperties {
16
16
  parentId?: number | string;
17
17
  expanded?: boolean;
18
- items?: Array<HierarchicalListItemProperties>;
18
+ items?: Array<IHierarchicalListItemProperties>;
19
19
  }
20
20
 
21
- export class ListItemView extends View<ListItemProperties> {
22
- constructor(properties: ListItemProperties) {
21
+ export class ListItemElement extends Element<IListItemProperties> {
22
+ constructor(properties: IListItemProperties) {
23
23
  super(
24
24
  {
25
25
  tagName: "div",
26
26
  properties: extendProperties(
27
+ properties,
27
28
  {
28
- viewType: "ListItem"
29
- },
30
- properties
29
+ elementType: "ListItem"
30
+ }
31
31
  )
32
32
  }
33
33
  );
@@ -36,64 +36,64 @@ export class ListItemView extends View<ListItemProperties> {
36
36
  build(): void {
37
37
  super.build();
38
38
 
39
- const viewModel = this.properties;
39
+ const properties = this.properties;
40
40
 
41
- if (isObservable(viewModel.text)) {
42
- this.setContent(unwrap(viewModel.text));
41
+ if (isSubscribable(properties.text)) {
42
+ this.setContent(unwrap(properties.text));
43
43
  this.subscriptions.push(
44
- viewModel.text.subscribe((content) => {
45
- this.setContent(content);
44
+ properties.text.subscribe((text)=>{
45
+ this.setContent(text);
46
46
  })
47
47
  );
48
48
  } else {
49
- this.setContent(viewModel.text);
49
+ this.setContent(properties.text);
50
50
  }
51
51
  }
52
52
 
53
- private setContent(content: string | ViewModel) {
53
+ private setContent(content: string | Properties) {
54
54
  if (typeof content === "string") {
55
55
  this.element.innerHTML = content;
56
- } else if (content instanceof ViewModel) {
57
- this.setChildren(getView(content));
56
+ } else if (content instanceof Properties) {
57
+ this.setChildren(getElement(content));
58
58
  }
59
59
  }
60
60
  }
61
61
 
62
- export function listItemView(properties: ListItemProperties) {
63
- return new ListItemView(properties);
62
+ export function createListItem(properties: IListItemProperties) {
63
+ return new ListItemElement(properties);
64
64
  }
65
65
 
66
- export class ListItemViewModel extends ViewModel implements ListItemProperties {
67
- constructor(properties: ListItemProperties) {
66
+ export class ListItemProperties extends Properties implements IListItemProperties {
67
+ constructor(properties: IListItemProperties) {
68
68
  super();
69
69
  this.setProperties(this, properties);
70
70
  }
71
71
  id: number | string;
72
- text?: string | ViewModel;
72
+ text?: string | Properties;
73
73
  select?: () => void;
74
74
  order?: number | string;
75
75
  }
76
76
 
77
- registerView(
78
- ListItemViewModel,
79
- ListItemView
77
+ registerElement(
78
+ ListItemProperties.prototype.constructor,
79
+ ListItemElement
80
80
  );
81
81
 
82
- export class HierarchicalListItemViewModel extends ViewModel implements HierarchicalListItemProperties{
83
- constructor(properties: HierarchicalListItemProperties) {
82
+ export class HierarchicalListItemProperties extends Properties implements IHierarchicalListItemProperties {
83
+ constructor(properties: IHierarchicalListItemProperties) {
84
84
  super();
85
85
  this.setProperties(this, properties);
86
86
  }
87
87
  id: number | string;
88
- text?: string | ViewModel;
88
+ text?: string | Properties;
89
89
  select?: () => void;
90
90
  order?: number | string;
91
91
  parentId?: number | string;
92
92
  expanded?: boolean;
93
- items?: Array<HierarchicalListItemProperties>;
93
+ items?: Array<IHierarchicalListItemProperties>;
94
94
  }
95
95
 
96
- registerView(
97
- HierarchicalListItemViewModel,
98
- ListItemView
96
+ registerElement(
97
+ HierarchicalListItemProperties,
98
+ ListItemElement
99
99
  )
@@ -1,21 +1,21 @@
1
- import { unwrap, Subscribable, isSubscribable } from "knockout";
2
- import { ViewModel, Properties, extendProperties } from "../../../framework/ViewModel"
3
- import { View, getView, registerView } from "../../../framework/View";
1
+ import { Properties, IProperties, extendProperties } from "../../../framework/properties"
2
+ import { Element, getElement, registerElement } from "../../../framework/element";
3
+ import { ISubscribable, isSubscribable, unwrap } from "../../../framework/observable";
4
4
 
5
- export interface ButtonProperties extends Properties {
6
- content?: string | ViewModel | Subscribable<string | ViewModel>;
5
+ export interface IButtonProperties extends IProperties {
6
+ content?: string | Properties | ISubscribable<string | Properties>;
7
7
  }
8
8
 
9
- export class ButtonView extends View<ButtonProperties> {
10
- constructor(properties: ButtonProperties) {
9
+ export class ButtonElement extends Element<IButtonProperties> {
10
+ constructor(properties: IButtonProperties) {
11
11
  super(
12
12
  {
13
13
  tagName: "button",
14
14
  properties: extendProperties(
15
+ properties,
15
16
  {
16
- viewType: "Button"
17
- },
18
- properties
17
+ elementType: "Button"
18
+ }
19
19
  )
20
20
  }
21
21
  );
@@ -24,47 +24,54 @@ export class ButtonView extends View<ButtonProperties> {
24
24
  build(): void {
25
25
  super.build();
26
26
 
27
- const viewModel = this.properties;
28
- if (viewModel.content) {
29
- if (isSubscribable(viewModel.content)) {
30
- this.buildContent(unwrap(viewModel.content));
27
+ const properties = this.properties;
28
+ if (properties.content) {
29
+ this.buildContent(unwrap(properties.content));
30
+
31
+ if (isSubscribable(properties.content)) {
31
32
  this.subscriptions.push(
32
- viewModel.content.subscribe((content) => {
33
- this.buildContent(content);
33
+ properties.content.subscribe((content)=>{
34
+ this.buildContent(content);
34
35
  })
36
+ //reaction(
37
+ // () => {
38
+ // return unwrap(properties.content);
39
+ // },
40
+ // (content) => {
41
+ // this.buildContent(content);
42
+ // }
43
+ //)
35
44
  );
36
- } else {
37
- this.buildContent(viewModel.content);
38
45
  }
39
46
  }
40
47
  }
41
48
 
42
- private buildContent(content: string | ViewModel) {
49
+ private buildContent(content: string | Properties) {
43
50
  if (content == null || content === undefined) {
44
51
  this.element.innerText = null;
45
52
  }
46
53
  else if (typeof content === "string") {
47
54
  this.element.innerText = content;
48
55
  }
49
- else if (content instanceof ViewModel) {
50
- this.setChildren(getView(content as ViewModel));
56
+ else if (content instanceof Properties) {
57
+ this.setChildren(getElement(content as Properties));
51
58
  }
52
59
  }
53
60
  }
54
61
 
55
- export function buttonView(properties: ButtonProperties): ButtonView {
56
- return new ButtonView(properties);
62
+ export function createButton(properties: IButtonProperties) {
63
+ return new ButtonElement(properties);
57
64
  }
58
65
 
59
- export class ButtonViewModel extends ViewModel implements ButtonProperties{
60
- constructor(properties: ButtonProperties) {
66
+ export class ButtonProperties extends Properties implements IButtonProperties {
67
+ constructor(properties: IButtonProperties) {
61
68
  super();
62
69
  this.setProperties(this, properties);
63
70
  }
64
- content?: string | ViewModel | Subscribable<string | ViewModel>;
71
+ content?: string | Properties | ISubscribable<string | Properties>;
65
72
  }
66
73
 
67
- registerView(
68
- ButtonViewModel,
69
- ButtonView
74
+ registerElement(
75
+ ButtonProperties.prototype.constructor,
76
+ ButtonElement
70
77
  );
@@ -1,41 +1,40 @@
1
- import { View, IView, registerView } from "../../../framework/View";
2
- import { Properties , extendProperties, ViewModel } from "../../../framework/ViewModel";
3
- import { Subscribable } from "knockout";
1
+ import { Element, IElement, registerElement } from "../../../framework/element";
2
+ import { IProperties, extendProperties, Properties } from "../../../framework/properties";
3
+ import { ISubscribable } from "../../../framework/observable";
4
4
 
5
- export interface DivProperties extends Properties {
6
- children?: Array<IView> | Subscribable<Array<IView>>;
5
+ export interface IDivProperties extends IProperties {
6
+ children?: Array<IElement> | ISubscribable<Array<IElement>>;
7
7
  }
8
-
9
- export class DivView extends View<DivProperties> {
10
- constructor(properties: DivProperties) {
8
+ export class DivElement extends Element<IDivProperties> {
9
+ constructor(properties: IDivProperties) {
11
10
  super(
12
11
  {
13
12
  tagName: "div",
14
13
  properties: extendProperties(
14
+ properties,
15
15
  {
16
- viewType: "Div"
17
- },
18
- properties
19
- ),
20
- children: properties.children
16
+ elementType: "Div"
17
+ }
18
+ )
21
19
  },
20
+ properties.children
22
21
  );
23
22
  }
24
23
  }
25
24
 
26
- export function divView(properties: DivProperties): DivView {
27
- return new DivView(properties);
25
+ export function createDiv(properties: IDivProperties) {
26
+ return new DivElement(properties);
28
27
  }
29
28
 
30
- export class DivViewModel extends ViewModel implements DivProperties{
31
- constructor(properties: DivProperties) {
29
+ export class DivProperties extends Properties implements IDivProperties {
30
+ constructor(properties: IDivProperties) {
32
31
  super();
33
32
  this.setProperties(this, properties);
34
33
  }
35
- children?: Array<IView> | Subscribable<Array<IView>>;
34
+ children?: Array<IElement> | ISubscribable<Array<IElement>>;
36
35
  }
37
36
 
38
- registerView(
39
- DivViewModel,
40
- DivView
37
+ registerElement(
38
+ DivProperties.prototype.constructor,
39
+ DivElement
41
40
  )
@@ -1,46 +1,48 @@
1
- import { View, registerView } from "../../../framework/View";
2
- import { ViewModel, Properties, extendProperties } from "../../../framework/ViewModel";
3
- import { Subscribable } from "knockout";
1
+ import { Element, registerElement } from "../../../framework/element";
2
+ import { Properties, IProperties, extendProperties } from "../../../framework/properties";
3
+ import { ISubscribable } from "../../../framework/observable";
4
4
 
5
- export interface ImageProperties extends Properties {
6
- src: string | Subscribable<string>;
7
- alt: string | Subscribable<string>;
5
+ export interface IImageProperties extends IProperties {
6
+ src: string | ISubscribable<string>;
7
+ alt: string | ISubscribable<string>;
8
8
  }
9
9
 
10
- export class ImageView extends View<ImageProperties> {
11
- constructor(properties: ImageProperties) {
10
+ export class ImageElement extends Element<IImageProperties> {
11
+ constructor(properties: IImageProperties) {
12
12
  super(
13
13
  {
14
14
  tagName: "img",
15
15
  properties: extendProperties(
16
+ properties,
17
+ {
18
+ elementType: "Image",
19
+ },
16
20
  {
17
- viewType: "Image",
18
21
  attributes: {
19
22
  src: properties.src,
20
23
  alt: properties.alt
21
24
  }
22
- },
23
- properties
25
+ }
24
26
  )
25
27
  }
26
28
  );
27
29
  }
28
30
  }
29
31
 
30
- export function imageView(properties: ImageProperties) {
31
- return new ImageView(properties);
32
+ export function createImage(properties: IImageProperties) {
33
+ return new ImageElement(properties);
32
34
  }
33
35
 
34
- export class ImageViewModel extends ViewModel implements ImageProperties{
35
- constructor(properties: ImageProperties) {
36
+ export class ImageProperties extends Properties implements IImageProperties {
37
+ constructor(properties: IImageProperties) {
36
38
  super();
37
39
  this.setProperties(this, properties);
38
40
  }
39
- src: string | Subscribable<string>;
40
- alt: string | Subscribable<string>;
41
+ src: string | ISubscribable<string>;
42
+ alt: string | ISubscribable<string>;
41
43
  }
42
44
 
43
- registerView(
44
- ImageViewModel,
45
- ImageView
45
+ registerElement(
46
+ ImageProperties.prototype.constructor,
47
+ ImageElement
46
48
  );
@@ -1,7 +1,6 @@
1
- import { isSubscribable, unwrap, isObservable } from "knockout";
2
- import { View, registerView } from "../../../framework/View";
3
- import { ViewModel, Properties, extendProperties, isNullOrUndefined } from "../../../framework/ViewModel";
4
- import { ObservableProperty, observableProperty, isObservableProperty } from "../../../framework/observable";
1
+ import { Element, registerElement } from "../../../framework/element";
2
+ import { Properties, IProperties, extendProperties, isNullOrUndefined } from "../../../framework/properties";
3
+ import { ISubscribable, isSubscribable, unwrap, isObservableValue } from "../../../framework/observable";
5
4
  import { isInteger } from "../../../utilities/integer/integer";
6
5
  import { isFloat } from "../../../utilities/float/float";
7
6
 
@@ -13,10 +12,10 @@ export enum ValueUpdateModeEnum {
13
12
  OnInput = 2
14
13
  }
15
14
 
16
- export interface InputProperties<TValue> extends Properties {
17
- value?: TValue | ObservableProperty<TValue>;
18
- inputValidator?: (event: Event, inputViewModel: InputProperties<TValue>, value: string) => Promise<boolean>;
19
- placeholder?: string | ObservableProperty<string>;
15
+ export interface IInputProperties<TValue> extends IProperties {
16
+ value?: TValue | ISubscribable<TValue>;
17
+ inputValidator?: (event: Event, inputViewModel: IInputProperties<TValue>, value: string) => Promise<boolean>;
18
+ placeholder?: string | ISubscribable<string>;
20
19
  valueUpdateMode?: ValueUpdateModeEnum;
21
20
  min?: number;
22
21
  max?: number;
@@ -24,16 +23,16 @@ export interface InputProperties<TValue> extends Properties {
24
23
  type?: InputType;
25
24
  }
26
25
 
27
- export class InputView<TValue> extends View<InputProperties<TValue>> {
28
- constructor(properties: InputProperties<TValue>) {
26
+ export class InputElement<TValue> extends Element<IInputProperties<TValue>> {
27
+ constructor(properties: IInputProperties<TValue>) {
29
28
  super(
30
29
  {
31
30
  tagName: "input",
32
31
  properties: extendProperties(
32
+ properties,
33
33
  {
34
- viewType: "Input"
35
- },
36
- properties
34
+ elementType: "Input"
35
+ }
37
36
  )
38
37
  }
39
38
  );
@@ -44,30 +43,30 @@ export class InputView<TValue> extends View<InputProperties<TValue>> {
44
43
  super.build();
45
44
 
46
45
  const element = this.element;
47
- const viewModel = this.properties;
48
- if (!viewModel.valueUpdateMode) {
49
- viewModel.valueUpdateMode = ValueUpdateModeEnum.OnChange;
46
+ const properties = this.properties;
47
+ if (!properties.valueUpdateMode) {
48
+ properties.valueUpdateMode = ValueUpdateModeEnum.OnChange;
50
49
  }
51
50
 
52
51
  const input = this.element as HTMLInputElement;
53
- input.type = viewModel.type;
52
+ input.type = properties.type;
54
53
 
55
- if (!isNullOrUndefined(viewModel.min)) {
56
- input.min = viewModel.min as any;
54
+ if (!isNullOrUndefined(properties.min)) {
55
+ input.min = properties.min as any;
57
56
  }
58
- if (!isNullOrUndefined(viewModel.max)) {
59
- input.max = viewModel.max as any;
57
+ if (!isNullOrUndefined(properties.max)) {
58
+ input.max = properties.max as any;
60
59
  }
61
- if (!isNullOrUndefined(viewModel.step)) {
62
- input.step = viewModel.step as any;
60
+ if (!isNullOrUndefined(properties.step)) {
61
+ input.step = properties.step as any;
63
62
  }
64
63
 
65
- switch (viewModel.type) {
64
+ switch (properties.type) {
66
65
  case "checkbox":
67
- input.checked = unwrap(viewModel.value) as unknown as boolean;
68
- if (isObservable(viewModel.value)) {
66
+ input.checked = unwrap(properties.value) as unknown as boolean;
67
+ if (isSubscribable(properties.value)) {
69
68
  this.subscriptions.push(
70
- viewModel.value.subscribe((value: TValue) => {
69
+ properties.value.subscribe((value) => {
71
70
  input.checked = value as unknown as boolean;
72
71
  })
73
72
  );
@@ -80,10 +79,10 @@ export class InputView<TValue> extends View<InputProperties<TValue>> {
80
79
  break;
81
80
 
82
81
  case "radio":
83
- input.checked = input.value === unwrap(viewModel.value);
84
- if (isSubscribable(viewModel.value)) {
82
+ input.checked = input.value === ((unwrap(properties.value)) as any as string);
83
+ if (isSubscribable(properties.value)) {
85
84
  this.subscriptions.push(
86
- viewModel.value.subscribe((value) => {
85
+ properties.value.subscribe((value) => {
87
86
  input.checked = input.value === (value as any as string);
88
87
  })
89
88
  );
@@ -91,26 +90,26 @@ export class InputView<TValue> extends View<InputProperties<TValue>> {
91
90
  break;
92
91
 
93
92
  default:
94
- const value = unwrap(viewModel.value);
93
+ const value = unwrap(properties.value);
95
94
  if (value) {
96
95
  input.value = value as unknown as string;
97
96
  }
98
- if (isObservable(viewModel.value)) {
97
+ if (isSubscribable(properties.value)) {
99
98
  this.subscriptions.push(
100
- viewModel.value.subscribe((value: TValue) => {
99
+ properties.value.subscribe((value) => {
101
100
  input.value = value as unknown as string;
102
101
  })
103
102
  );
104
103
  }
105
104
  }
106
105
 
107
- const placeholder = unwrap(viewModel.placeholder) as unknown as string;
106
+ const placeholder = unwrap(properties.placeholder) as unknown as string;
108
107
  if (placeholder) {
109
108
  input.placeholder = placeholder;
110
109
  }
111
- if (isSubscribable(viewModel.placeholder)) {
110
+ if (isSubscribable(properties.placeholder)) {
112
111
  this.subscriptions.push(
113
- viewModel.placeholder.subscribe((placeholder) => {
112
+ properties.placeholder.subscribe((placeholder) => {
114
113
  if (placeholder) {
115
114
  input.placeholder = placeholder;
116
115
  } else {
@@ -127,7 +126,7 @@ export class InputView<TValue> extends View<InputProperties<TValue>> {
127
126
  );
128
127
  }
129
128
 
130
- if (this.properties.valueUpdateMode === ValueUpdateModeEnum.OnInput || viewModel.inputValidator) {
129
+ if (this.properties.valueUpdateMode === ValueUpdateModeEnum.OnInput || properties.inputValidator) {
131
130
  this.element.addEventListener(
132
131
  "input",
133
132
  handleEvent
@@ -136,7 +135,7 @@ export class InputView<TValue> extends View<InputProperties<TValue>> {
136
135
 
137
136
  async function handleEvent(event: Event) {
138
137
  let newValue = null;
139
- switch (viewModel.type) {
138
+ switch (properties.type) {
140
139
  case "checkbox":
141
140
  newValue = input.checked;
142
141
  break;
@@ -162,59 +161,58 @@ export class InputView<TValue> extends View<InputProperties<TValue>> {
162
161
  }
163
162
  }
164
163
 
165
- if (viewModel.inputValidator) {
166
- if (!await viewModel.inputValidator(event, viewModel, newValue as any as string)) {
167
- input.value = unwrap(viewModel.value) as any as string;
164
+ if (properties.inputValidator) {
165
+ if (!await properties.inputValidator(event, properties, newValue as any as string)) {
166
+ input.value = unwrap(properties.value) as any as string;
168
167
  return;
169
168
  };
170
169
  }
171
170
 
172
- if (viewModel.type === "integer") {
171
+ if (properties.type === "integer") {
173
172
  if (isInteger(newValue)) {
174
173
  newValue = parseInt(newValue);
175
174
  } else {
176
- input.value = unwrap(viewModel.value) as any as string;
175
+ input.value = unwrap(properties.value) as any as string;
177
176
  return;
178
177
  }
179
178
  }
180
179
 
181
- if (viewModel.type === "float") {
180
+ if (properties.type === "float") {
182
181
  if (isFloat(newValue)) {
183
182
  newValue = parseFloat(newValue);
184
183
  } else {
185
- input.value = unwrap(viewModel.value) as any as string;
184
+ input.value = unwrap(properties.value) as any as string;
186
185
  return;
187
186
  }
188
187
  }
189
188
 
190
189
  //if validation has succeeded we set the viewModel value
191
- if (isObservableProperty(viewModel.value)) {
192
- if ((event.type === "change" && viewModel.valueUpdateMode === ValueUpdateModeEnum.OnChange) ||
193
- (event.type === "input" && viewModel.valueUpdateMode === ValueUpdateModeEnum.OnInput)) {
194
- viewModel.value.set(newValue);
190
+ if (isObservableValue(properties.value)) {
191
+ if ((event.type === "change" && properties.valueUpdateMode === ValueUpdateModeEnum.OnChange) ||
192
+ (event.type === "input" && properties.valueUpdateMode === ValueUpdateModeEnum.OnInput)) {
193
+
194
+ properties.value.setValueInAction(newValue);
195
195
  } else {
196
- viewModel.value.set(newValue, false);
196
+ properties.value.setInternal(newValue);
197
197
  }
198
- } else if (isObservable(viewModel.value)) {
199
- viewModel.value(newValue);
200
198
  }
201
199
  }
202
200
  }
203
201
  }
204
202
 
205
- export function inputView<TValue>(properties: InputProperties<TValue>) {
206
- return new InputView<TValue>(properties);
203
+ export function createInput<TValue>(properties: IInputProperties<TValue>) {
204
+ return new InputElement<TValue>(properties);
207
205
  }
208
206
 
209
- export class InputViewModel<TValue> extends ViewModel implements InputProperties<TValue> {
210
- constructor(properties: InputProperties<TValue>) {
207
+ export class InputProperties<TValue> extends Properties implements IInputProperties<TValue> {
208
+ constructor(properties: IInputProperties<TValue>) {
211
209
  super();
212
210
  this.setProperties(this, properties);
213
211
  }
214
212
 
215
- value?: TValue | ObservableProperty<TValue>;
213
+ value?: TValue | ISubscribable<TValue>;
216
214
  inputValidator?: (event: Event, inputViewModel: InputProperties<TValue>, value: string) => Promise<boolean>;
217
- placeholder?: string | ObservableProperty<string>;
215
+ placeholder?: string | ISubscribable<string>;
218
216
  valueUpdateMode?: ValueUpdateModeEnum;
219
217
  min?: number;
220
218
  max?: number;
@@ -222,7 +220,7 @@ export class InputViewModel<TValue> extends ViewModel implements InputProperties
222
220
  type?: InputType;
223
221
  }
224
222
 
225
- registerView(
226
- InputViewModel,
227
- InputView
223
+ registerElement(
224
+ InputProperties.prototype.constructor,
225
+ InputElement
228
226
  );