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.
- package/dist/controls/codeMirror/Editor/Editor.d.ts +19 -0
- package/dist/controls/codeMirror/Editor/Editor.js +151 -0
- package/dist/controls/codeMirror/Editor/Editor.js.map +1 -0
- package/dist/controls/codeMirror/index.d.ts +1 -2
- package/dist/controls/codeMirror/index.js +1 -2
- package/dist/controls/codeMirror/index.js.map +1 -1
- package/dist/controls/custom/FileSelector/FileSelector.d.ts +18 -18
- package/dist/controls/custom/FileSelector/FileSelector.js +47 -46
- package/dist/controls/custom/FileSelector/FileSelector.js.map +1 -1
- package/dist/controls/custom/LabeledControl/LabeledControl.d.ts +15 -15
- package/dist/controls/custom/LabeledControl/LabeledControl.js +31 -36
- package/dist/controls/custom/LabeledControl/LabeledControl.js.map +1 -1
- package/dist/controls/custom/ListItem/ListItem.d.ts +37 -36
- package/dist/controls/custom/ListItem/ListItem.js +62 -62
- package/dist/controls/custom/ListItem/ListItem.js.map +1 -1
- package/dist/controls/custom/index.d.ts +3 -3
- package/dist/controls/custom/index.js +3 -3
- package/dist/controls/html/Button/Button.d.ts +16 -16
- package/dist/controls/html/Button/Button.js +47 -50
- package/dist/controls/html/Button/Button.js.map +1 -1
- package/dist/controls/html/Div/Div.d.ts +14 -14
- package/dist/controls/html/Div/Div.js +23 -24
- package/dist/controls/html/Div/Div.js.map +1 -1
- package/dist/controls/html/Image/Image.d.ts +16 -16
- package/dist/controls/html/Image/Image.js +29 -28
- package/dist/controls/html/Image/Image.js.map +1 -1
- package/dist/controls/html/Input/Input.d.ts +34 -34
- package/dist/controls/html/Input/Input.js +166 -170
- package/dist/controls/html/Input/Input.js.map +1 -1
- package/dist/controls/html/Select/Select.d.ts +30 -30
- package/dist/controls/html/Select/Select.js +109 -110
- package/dist/controls/html/Select/Select.js.map +1 -1
- package/dist/controls/html/Span/Span.d.ts +11 -11
- package/dist/controls/html/Span/Span.js +22 -22
- package/dist/controls/html/Span/Span.js.map +1 -1
- package/dist/controls/html/index.d.ts +6 -6
- package/dist/controls/html/index.js +6 -6
- package/dist/controls/index.d.ts +14 -14
- package/dist/controls/index.js +14 -14
- package/dist/controls/index.js.map +1 -1
- package/dist/controls/{jsonViewAwesome → jsonViewerAwesome}/index.d.ts +1 -1
- package/dist/controls/{jsonViewAwesome → jsonViewerAwesome}/index.js +1 -1
- package/dist/controls/jsonViewerAwesome/index.js.map +1 -0
- package/dist/controls/jsonViewerAwesome/jsonFormatter/JsonFormatter.d.ts +28 -0
- package/dist/controls/{jsonViewAwesome → jsonViewerAwesome}/jsonFormatter/JsonFormatter.js +65 -65
- package/dist/controls/jsonViewerAwesome/jsonFormatter/JsonFormatter.js.map +1 -0
- package/dist/controls/kendo/Chart/Chart.d.ts +19 -19
- package/dist/controls/kendo/Chart/Chart.js +62 -62
- package/dist/controls/kendo/Chart/Chart.js.map +1 -1
- package/dist/controls/kendo/Culture/Culture.d.ts +1 -1
- package/dist/controls/kendo/Culture/Culture.js +25 -25
- package/dist/controls/kendo/Culture/Culture.js.map +1 -1
- package/dist/controls/kendo/DataSource/DataSource.d.ts +4 -4
- package/dist/controls/kendo/DataSource/DataSource.js +1 -1
- package/dist/controls/kendo/Editor/Editor.d.ts +14 -19
- package/dist/controls/kendo/Editor/Editor.js +94 -104
- package/dist/controls/kendo/Editor/Editor.js.map +1 -1
- package/dist/controls/kendo/Grid/Grid.d.ts +54 -54
- package/dist/controls/kendo/Grid/Grid.js +201 -218
- package/dist/controls/kendo/Grid/Grid.js.map +1 -1
- package/dist/controls/kendo/Menu/Menu.d.ts +15 -15
- package/dist/controls/kendo/Menu/Menu.js +90 -90
- package/dist/controls/kendo/Menu/Menu.js.map +1 -1
- package/dist/controls/kendo/ObservableObject/ObservableObject.d.ts +0 -5
- package/dist/controls/kendo/ObservableObject/ObservableObject.js +0 -34
- package/dist/controls/kendo/ObservableObject/ObservableObject.js.map +1 -1
- package/dist/controls/kendo/Treeview/Treeview.d.ts +17 -0
- package/dist/controls/kendo/{Tree/Tree.js → Treeview/Treeview.js} +107 -107
- package/dist/controls/kendo/Treeview/Treeview.js.map +1 -0
- package/dist/controls/kendo/Window/Window.d.ts +14 -0
- package/dist/controls/kendo/{Dialog/Dialog.js → Window/Window.js} +49 -49
- package/dist/controls/kendo/Window/Window.js.map +1 -0
- package/dist/controls/kendo/index.d.ts +8 -9
- package/dist/controls/kendo/index.js +8 -9
- package/dist/controls/kendo/index.js.map +1 -1
- package/dist/controls/leaflet/LabelControl/LabelControl.d.ts +12 -12
- package/dist/controls/leaflet/LabelControl/LabelControl.js +33 -33
- package/dist/controls/leaflet/LabelControl/LabelControl.js.map +1 -1
- package/dist/controls/leaflet/Map/Map.d.ts +45 -45
- package/dist/controls/leaflet/Map/Map.js +116 -115
- package/dist/controls/leaflet/Map/Map.js.map +1 -1
- package/dist/controls/leaflet/OpenStreetMapTileLayer/OpenStreetMapTileLayer.d.ts +8 -8
- package/dist/controls/leaflet/OpenStreetMapTileLayer/OpenStreetMapTileLayer.js +13 -13
- package/dist/controls/leaflet/OpenStreetMapTileLayer/OpenStreetMapTileLayer.js.map +1 -1
- package/dist/controls/leaflet/PointerEvent/PointerEvent.d.ts +2 -2
- package/dist/controls/leaflet/PointerEvent/PointerEvent.js +7 -7
- package/dist/controls/leaflet/PointerEvent/PointerEvent.js.map +1 -1
- package/dist/controls/leaflet/index.d.ts +4 -4
- package/dist/controls/leaflet/index.js +4 -4
- package/dist/controls/svg/Circle/Circle.d.ts +12 -12
- package/dist/controls/svg/Circle/Circle.js +20 -20
- package/dist/controls/svg/Circle/Circle.js.map +1 -1
- package/dist/controls/svg/Ellipse/Ellipse.d.ts +13 -13
- package/dist/controls/svg/Ellipse/Ellipse.js +21 -21
- package/dist/controls/svg/Ellipse/Ellipse.js.map +1 -1
- package/dist/controls/svg/ForeignObject/ForeignObject.d.ts +15 -14
- package/dist/controls/svg/ForeignObject/ForeignObject.js +21 -22
- package/dist/controls/svg/ForeignObject/ForeignObject.js.map +1 -1
- package/dist/controls/svg/Group/Group.d.ts +15 -14
- package/dist/controls/svg/Group/Group.js +21 -22
- package/dist/controls/svg/Group/Group.js.map +1 -1
- package/dist/controls/svg/Line/Line.d.ts +13 -13
- package/dist/controls/svg/Line/Line.js +21 -21
- package/dist/controls/svg/Line/Line.js.map +1 -1
- package/dist/controls/svg/Pattern/Pattern.d.ts +22 -22
- package/dist/controls/svg/Pattern/Pattern.js +22 -23
- package/dist/controls/svg/Pattern/Pattern.js.map +1 -1
- package/dist/controls/svg/Polygon/Polygon.d.ts +11 -11
- package/dist/controls/svg/Polygon/Polygon.js +20 -20
- package/dist/controls/svg/Polygon/Polygon.js.map +1 -1
- package/dist/controls/svg/Polyline/Polyline.d.ts +11 -11
- package/dist/controls/svg/Polyline/Polyline.js +19 -19
- package/dist/controls/svg/Polyline/Polyline.js.map +1 -1
- package/dist/controls/svg/Rectangle/Rectangle.d.ts +13 -13
- package/dist/controls/svg/Rectangle/Rectangle.js +21 -21
- package/dist/controls/svg/Rectangle/Rectangle.js.map +1 -1
- package/dist/controls/svg/Svg/Svg.d.ts +17 -17
- package/dist/controls/svg/Svg/Svg.js +23 -24
- package/dist/controls/svg/Svg/Svg.js.map +1 -1
- package/dist/controls/svg/Text/Text.d.ts +14 -14
- package/dist/controls/svg/Text/Text.js +22 -22
- package/dist/controls/svg/Text/Text.js.map +1 -1
- package/dist/controls/svg/Title/Title.d.ts +10 -10
- package/dist/controls/svg/Title/Title.js +16 -16
- package/dist/controls/svg/Title/Title.js.map +1 -1
- package/dist/controls/svg/index.d.ts +13 -13
- package/dist/controls/svg/index.js +13 -13
- package/dist/controls/svg/svg.d.ts +6 -6
- package/dist/controls/svg/svg.js +12 -12
- package/dist/controls/svg/svg.js.map +1 -1
- package/dist/framework/attributes.d.ts +90 -90
- package/dist/framework/attributes.js +1 -1
- package/dist/framework/{View.d.ts → element.d.ts} +61 -62
- package/dist/framework/{View.js → element.js} +157 -150
- package/dist/framework/element.js.map +1 -0
- package/dist/framework/event.d.ts +80 -80
- package/dist/framework/event.js +25 -25
- package/dist/framework/event.js.map +1 -1
- package/dist/framework/observable.d.ts +37 -12
- package/dist/framework/observable.js +66 -58
- package/dist/framework/observable.js.map +1 -1
- package/dist/framework/properties.d.ts +40 -0
- package/dist/framework/{ViewModel.js → properties.js} +303 -312
- package/dist/framework/properties.js.map +1 -0
- package/dist/framework/root.d.ts +9 -0
- package/dist/framework/root.js +38 -0
- package/dist/framework/root.js.map +1 -0
- package/dist/framework/style.d.ts +657 -658
- package/dist/framework/style.js +146 -153
- package/dist/framework/style.js.map +1 -1
- package/dist/framework/types.d.ts +87 -87
- package/dist/framework/types.js +1 -1
- package/dist/index.d.ts +12 -12
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/utilities/blob/blob.d.ts +1 -1
- package/dist/utilities/blob/blob.js +17 -17
- package/dist/utilities/blob/blob.js.map +1 -1
- package/dist/utilities/contextMenu/contextMenu.d.ts +2 -0
- package/dist/utilities/contextMenu/contextMenu.js +11 -0
- package/dist/utilities/contextMenu/contextMenu.js.map +1 -0
- package/dist/utilities/cookie/cookie.d.ts +3 -3
- package/dist/utilities/cookie/cookie.js +26 -26
- package/dist/utilities/cookie/cookie.js.map +1 -1
- package/dist/utilities/dataReaderTable/dataReaderTable.d.ts +9 -9
- package/dist/utilities/dataReaderTable/dataReaderTable.js +23 -23
- package/dist/utilities/dataReaderTable/dataReaderTable.js.map +1 -1
- package/dist/utilities/fetch/fetch.d.ts +7 -8
- package/dist/utilities/fetch/fetch.js +139 -137
- package/dist/utilities/fetch/fetch.js.map +1 -1
- package/dist/utilities/float/float.d.ts +1 -1
- package/dist/utilities/float/float.js +3 -3
- package/dist/utilities/formData/formData.d.ts +1 -1
- package/dist/utilities/formData/formData.js +11 -11
- package/dist/utilities/formData/formData.js.map +1 -1
- package/dist/utilities/formatting/formatting.d.ts +4 -0
- package/dist/utilities/formatting/formatting.js +26 -0
- package/dist/utilities/formatting/formatting.js.map +1 -0
- package/dist/utilities/htmlElement/htmlElement.d.ts +1 -1
- package/dist/utilities/htmlElement/htmlElement.js +16 -16
- package/dist/utilities/htmlElement/htmlElement.js.map +1 -1
- package/dist/utilities/image/image.d.ts +1 -1
- package/dist/utilities/image/image.js +1 -1
- package/dist/utilities/index.d.ts +40 -36
- package/dist/utilities/index.js +40 -36
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/integer/integer.d.ts +3 -3
- package/dist/utilities/integer/integer.js +27 -27
- package/dist/utilities/integer/integer.js.map +1 -1
- package/dist/utilities/key/key.d.ts +2 -2
- package/dist/utilities/key/key.js +6 -6
- package/dist/utilities/navigator/navigator.d.ts +1 -1
- package/dist/utilities/navigator/navigator.js +8 -8
- package/dist/utilities/navigator/navigator.js.map +1 -1
- package/dist/utilities/notification/notification.d.ts +5 -5
- package/dist/utilities/notification/notification.js +66 -66
- package/dist/utilities/notification/notification.js.map +1 -1
- package/dist/utilities/querystring/querystring.d.ts +6 -6
- package/dist/utilities/querystring/querystring.js +53 -53
- package/dist/utilities/querystring/querystring.js.map +1 -1
- package/dist/utilities/router/router.d.ts +19 -19
- package/dist/utilities/router/router.js +80 -80
- package/dist/utilities/router/router.js.map +1 -1
- package/dist/utilities/stylesheet/stylesheet.d.ts +2 -2
- package/dist/utilities/stylesheet/stylesheet.js +47 -47
- package/dist/utilities/stylesheet/stylesheet.js.map +1 -1
- package/dist/utilities/uniqueId/uniqueId.d.ts +1 -1
- package/dist/utilities/uniqueId/uniqueId.js +4 -4
- package/dist/{framework → utilities/userAgent}/userAgent.d.ts +31 -31
- package/dist/{framework → utilities/userAgent}/userAgent.js +46 -46
- package/dist/utilities/userAgent/userAgent.js.map +1 -0
- package/dist/utilities/webSocket/webSocket.d.ts +1 -1
- package/dist/utilities/webSocket/webSocket.js +54 -54
- package/dist/utilities/webSocket/webSocket.js.map +1 -1
- package/package.json +18 -14
- package/src/controls/codeMirror/Editor/Editor.ts +207 -0
- package/src/controls/codeMirror/index.ts +1 -2
- package/src/controls/custom/FileSelector/FileSelector.ts +30 -28
- package/src/controls/custom/LabeledControl/LabeledControl.ts +32 -36
- package/src/controls/custom/ListItem/ListItem.ts +36 -36
- package/src/controls/html/Button/Button.ts +36 -29
- package/src/controls/html/Div/Div.ts +20 -21
- package/src/controls/html/Image/Image.ts +22 -20
- package/src/controls/html/Input/Input.ts +59 -61
- package/src/controls/html/Select/Select.ts +37 -39
- package/src/controls/html/Span/Span.ts +14 -14
- package/src/controls/index.ts +2 -2
- package/src/controls/{jsonViewAwesome → jsonViewerAwesome}/jsonFormatter/JsonFormatter.ts +23 -23
- package/src/controls/kendo/Chart/Chart.ts +34 -34
- package/src/controls/kendo/DataSource/DataSource.ts +1 -1
- package/src/controls/kendo/Editor/Editor.ts +58 -68
- package/src/controls/kendo/Grid/Grid.ts +77 -80
- package/src/controls/kendo/Menu/Menu.ts +22 -22
- package/src/controls/kendo/ObservableObject/ObservableObject.ts +45 -45
- package/src/controls/kendo/{Tree/Tree.ts → Treeview/Treeview.ts} +15 -15
- package/src/controls/kendo/{Dialog/Dialog.ts → Window/Window.ts} +21 -19
- package/src/controls/kendo/index.ts +3 -3
- package/src/controls/leaflet/LabelControl/LabelControl.ts +10 -10
- package/src/controls/leaflet/Map/Map.ts +41 -38
- package/src/controls/leaflet/OpenStreetMapTileLayer/OpenStreetMapTileLayer.ts +3 -3
- package/src/controls/svg/Circle/Circle.ts +14 -14
- package/src/controls/svg/Ellipse/Ellipse.ts +15 -15
- package/src/controls/svg/ForeignObject/ForeignObject.ts +19 -20
- package/src/controls/svg/Group/Group.ts +19 -19
- package/src/controls/svg/Line/Line.ts +15 -15
- package/src/controls/svg/Pattern/Pattern.ts +25 -25
- package/src/controls/svg/Polygon/Polygon.ts +13 -13
- package/src/controls/svg/Polyline/Polyline.ts +13 -13
- package/src/controls/svg/Rectangle/Rectangle.ts +15 -15
- package/src/controls/svg/Svg/Svg.ts +19 -19
- package/src/controls/svg/Text/Text.ts +16 -16
- package/src/controls/svg/Title/Title.ts +12 -12
- package/src/controls/svg/svg.ts +4 -4
- package/src/framework/attributes.ts +46 -46
- package/src/framework/{View.ts → element.ts} +52 -39
- package/src/framework/event.ts +7 -7
- package/src/framework/observable.ts +94 -60
- package/src/framework/properties.ts +393 -0
- package/src/framework/root.ts +45 -0
- package/src/framework/style.ts +330 -340
- package/src/index.ts +4 -4
- package/src/utilities/contextMenu/contextMenu.ts +16 -0
- package/src/utilities/fetch/fetch.ts +16 -14
- package/src/utilities/formatting/formatting.ts +29 -0
- package/src/utilities/index.ts +7 -3
- package/src/utilities/router/router.ts +3 -3
- package/dist/controls/codeMirror/HtmlEditor/HtmlEditor.d.ts +0 -16
- package/dist/controls/codeMirror/HtmlEditor/HtmlEditor.js +0 -120
- package/dist/controls/codeMirror/HtmlEditor/HtmlEditor.js.map +0 -1
- package/dist/controls/codeMirror/JsonEditor/JsonEditor.d.ts +0 -16
- package/dist/controls/codeMirror/JsonEditor/JsonEditor.js +0 -104
- package/dist/controls/codeMirror/JsonEditor/JsonEditor.js.map +0 -1
- package/dist/controls/jsonViewAwesome/index.js.map +0 -1
- package/dist/controls/jsonViewAwesome/jsonFormatter/JsonFormatter.d.ts +0 -28
- package/dist/controls/jsonViewAwesome/jsonFormatter/JsonFormatter.js.map +0 -1
- package/dist/controls/kendo/Dialog/Dialog.d.ts +0 -14
- package/dist/controls/kendo/Dialog/Dialog.js.map +0 -1
- package/dist/controls/kendo/Tree/Tree.d.ts +0 -17
- package/dist/controls/kendo/Tree/Tree.js.map +0 -1
- package/dist/framework/View.js.map +0 -1
- package/dist/framework/ViewModel.d.ts +0 -42
- package/dist/framework/ViewModel.js.map +0 -1
- package/dist/framework/userAgent.js.map +0 -1
- package/dist/utilities/html/html.d.ts +0 -1
- package/dist/utilities/html/html.js +0 -8
- package/dist/utilities/html/html.js.map +0 -1
- package/src/controls/codeMirror/HtmlEditor/HtmlEditor.ts +0 -153
- package/src/controls/codeMirror/JsonEditor/JsonEditor.ts +0 -136
- package/src/framework/ViewModel.ts +0 -528
- package/src/utilities/html/html.ts +0 -8
- /package/src/controls/{jsonViewAwesome → jsonViewerAwesome}/index.ts +0 -0
- /package/src/{framework → utilities/userAgent}/userAgent.ts +0 -0
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
|
|
8
|
+
export interface IListItemProperties extends IProperties {
|
|
9
9
|
id: number | string;
|
|
10
|
-
text?: string |
|
|
10
|
+
text?: string | ISubscribable<string> | Properties;
|
|
11
11
|
select?: () => void;
|
|
12
12
|
order?: number | string;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export interface
|
|
15
|
+
export interface IHierarchicalListItemProperties extends IListItemProperties {
|
|
16
16
|
parentId?: number | string;
|
|
17
17
|
expanded?: boolean;
|
|
18
|
-
items?: Array<
|
|
18
|
+
items?: Array<IHierarchicalListItemProperties>;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export class
|
|
22
|
-
constructor(properties:
|
|
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
|
-
|
|
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
|
|
39
|
+
const properties = this.properties;
|
|
40
40
|
|
|
41
|
-
if (
|
|
42
|
-
this.setContent(unwrap(
|
|
41
|
+
if (isSubscribable(properties.text)) {
|
|
42
|
+
this.setContent(unwrap(properties.text));
|
|
43
43
|
this.subscriptions.push(
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
properties.text.subscribe((text)=>{
|
|
45
|
+
this.setContent(text);
|
|
46
46
|
})
|
|
47
47
|
);
|
|
48
48
|
} else {
|
|
49
|
-
this.setContent(
|
|
49
|
+
this.setContent(properties.text);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
private setContent(content: string |
|
|
53
|
+
private setContent(content: string | Properties) {
|
|
54
54
|
if (typeof content === "string") {
|
|
55
55
|
this.element.innerHTML = content;
|
|
56
|
-
} else if (content instanceof
|
|
57
|
-
this.setChildren(
|
|
56
|
+
} else if (content instanceof Properties) {
|
|
57
|
+
this.setChildren(getElement(content));
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
export function
|
|
63
|
-
return new
|
|
62
|
+
export function createListItem(properties: IListItemProperties) {
|
|
63
|
+
return new ListItemElement(properties);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
export class
|
|
67
|
-
constructor(properties:
|
|
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 |
|
|
72
|
+
text?: string | Properties;
|
|
73
73
|
select?: () => void;
|
|
74
74
|
order?: number | string;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
registerElement(
|
|
78
|
+
ListItemProperties.prototype.constructor,
|
|
79
|
+
ListItemElement
|
|
80
80
|
);
|
|
81
81
|
|
|
82
|
-
export class
|
|
83
|
-
constructor(properties:
|
|
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 |
|
|
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<
|
|
93
|
+
items?: Array<IHierarchicalListItemProperties>;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
registerElement(
|
|
97
|
+
HierarchicalListItemProperties,
|
|
98
|
+
ListItemElement
|
|
99
99
|
)
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
|
|
6
|
-
content?: string |
|
|
5
|
+
export interface IButtonProperties extends IProperties {
|
|
6
|
+
content?: string | Properties | ISubscribable<string | Properties>;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export class
|
|
10
|
-
constructor(properties:
|
|
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
|
-
|
|
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
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
33
|
-
|
|
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 |
|
|
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
|
|
50
|
-
this.setChildren(
|
|
56
|
+
else if (content instanceof Properties) {
|
|
57
|
+
this.setChildren(getElement(content as Properties));
|
|
51
58
|
}
|
|
52
59
|
}
|
|
53
60
|
}
|
|
54
61
|
|
|
55
|
-
export function
|
|
56
|
-
return new
|
|
62
|
+
export function createButton(properties: IButtonProperties) {
|
|
63
|
+
return new ButtonElement(properties);
|
|
57
64
|
}
|
|
58
65
|
|
|
59
|
-
export class
|
|
60
|
-
constructor(properties:
|
|
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 |
|
|
71
|
+
content?: string | Properties | ISubscribable<string | Properties>;
|
|
65
72
|
}
|
|
66
73
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
registerElement(
|
|
75
|
+
ButtonProperties.prototype.constructor,
|
|
76
|
+
ButtonElement
|
|
70
77
|
);
|
|
@@ -1,41 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
|
|
6
|
-
children?: Array<
|
|
5
|
+
export interface IDivProperties extends IProperties {
|
|
6
|
+
children?: Array<IElement> | ISubscribable<Array<IElement>>;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
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
|
|
27
|
-
return new
|
|
25
|
+
export function createDiv(properties: IDivProperties) {
|
|
26
|
+
return new DivElement(properties);
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
export class
|
|
31
|
-
constructor(properties:
|
|
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<
|
|
34
|
+
children?: Array<IElement> | ISubscribable<Array<IElement>>;
|
|
36
35
|
}
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
registerElement(
|
|
38
|
+
DivProperties.prototype.constructor,
|
|
39
|
+
DivElement
|
|
41
40
|
)
|
|
@@ -1,46 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
|
|
6
|
-
src: string |
|
|
7
|
-
alt: string |
|
|
5
|
+
export interface IImageProperties extends IProperties {
|
|
6
|
+
src: string | ISubscribable<string>;
|
|
7
|
+
alt: string | ISubscribable<string>;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export class
|
|
11
|
-
constructor(properties:
|
|
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
|
|
31
|
-
return new
|
|
32
|
+
export function createImage(properties: IImageProperties) {
|
|
33
|
+
return new ImageElement(properties);
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
export class
|
|
35
|
-
constructor(properties:
|
|
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 |
|
|
40
|
-
alt: string |
|
|
41
|
+
src: string | ISubscribable<string>;
|
|
42
|
+
alt: string | ISubscribable<string>;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
registerElement(
|
|
46
|
+
ImageProperties.prototype.constructor,
|
|
47
|
+
ImageElement
|
|
46
48
|
);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
|
|
17
|
-
value?: TValue |
|
|
18
|
-
inputValidator?: (event: Event, inputViewModel:
|
|
19
|
-
placeholder?: 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
|
|
28
|
-
constructor(properties:
|
|
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
|
-
|
|
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
|
|
48
|
-
if (!
|
|
49
|
-
|
|
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 =
|
|
52
|
+
input.type = properties.type;
|
|
54
53
|
|
|
55
|
-
if (!isNullOrUndefined(
|
|
56
|
-
input.min =
|
|
54
|
+
if (!isNullOrUndefined(properties.min)) {
|
|
55
|
+
input.min = properties.min as any;
|
|
57
56
|
}
|
|
58
|
-
if (!isNullOrUndefined(
|
|
59
|
-
input.max =
|
|
57
|
+
if (!isNullOrUndefined(properties.max)) {
|
|
58
|
+
input.max = properties.max as any;
|
|
60
59
|
}
|
|
61
|
-
if (!isNullOrUndefined(
|
|
62
|
-
input.step =
|
|
60
|
+
if (!isNullOrUndefined(properties.step)) {
|
|
61
|
+
input.step = properties.step as any;
|
|
63
62
|
}
|
|
64
63
|
|
|
65
|
-
switch (
|
|
64
|
+
switch (properties.type) {
|
|
66
65
|
case "checkbox":
|
|
67
|
-
input.checked = unwrap(
|
|
68
|
-
if (
|
|
66
|
+
input.checked = unwrap(properties.value) as unknown as boolean;
|
|
67
|
+
if (isSubscribable(properties.value)) {
|
|
69
68
|
this.subscriptions.push(
|
|
70
|
-
|
|
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(
|
|
84
|
-
if (isSubscribable(
|
|
82
|
+
input.checked = input.value === ((unwrap(properties.value)) as any as string);
|
|
83
|
+
if (isSubscribable(properties.value)) {
|
|
85
84
|
this.subscriptions.push(
|
|
86
|
-
|
|
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(
|
|
93
|
+
const value = unwrap(properties.value);
|
|
95
94
|
if (value) {
|
|
96
95
|
input.value = value as unknown as string;
|
|
97
96
|
}
|
|
98
|
-
if (
|
|
97
|
+
if (isSubscribable(properties.value)) {
|
|
99
98
|
this.subscriptions.push(
|
|
100
|
-
|
|
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(
|
|
106
|
+
const placeholder = unwrap(properties.placeholder) as unknown as string;
|
|
108
107
|
if (placeholder) {
|
|
109
108
|
input.placeholder = placeholder;
|
|
110
109
|
}
|
|
111
|
-
if (isSubscribable(
|
|
110
|
+
if (isSubscribable(properties.placeholder)) {
|
|
112
111
|
this.subscriptions.push(
|
|
113
|
-
|
|
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 ||
|
|
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 (
|
|
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 (
|
|
166
|
-
if (!await
|
|
167
|
-
input.value = unwrap(
|
|
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 (
|
|
171
|
+
if (properties.type === "integer") {
|
|
173
172
|
if (isInteger(newValue)) {
|
|
174
173
|
newValue = parseInt(newValue);
|
|
175
174
|
} else {
|
|
176
|
-
input.value = unwrap(
|
|
175
|
+
input.value = unwrap(properties.value) as any as string;
|
|
177
176
|
return;
|
|
178
177
|
}
|
|
179
178
|
}
|
|
180
179
|
|
|
181
|
-
if (
|
|
180
|
+
if (properties.type === "float") {
|
|
182
181
|
if (isFloat(newValue)) {
|
|
183
182
|
newValue = parseFloat(newValue);
|
|
184
183
|
} else {
|
|
185
|
-
input.value = unwrap(
|
|
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 (
|
|
192
|
-
if ((event.type === "change" &&
|
|
193
|
-
(event.type === "input" &&
|
|
194
|
-
|
|
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
|
-
|
|
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
|
|
206
|
-
return new
|
|
203
|
+
export function createInput<TValue>(properties: IInputProperties<TValue>) {
|
|
204
|
+
return new InputElement<TValue>(properties);
|
|
207
205
|
}
|
|
208
206
|
|
|
209
|
-
export class
|
|
210
|
-
constructor(properties:
|
|
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 |
|
|
213
|
+
value?: TValue | ISubscribable<TValue>;
|
|
216
214
|
inputValidator?: (event: Event, inputViewModel: InputProperties<TValue>, value: string) => Promise<boolean>;
|
|
217
|
-
placeholder?: 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
|
-
|
|
226
|
-
|
|
227
|
-
|
|
223
|
+
registerElement(
|
|
224
|
+
InputProperties.prototype.constructor,
|
|
225
|
+
InputElement
|
|
228
226
|
);
|