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,28 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ObservableProperty, ObservableArrayProperty, isObservableProperty, observableArrayProperty, observableProperty } from "../../../framework/observable";
|
|
1
|
+
import { Element, registerElement } from "../../../framework/element";
|
|
2
|
+
import { Properties, IProperties, extendProperties } from "../../../framework/properties";
|
|
3
|
+
import { ISubscribable, unwrap, isSubscribable, isObservableValue } from "../../../framework/observable";
|
|
5
4
|
|
|
6
|
-
export interface
|
|
7
|
-
value?: TValue |
|
|
8
|
-
items?: Array<TItem> |
|
|
5
|
+
export interface ISelectProperties<TItem, TValue, TSetter = TValue> extends IProperties {
|
|
6
|
+
value?: TValue | ISubscribable<TValue>;
|
|
7
|
+
items?: Array<TItem> | ISubscribable<Array<TItem>>;
|
|
9
8
|
textFunction: (item: TItem) => string;
|
|
10
9
|
valueFunction: (item: TItem) => TValue;
|
|
11
10
|
setFunction?: (item: TItem) => TSetter;
|
|
12
|
-
inputValidator?: (event: Event, selectViewModel:
|
|
11
|
+
inputValidator?: (event: Event, selectViewModel: ISelectProperties<TItem, TValue, TSetter>, value: TValue) => Promise<boolean>;
|
|
13
12
|
emptyItemText?: string;
|
|
14
13
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
constructor(properties: SelectProperties<TItem, TValue, TSetter>) {
|
|
14
|
+
export class SelectElement<TItem, TValue, TSetter = TValue> extends Element<ISelectProperties<TItem, TValue, TSetter>> {
|
|
15
|
+
constructor(properties: ISelectProperties<TItem, TValue, TSetter>) {
|
|
18
16
|
super(
|
|
19
17
|
{
|
|
20
18
|
tagName: "select",
|
|
21
19
|
properties: extendProperties(
|
|
20
|
+
properties,
|
|
22
21
|
{
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
properties
|
|
22
|
+
elementType: "Select"
|
|
23
|
+
}
|
|
26
24
|
)
|
|
27
25
|
}
|
|
28
26
|
);
|
|
@@ -33,21 +31,21 @@ export class SelectView<TItem, TValue, TSetter = TValue> extends View<SelectProp
|
|
|
33
31
|
super.build();
|
|
34
32
|
const select = this.element as HTMLSelectElement;
|
|
35
33
|
|
|
36
|
-
const
|
|
34
|
+
const properties = this.properties;
|
|
37
35
|
|
|
38
|
-
this.setItems(unwrap(
|
|
39
|
-
if (isSubscribable(
|
|
36
|
+
this.setItems(unwrap(properties.items) as Array<TItem>);
|
|
37
|
+
if (isSubscribable(properties.items)) {
|
|
40
38
|
this.subscriptions.push(
|
|
41
|
-
|
|
39
|
+
properties.items.subscribe((items) => {
|
|
42
40
|
this.setItems(items);
|
|
43
41
|
})
|
|
44
42
|
);
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
this.setSelectedValue(unwrap(
|
|
48
|
-
if (isSubscribable(
|
|
45
|
+
this.setSelectedValue(unwrap(properties.value) as TValue);
|
|
46
|
+
if (isSubscribable(properties.value)) {
|
|
49
47
|
this.subscriptions.push(
|
|
50
|
-
|
|
48
|
+
properties.value.subscribe((value) => {
|
|
51
49
|
this.setSelectedValue(value);
|
|
52
50
|
})
|
|
53
51
|
);
|
|
@@ -64,19 +62,19 @@ export class SelectView<TItem, TValue, TSetter = TValue> extends View<SelectProp
|
|
|
64
62
|
selectedItem = this.itemDictionary[selectedValue.toString()];
|
|
65
63
|
selectedValue = this.properties.valueFunction(selectedItem);
|
|
66
64
|
}
|
|
67
|
-
if (
|
|
68
|
-
if (!await
|
|
69
|
-
select.value = unwrap(
|
|
65
|
+
if (properties.inputValidator) {
|
|
66
|
+
if (!await properties.inputValidator(event, properties, selectedValue)) {
|
|
67
|
+
select.value = unwrap(properties.value) as any as string;
|
|
70
68
|
return;
|
|
71
69
|
};
|
|
72
70
|
}
|
|
73
71
|
|
|
74
|
-
if (
|
|
75
|
-
if (
|
|
76
|
-
const setValue =
|
|
77
|
-
|
|
72
|
+
if (isObservableValue(properties.value)) {
|
|
73
|
+
if (properties.setFunction) {
|
|
74
|
+
const setValue = properties.setFunction(selectedItem) as any as TValue;
|
|
75
|
+
properties.value.setValueInAction(setValue);
|
|
78
76
|
} else {
|
|
79
|
-
|
|
77
|
+
properties.value.setValueInAction(selectedValue);
|
|
80
78
|
}
|
|
81
79
|
}
|
|
82
80
|
}
|
|
@@ -122,25 +120,25 @@ export class SelectView<TItem, TValue, TSetter = TValue> extends View<SelectProp
|
|
|
122
120
|
}
|
|
123
121
|
}
|
|
124
122
|
|
|
125
|
-
export function
|
|
126
|
-
return new
|
|
123
|
+
export function createSelect<TItem, TValue, TSetter = TValue>(properties: ISelectProperties<TItem, TValue, TSetter>) {
|
|
124
|
+
return new SelectElement(properties);
|
|
127
125
|
}
|
|
128
126
|
|
|
129
|
-
export class
|
|
130
|
-
constructor(properties:
|
|
127
|
+
export class SelectProperties<TItem, TValue, TSetter = TValue> extends Properties implements ISelectProperties<TItem, TValue, TSetter> {
|
|
128
|
+
constructor(properties: ISelectProperties<TItem, TValue, TSetter>) {
|
|
131
129
|
super();
|
|
132
130
|
this.setProperties(this, properties);
|
|
133
131
|
}
|
|
134
|
-
value?: TValue |
|
|
135
|
-
items?: Array<TItem> |
|
|
132
|
+
value?: TValue | ISubscribable<TValue>;
|
|
133
|
+
items?: Array<TItem> | ISubscribable<Array<TItem>>;
|
|
136
134
|
textFunction: (item: TItem) => string;
|
|
137
135
|
valueFunction: (item: TItem) => TValue;
|
|
138
136
|
setFunction?: (item: TItem) => TSetter;
|
|
139
|
-
inputValidator?: (event: Event, selectViewModel:
|
|
137
|
+
inputValidator?: (event: Event, selectViewModel: ISelectProperties<TItem, TValue, TSetter>, value: TValue) => Promise<boolean>;
|
|
140
138
|
emptyItemText?: string;
|
|
141
139
|
}
|
|
142
140
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
141
|
+
registerElement(
|
|
142
|
+
SelectProperties.prototype.constructor,
|
|
143
|
+
SelectElement
|
|
146
144
|
);
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Element, registerElement } from "../../../framework/element";
|
|
2
|
+
import { Properties, IProperties, extendProperties } from "../../../framework/properties";
|
|
3
3
|
|
|
4
|
-
export interface
|
|
4
|
+
export interface ISpanProperties extends IProperties {
|
|
5
5
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export class
|
|
9
|
-
constructor(properties:
|
|
8
|
+
export class SpanElement extends Element<ISpanProperties> {
|
|
9
|
+
constructor(properties: ISpanProperties) {
|
|
10
10
|
super(
|
|
11
11
|
{
|
|
12
12
|
tagName: "span",
|
|
13
13
|
properties: extendProperties(
|
|
14
|
+
properties,
|
|
14
15
|
{
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
properties
|
|
16
|
+
elementType: "Span"
|
|
17
|
+
}
|
|
18
18
|
)
|
|
19
19
|
}
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export function
|
|
25
|
-
return new
|
|
24
|
+
export function createSpan(properties: ISpanProperties) {
|
|
25
|
+
return new SpanElement(properties);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export class
|
|
28
|
+
export class SpanProperties extends Properties implements ISpanProperties {
|
|
29
29
|
constructor(properties: SpanProperties) {
|
|
30
30
|
super();
|
|
31
31
|
this.setProperties(this, properties);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
registerElement(
|
|
36
|
+
SpanProperties.prototype.constructor,
|
|
37
|
+
SpanElement
|
|
38
38
|
);
|
package/src/controls/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as codeMirror from "./codeMirror/index";
|
|
2
2
|
import * as custom from "./custom/index";
|
|
3
3
|
import * as html from "./html/index";
|
|
4
|
-
import * as
|
|
4
|
+
import * as jsonViewerAwesome from "./jsonViewerAwesome/index";
|
|
5
5
|
import * as kendo from "./kendo/index";
|
|
6
6
|
import * as leaflet from "./leaflet/index";
|
|
7
7
|
import * as svg from "./svg/index";
|
|
@@ -9,7 +9,7 @@ import * as svg from "./svg/index";
|
|
|
9
9
|
export { codeMirror };
|
|
10
10
|
export { custom };
|
|
11
11
|
export { html };
|
|
12
|
-
export {
|
|
12
|
+
export { jsonViewerAwesome };
|
|
13
13
|
export { kendo };
|
|
14
14
|
export { leaflet };
|
|
15
15
|
export { svg };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Element, registerElement } from "../../../framework/element";
|
|
2
|
+
import { Properties, IProperties, extendProperties } from "../../../framework/properties";
|
|
3
|
+
import { ISubscribable, unwrap, isSubscribable } from "../../../framework/observable";
|
|
4
4
|
import { JSONFormatter } from "json-viewer-awesome/lib/json-formatter";
|
|
5
5
|
|
|
6
|
-
export interface
|
|
7
|
-
json: object |
|
|
6
|
+
export interface IJsonFormatterProperties extends IProperties {
|
|
7
|
+
json: object | ISubscribable<object>;
|
|
8
8
|
showArrayIndex?: boolean;
|
|
9
9
|
quotesOnKeys?: boolean;
|
|
10
10
|
displayDataTypes?: boolean;
|
|
@@ -13,16 +13,16 @@ export interface JsonFormatterProperties extends Properties {
|
|
|
13
13
|
collapsed?: boolean;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export class
|
|
17
|
-
constructor(properties:
|
|
16
|
+
export class JsonFormatterElement extends Element<IJsonFormatterProperties> {
|
|
17
|
+
constructor(properties: IJsonFormatterProperties) {
|
|
18
18
|
super(
|
|
19
19
|
{
|
|
20
20
|
tagName: "div",
|
|
21
21
|
properties: extendProperties(
|
|
22
|
+
properties,
|
|
22
23
|
{
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
properties
|
|
24
|
+
elementType: "JsonFormatter"
|
|
25
|
+
}
|
|
26
26
|
)
|
|
27
27
|
}
|
|
28
28
|
);
|
|
@@ -31,12 +31,12 @@ export class JsonFormatterView extends View<JsonFormatterProperties> {
|
|
|
31
31
|
build(): void {
|
|
32
32
|
super.build();
|
|
33
33
|
|
|
34
|
-
const
|
|
35
|
-
this.setJson(unwrap(
|
|
36
|
-
if (
|
|
34
|
+
const properties = this.properties;
|
|
35
|
+
this.setJson(unwrap(properties.json));
|
|
36
|
+
if (isSubscribable(properties.json)) {
|
|
37
37
|
this.subscriptions.push(
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
properties.json.subscribe((json)=>{
|
|
39
|
+
this.setJson(json as any as object);
|
|
40
40
|
})
|
|
41
41
|
);
|
|
42
42
|
}
|
|
@@ -67,16 +67,16 @@ export class JsonFormatterView extends View<JsonFormatterProperties> {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
export function
|
|
71
|
-
return new
|
|
70
|
+
export function createJsonFormatter(properties: IJsonFormatterProperties) {
|
|
71
|
+
return new JsonFormatterElement(properties);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
export class
|
|
75
|
-
constructor(properties:
|
|
74
|
+
export class JsonFormatterProperties extends Properties implements IJsonFormatterProperties {
|
|
75
|
+
constructor(properties: IJsonFormatterProperties) {
|
|
76
76
|
super();
|
|
77
77
|
this.setProperties(this, properties);
|
|
78
78
|
}
|
|
79
|
-
json: object |
|
|
79
|
+
json: object | ISubscribable<object>;
|
|
80
80
|
showArrayIndex?: boolean;
|
|
81
81
|
quotesOnKeys?: boolean;
|
|
82
82
|
displayDataTypes?: boolean;
|
|
@@ -85,7 +85,7 @@ export class JsonFormatterViewModel extends ViewModel implements JsonFormatterPr
|
|
|
85
85
|
collapsed?: boolean;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
registerElement(
|
|
89
|
+
JsonFormatterProperties.prototype.constructor,
|
|
90
|
+
JsonFormatterElement
|
|
91
91
|
);
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import * as kendo from "@progress/kendo-ui/js/dataviz
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import * as kendo from "@progress/kendo-ui/js/kendo.dataviz.chart";
|
|
2
|
+
import { Element } from "../../../framework/element";
|
|
3
|
+
import { IProperties, extendProperties } from "../../../framework/properties";
|
|
4
|
+
import { ISubscribable, unwrap, isSubscribable } from "../../../framework/observable";
|
|
5
5
|
|
|
6
|
-
export interface
|
|
7
|
-
data?: Array<any> |
|
|
6
|
+
export interface IChartProperties extends IProperties {
|
|
7
|
+
data?: Array<any> | ISubscribable<Array<any>>;
|
|
8
8
|
chartArea?: kendo.dataviz.ui.ChartChartArea | undefined;
|
|
9
|
-
series?: kendo.dataviz.ui.ChartSeriesItem[] |
|
|
10
|
-
categoryAxis?: kendo.dataviz.ui.ChartCategoryAxisItem | kendo.dataviz.ui.ChartCategoryAxisItem[] |
|
|
9
|
+
series?: kendo.dataviz.ui.ChartSeriesItem[] | ISubscribable<kendo.dataviz.ui.ChartSeriesItem[]>;
|
|
10
|
+
categoryAxis?: kendo.dataviz.ui.ChartCategoryAxisItem | kendo.dataviz.ui.ChartCategoryAxisItem[] | ISubscribable<kendo.dataviz.ui.ChartCategoryAxisItem | kendo.dataviz.ui.ChartCategoryAxisItem[]>;
|
|
11
11
|
valueAxis?: kendo.dataviz.ui.ChartValueAxisItem | kendo.dataviz.ui.ChartValueAxisItem[] | undefined;
|
|
12
12
|
legend?: kendo.dataviz.ui.ChartLegend | undefined;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export class
|
|
16
|
-
constructor(properties:
|
|
15
|
+
export class ChartElement extends Element<IChartProperties>{
|
|
16
|
+
constructor(properties: IChartProperties) {
|
|
17
17
|
super(
|
|
18
18
|
{
|
|
19
19
|
tagName: "div",
|
|
20
20
|
properties: extendProperties(
|
|
21
|
+
properties,
|
|
21
22
|
{
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
properties
|
|
23
|
+
elementType: "KendoChart"
|
|
24
|
+
}
|
|
25
25
|
)
|
|
26
26
|
}
|
|
27
27
|
);
|
|
@@ -33,19 +33,19 @@ export class ChartView extends View<ChartProperties>{
|
|
|
33
33
|
build(): void {
|
|
34
34
|
super.build();
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const properties = this.properties;
|
|
37
37
|
|
|
38
|
-
if (
|
|
38
|
+
if (properties.data) {
|
|
39
39
|
this.dataSource = new kendo.data.DataSource(
|
|
40
40
|
{
|
|
41
|
-
data: unwrap(
|
|
41
|
+
data: unwrap(properties.data)
|
|
42
42
|
}
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
if (isSubscribable(
|
|
46
|
+
if (isSubscribable(properties.data)) {
|
|
47
47
|
this.subscriptions.push(
|
|
48
|
-
|
|
48
|
+
properties.data.subscribe((data) => {
|
|
49
49
|
this.dataSource.data(data);
|
|
50
50
|
})
|
|
51
51
|
);
|
|
@@ -56,19 +56,19 @@ export class ChartView extends View<ChartProperties>{
|
|
|
56
56
|
this.element,
|
|
57
57
|
{
|
|
58
58
|
autoBind: false,
|
|
59
|
-
legend:
|
|
59
|
+
legend: properties.legend,
|
|
60
60
|
dataSource: this.dataSource,
|
|
61
|
-
chartArea:
|
|
62
|
-
series: unwrap(
|
|
63
|
-
categoryAxis: unwrap(
|
|
64
|
-
valueAxis:
|
|
61
|
+
chartArea: properties.chartArea,
|
|
62
|
+
series: unwrap(properties.series),
|
|
63
|
+
categoryAxis: unwrap(properties.categoryAxis),
|
|
64
|
+
valueAxis: properties.valueAxis
|
|
65
65
|
}
|
|
66
66
|
);
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
-
if (isSubscribable(
|
|
69
|
+
if (isSubscribable(properties.series)) {
|
|
70
70
|
this.subscriptions.push(
|
|
71
|
-
|
|
71
|
+
properties.series.subscribe((series) => {
|
|
72
72
|
if (this.chart) {
|
|
73
73
|
this.chart.setOptions({
|
|
74
74
|
series: series
|
|
@@ -78,20 +78,20 @@ export class ChartView extends View<ChartProperties>{
|
|
|
78
78
|
);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
if (isSubscribable(
|
|
81
|
+
if (isSubscribable(properties.categoryAxis)) {
|
|
82
82
|
this.subscriptions.push(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
properties.categoryAxis.subscribe((categoryAxis)=>{
|
|
84
|
+
if (this.chart) {
|
|
85
|
+
this.chart.setOptions({
|
|
86
|
+
categoryAxis: categoryAxis
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
89
|
})
|
|
90
90
|
);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
export function
|
|
96
|
-
return new
|
|
95
|
+
export function createChart(properties: IChartProperties) {
|
|
96
|
+
return new ChartElement(properties);
|
|
97
97
|
}
|
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
import * as kendo from "@progress/kendo-ui/js/kendo.editor.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
value?: string | ObservableProperty<string>;
|
|
2
|
+
import { Element, element } from "../../../framework/element";
|
|
3
|
+
import { IProperties, extendProperties } from "../../../framework/properties";
|
|
4
|
+
import { isSubscribable, ISubscribable, observableValue, isObservableValue, computed, unwrap } from "../../../framework/observable";
|
|
5
|
+
import { createDiv } from "../../html/Div/Div";
|
|
6
|
+
import { createButton } from "../../html/Button/Button";
|
|
7
|
+
import { formatHtml } from "../../../utilities/formatting/formatting";
|
|
8
|
+
|
|
9
|
+
export interface IEditorProperties extends IProperties {
|
|
10
|
+
value?: string | ISubscribable<string>;
|
|
12
11
|
tools?: string[] | kendo.ui.EditorTool[];
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
export class
|
|
16
|
-
constructor(properties:
|
|
14
|
+
export class EditorElement extends Element<IEditorProperties> {
|
|
15
|
+
constructor(properties: IEditorProperties) {
|
|
17
16
|
super(
|
|
18
17
|
{
|
|
19
18
|
tagName: "div",
|
|
20
19
|
properties: extendProperties(
|
|
20
|
+
properties,
|
|
21
21
|
{
|
|
22
|
-
|
|
22
|
+
elementType: "KendoEditor",
|
|
23
23
|
style: {
|
|
24
24
|
display: "flex",
|
|
25
25
|
flexDirection: "column"
|
|
26
26
|
}
|
|
27
|
-
}
|
|
28
|
-
properties
|
|
27
|
+
}
|
|
29
28
|
)
|
|
30
29
|
}
|
|
31
30
|
);
|
|
@@ -38,30 +37,32 @@ export class EditorView extends View<EditorProperties> {
|
|
|
38
37
|
|
|
39
38
|
const viewModel = this.properties;
|
|
40
39
|
|
|
41
|
-
const htmlMode =
|
|
42
|
-
|
|
43
|
-
const divHeader =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
40
|
+
const htmlMode = observableValue<boolean>(false);
|
|
41
|
+
|
|
42
|
+
const divHeader = createDiv(
|
|
43
|
+
{
|
|
44
|
+
children: [
|
|
45
|
+
createButton({
|
|
46
|
+
content: computed<string>(() => {
|
|
47
|
+
return htmlMode() ? "wysiwyg" : "view html source";
|
|
48
|
+
}),
|
|
49
|
+
eventListeners: {
|
|
50
|
+
click: {
|
|
51
|
+
listener: () => {
|
|
52
|
+
htmlMode.setValue(!htmlMode());
|
|
53
|
+
}
|
|
53
54
|
}
|
|
55
|
+
},
|
|
56
|
+
style: {
|
|
57
|
+
width: "120px",
|
|
58
|
+
marginTop: "2px"
|
|
54
59
|
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
})
|
|
61
|
-
]
|
|
62
|
-
}).render();
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
).render();
|
|
63
64
|
|
|
64
|
-
const
|
|
65
|
+
const div = createDiv({
|
|
65
66
|
visible: computed<boolean>(() => {
|
|
66
67
|
return !htmlMode();
|
|
67
68
|
}),
|
|
@@ -70,7 +71,7 @@ export class EditorView extends View<EditorProperties> {
|
|
|
70
71
|
}
|
|
71
72
|
}).render();
|
|
72
73
|
|
|
73
|
-
const textAreaElement =
|
|
74
|
+
const textAreaElement = element({
|
|
74
75
|
tagName: "textarea",
|
|
75
76
|
properties: {
|
|
76
77
|
visible: htmlMode,
|
|
@@ -82,25 +83,26 @@ export class EditorView extends View<EditorProperties> {
|
|
|
82
83
|
}
|
|
83
84
|
}).render() as HTMLTextAreaElement;
|
|
84
85
|
|
|
85
|
-
this.element.appendChild(
|
|
86
|
+
this.element.appendChild(div);
|
|
86
87
|
this.element.appendChild(textAreaElement);
|
|
87
88
|
this.element.appendChild(divHeader);
|
|
88
89
|
|
|
89
|
-
const html = unwrap(viewModel.value);
|
|
90
|
-
|
|
91
|
-
textAreaElement.value =
|
|
90
|
+
const html = unwrap<string>(viewModel.value);
|
|
91
|
+
div.innerHTML = html;
|
|
92
|
+
textAreaElement.value = formatHtml(html);
|
|
93
|
+
|
|
94
|
+
if (isSubscribable(viewModel.value)) {
|
|
92
95
|
|
|
93
|
-
if (isObservable(viewModel.value)) {
|
|
94
96
|
this.subscriptions.push(
|
|
95
97
|
viewModel.value.subscribe((value) => {
|
|
96
|
-
|
|
98
|
+
div.innerHTML = value;
|
|
97
99
|
textAreaElement.value = value;
|
|
98
100
|
})
|
|
99
101
|
);
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
this.editor = new kendo.ui.Editor(
|
|
103
|
-
|
|
105
|
+
createDiv,
|
|
104
106
|
{
|
|
105
107
|
tools: viewModel.tools
|
|
106
108
|
}
|
|
@@ -109,34 +111,22 @@ export class EditorView extends View<EditorProperties> {
|
|
|
109
111
|
this.editor.bind(
|
|
110
112
|
"change",
|
|
111
113
|
() => {
|
|
112
|
-
if (
|
|
113
|
-
viewModel.value.
|
|
114
|
+
if (isObservableValue(viewModel.value)) {
|
|
115
|
+
viewModel.value.setValue(div.innerHTML);
|
|
114
116
|
}
|
|
115
117
|
}
|
|
116
118
|
);
|
|
117
119
|
|
|
118
|
-
textAreaElement.addEventListener(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export function editorView(properties: EditorProperties) {
|
|
127
|
-
return new EditorView(properties);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export class EditorViewModel extends ViewModel implements EditorProperties {
|
|
131
|
-
constructor(properties: EditorProperties) {
|
|
132
|
-
super();
|
|
133
|
-
this.setProperties(this, properties);
|
|
120
|
+
textAreaElement.addEventListener(
|
|
121
|
+
"change",
|
|
122
|
+
() => {
|
|
123
|
+
if (isObservableValue(viewModel.value)) {
|
|
124
|
+
viewModel.value.setValue(textAreaElement.value);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
134
127
|
}
|
|
135
|
-
value?: string | ObservableProperty<string>;
|
|
136
|
-
tools?: string[] | kendo.ui.EditorTool[];
|
|
137
128
|
}
|
|
138
129
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
)
|
|
130
|
+
export function createEditor(properties: IEditorProperties) {
|
|
131
|
+
return new EditorElement(properties);
|
|
132
|
+
}
|