jpf 5.0.62 → 5.0.64
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 +4 -5
- package/dist/controls/codeMirror/Editor/Editor.js +8 -9
- package/dist/controls/codeMirror/Editor/Editor.js.map +1 -1
- package/dist/controls/custom/FileSelector/FileSelector.d.ts +3 -4
- package/dist/controls/custom/FileSelector/FileSelector.js +5 -6
- package/dist/controls/custom/FileSelector/FileSelector.js.map +1 -1
- package/dist/controls/custom/LabeledControl/LabeledControl.d.ts +5 -6
- package/dist/controls/custom/LabeledControl/LabeledControl.js +3 -4
- package/dist/controls/custom/LabeledControl/LabeledControl.js.map +1 -1
- package/dist/controls/custom/ListItem/ListItem.d.ts +8 -9
- package/dist/controls/custom/ListItem/ListItem.js +8 -9
- package/dist/controls/custom/ListItem/ListItem.js.map +1 -1
- package/dist/controls/html/Button/Button.d.ts +6 -7
- package/dist/controls/html/Button/Button.js +8 -9
- package/dist/controls/html/Button/Button.js.map +1 -1
- package/dist/controls/html/Div/Div.d.ts +4 -5
- package/dist/controls/html/Div/Div.js +2 -3
- package/dist/controls/html/Div/Div.js.map +1 -1
- package/dist/controls/html/Image/Image.d.ts +4 -5
- package/dist/controls/html/Image/Image.js +2 -3
- package/dist/controls/html/Image/Image.js.map +1 -1
- package/dist/controls/html/Input/Input.d.ts +4 -5
- package/dist/controls/html/Input/Input.js +23 -23
- package/dist/controls/html/Input/Input.js.map +1 -1
- package/dist/controls/html/Select/Select.d.ts +4 -5
- package/dist/controls/html/Select/Select.js +15 -16
- package/dist/controls/html/Select/Select.js.map +1 -1
- package/dist/controls/html/Span/Span.d.ts +3 -4
- package/dist/controls/html/Span/Span.js +2 -3
- package/dist/controls/html/Span/Span.js.map +1 -1
- package/dist/controls/jsonViewerAwesome/jsonFormatter/JsonFormatter.d.ts +4 -5
- package/dist/controls/jsonViewerAwesome/jsonFormatter/JsonFormatter.js +7 -8
- package/dist/controls/jsonViewerAwesome/jsonFormatter/JsonFormatter.js.map +1 -1
- package/dist/controls/kendo/Chart/Chart.d.ts +3 -4
- package/dist/controls/kendo/Chart/Chart.js +9 -10
- package/dist/controls/kendo/Chart/Chart.js.map +1 -1
- package/dist/controls/kendo/Editor/Editor.d.ts +3 -4
- package/dist/controls/kendo/Editor/Editor.js +13 -14
- package/dist/controls/kendo/Editor/Editor.js.map +1 -1
- package/dist/controls/kendo/Grid/Grid.d.ts +4 -5
- package/dist/controls/kendo/Grid/Grid.js +12 -13
- package/dist/controls/kendo/Grid/Grid.js.map +1 -1
- package/dist/controls/kendo/Menu/Menu.d.ts +3 -4
- package/dist/controls/kendo/Menu/Menu.js +9 -10
- package/dist/controls/kendo/Menu/Menu.js.map +1 -1
- package/dist/controls/kendo/Treeview/Treeview.d.ts +3 -4
- package/dist/controls/kendo/Treeview/Treeview.js +9 -10
- package/dist/controls/kendo/Treeview/Treeview.js.map +1 -1
- package/dist/controls/leaflet/LabelControl/LabelControl.d.ts +2 -3
- package/dist/controls/leaflet/LabelControl/LabelControl.js +1 -2
- package/dist/controls/leaflet/LabelControl/LabelControl.js.map +1 -1
- package/dist/controls/leaflet/Map/Map.d.ts +4 -5
- package/dist/controls/leaflet/Map/Map.js +9 -10
- package/dist/controls/leaflet/Map/Map.js.map +1 -1
- package/dist/controls/svg/Circle/Circle.d.ts +3 -4
- package/dist/controls/svg/Circle/Circle.js +1 -2
- package/dist/controls/svg/Circle/Circle.js.map +1 -1
- package/dist/controls/svg/Ellipse/Ellipse.d.ts +3 -4
- package/dist/controls/svg/Ellipse/Ellipse.js +1 -2
- package/dist/controls/svg/Ellipse/Ellipse.js.map +1 -1
- package/dist/controls/svg/ForeignObject/ForeignObject.d.ts +3 -4
- package/dist/controls/svg/ForeignObject/ForeignObject.js +1 -2
- package/dist/controls/svg/ForeignObject/ForeignObject.js.map +1 -1
- package/dist/controls/svg/Group/Group.d.ts +3 -4
- package/dist/controls/svg/Group/Group.js +1 -2
- package/dist/controls/svg/Group/Group.js.map +1 -1
- package/dist/controls/svg/Line/Line.d.ts +3 -4
- package/dist/controls/svg/Line/Line.js +1 -2
- package/dist/controls/svg/Line/Line.js.map +1 -1
- package/dist/controls/svg/Pattern/Pattern.d.ts +3 -4
- package/dist/controls/svg/Pattern/Pattern.js +1 -2
- package/dist/controls/svg/Pattern/Pattern.js.map +1 -1
- package/dist/controls/svg/Polygon/Polygon.d.ts +3 -4
- package/dist/controls/svg/Polygon/Polygon.js +3 -4
- package/dist/controls/svg/Polygon/Polygon.js.map +1 -1
- package/dist/controls/svg/Polyline/Polyline.d.ts +3 -4
- package/dist/controls/svg/Polyline/Polyline.js +1 -2
- package/dist/controls/svg/Polyline/Polyline.js.map +1 -1
- package/dist/controls/svg/Rectangle/Rectangle.d.ts +3 -4
- package/dist/controls/svg/Rectangle/Rectangle.js +1 -2
- package/dist/controls/svg/Rectangle/Rectangle.js.map +1 -1
- package/dist/controls/svg/Svg/Svg.d.ts +3 -4
- package/dist/controls/svg/Svg/Svg.js +1 -2
- package/dist/controls/svg/Svg/Svg.js.map +1 -1
- package/dist/controls/svg/Text/Text.d.ts +3 -4
- package/dist/controls/svg/Text/Text.js +1 -2
- package/dist/controls/svg/Text/Text.js.map +1 -1
- package/dist/controls/svg/Title/Title.d.ts +3 -4
- package/dist/controls/svg/Title/Title.js +1 -2
- package/dist/controls/svg/Title/Title.js.map +1 -1
- package/dist/controls/svg/svg.d.ts +1 -1
- package/dist/controls/svg/svg.js +5 -5
- package/dist/controls/svg/svg.js.map +1 -1
- package/dist/framework/attributes.d.ts +1 -1
- package/dist/framework/css.d.ts +1 -4
- package/dist/framework/element.d.ts +48 -15
- package/dist/framework/element.js +279 -29
- package/dist/framework/element.js.map +1 -1
- package/dist/framework/event.js.map +1 -1
- package/dist/framework/observable.d.ts +41 -0
- package/dist/framework/observable.js +46 -0
- package/dist/framework/observable.js.map +1 -0
- package/dist/framework/observablelmplementations.d.ts +1 -24
- package/dist/framework/observablelmplementations.js +0 -110
- package/dist/framework/observablelmplementations.js.map +1 -1
- package/dist/framework/properties.d.ts +1 -40
- package/dist/framework/properties.js +0 -265
- package/dist/framework/properties.js.map +1 -1
- package/dist/framework/style.d.ts +1 -328
- package/dist/index.d.ts +6 -10
- package/dist/index.js +7 -11
- package/dist/index.js.map +1 -1
- package/dist/utilities/object/object.d.ts +5 -0
- package/dist/utilities/object/object.js +47 -0
- package/dist/utilities/object/object.js.map +1 -0
- package/dist/utilities/value/value.d.ts +1 -0
- package/dist/utilities/value/value.js +7 -0
- package/dist/utilities/value/value.js.map +1 -0
- package/package.json +1 -1
- package/src/controls/codeMirror/Editor/Editor.ts +9 -11
- package/src/controls/custom/FileSelector/FileSelector.ts +5 -6
- package/src/controls/custom/LabeledControl/LabeledControl.ts +5 -6
- package/src/controls/custom/ListItem/ListItem.ts +13 -15
- package/src/controls/html/Button/Button.ts +13 -15
- package/src/controls/html/Div/Div.ts +4 -5
- package/src/controls/html/Image/Image.ts +4 -5
- package/src/controls/html/Input/Input.ts +21 -22
- package/src/controls/html/Select/Select.ts +16 -18
- package/src/controls/html/Span/Span.ts +3 -4
- package/src/controls/jsonViewerAwesome/jsonFormatter/JsonFormatter.ts +10 -12
- package/src/controls/kendo/Chart/Chart.ts +17 -19
- package/src/controls/kendo/Editor/Editor.ts +14 -16
- package/src/controls/kendo/Grid/Grid.ts +13 -15
- package/src/controls/kendo/Menu/Menu.ts +11 -13
- package/src/controls/kendo/Treeview/Treeview.ts +9 -11
- package/src/controls/leaflet/LabelControl/LabelControl.ts +4 -5
- package/src/controls/leaflet/Map/Map.ts +10 -12
- package/src/controls/svg/Circle/Circle.ts +3 -4
- package/src/controls/svg/Ellipse/Ellipse.ts +3 -4
- package/src/controls/svg/ForeignObject/ForeignObject.ts +3 -4
- package/src/controls/svg/Group/Group.ts +3 -4
- package/src/controls/svg/Line/Line.ts +3 -4
- package/src/controls/svg/Pattern/Pattern.ts +3 -4
- package/src/controls/svg/Polygon/Polygon.ts +4 -6
- package/src/controls/svg/Polyline/Polyline.ts +3 -4
- package/src/controls/svg/Rectangle/Rectangle.ts +3 -4
- package/src/controls/svg/Svg/Svg.ts +3 -4
- package/src/controls/svg/Text/Text.ts +3 -4
- package/src/controls/svg/Title/Title.ts +3 -4
- package/src/controls/svg/svg.ts +5 -6
- package/src/framework/attributes.ts +1 -47
- package/src/framework/css.ts +3 -5
- package/src/framework/element.ts +380 -44
- package/src/framework/event.ts +0 -2
- package/src/framework/observable.ts +100 -0
- package/src/framework/style.ts +1556 -1556
- package/src/index.ts +16 -11
- package/src/utilities/object/object.ts +56 -0
- package/src/utilities/value/value.ts +3 -0
- package/src/framework/observableInterfaces.ts +0 -39
- package/src/framework/observablelmplementations.ts +0 -135
- package/src/framework/properties.ts +0 -344
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { Element, getElement, addElementToDictionary } from "../../../framework/element";
|
|
2
|
-
import {
|
|
3
|
-
import { isSubscribable, unwrap } from "../../../framework/observablelmplementations";
|
|
4
|
-
import { ISubscribable } from "../../../framework/observableInterfaces";
|
|
1
|
+
import { Element,ElementProperties, IElementProperties, extendProperties, getElement, addElementToDictionary } from "../../../framework/element";
|
|
2
|
+
import { ISubscribable , observable} from "../../../framework/observable";
|
|
5
3
|
|
|
6
4
|
//Do not change property names since they have to correspond to kendo listItems
|
|
7
5
|
//so this type can be used in kendo list controls like menu and tree
|
|
8
6
|
|
|
9
|
-
export interface IListItemProperties extends
|
|
7
|
+
export interface IListItemProperties extends IElementProperties {
|
|
10
8
|
id: number | string;
|
|
11
|
-
text?: string | ISubscribable<string> |
|
|
9
|
+
text?: string | ISubscribable<string> | ElementProperties;
|
|
12
10
|
select?: () => void;
|
|
13
11
|
order?: number | string;
|
|
14
12
|
}
|
|
@@ -39,8 +37,8 @@ export class ListItemElement extends Element<IListItemProperties> {
|
|
|
39
37
|
|
|
40
38
|
const properties = this.properties;
|
|
41
39
|
|
|
42
|
-
if (isSubscribable(properties.text)) {
|
|
43
|
-
this.setContent(unwrap(properties.text));
|
|
40
|
+
if (observable.isSubscribable(properties.text)) {
|
|
41
|
+
this.setContent(observable.unwrap(properties.text));
|
|
44
42
|
this.disposers.push(
|
|
45
43
|
properties.text.subscribe((text) => {
|
|
46
44
|
this.setContent(text);
|
|
@@ -51,10 +49,10 @@ export class ListItemElement extends Element<IListItemProperties> {
|
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
51
|
|
|
54
|
-
private setContent(content: string |
|
|
52
|
+
private setContent(content: string | ElementProperties) {
|
|
55
53
|
if (typeof content === "string") {
|
|
56
|
-
this.
|
|
57
|
-
} else if (content instanceof
|
|
54
|
+
this.htmlElement.innerHTML = content;
|
|
55
|
+
} else if (content instanceof ElementProperties) {
|
|
58
56
|
this.setChildren(getElement(content));
|
|
59
57
|
}
|
|
60
58
|
}
|
|
@@ -64,13 +62,13 @@ export function createListItem(properties: IListItemProperties) {
|
|
|
64
62
|
return new ListItemElement(properties);
|
|
65
63
|
}
|
|
66
64
|
|
|
67
|
-
export class ListItemProperties extends
|
|
65
|
+
export class ListItemProperties extends ElementProperties implements IListItemProperties {
|
|
68
66
|
constructor(properties: IListItemProperties) {
|
|
69
67
|
super();
|
|
70
68
|
this.setProperties(this, properties);
|
|
71
69
|
}
|
|
72
70
|
id: number | string;
|
|
73
|
-
text?: string |
|
|
71
|
+
text?: string | ElementProperties;
|
|
74
72
|
select?: () => void;
|
|
75
73
|
order?: number | string;
|
|
76
74
|
}
|
|
@@ -80,13 +78,13 @@ addElementToDictionary(
|
|
|
80
78
|
ListItemElement
|
|
81
79
|
);
|
|
82
80
|
|
|
83
|
-
export class HierarchicalListItemProperties extends
|
|
81
|
+
export class HierarchicalListItemProperties extends ElementProperties implements IHierarchicalListItemProperties {
|
|
84
82
|
constructor(properties: IHierarchicalListItemProperties) {
|
|
85
83
|
super();
|
|
86
84
|
this.setProperties(this, properties);
|
|
87
85
|
}
|
|
88
86
|
id: number | string;
|
|
89
|
-
text?: string |
|
|
87
|
+
text?: string | ElementProperties;
|
|
90
88
|
select?: () => void;
|
|
91
89
|
order?: number | string;
|
|
92
90
|
parentId?: number | string;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ISubscribable } from "../../../framework/observableInterfaces";
|
|
4
|
-
import { isSubscribable, unwrap } from "../../../framework/observablelmplementations";
|
|
1
|
+
import { Element, getElement, addElementToDictionary,ElementProperties, IElementProperties, extendProperties } from "../../../framework/element";
|
|
2
|
+
import { ISubscribable, observable } from "../../../framework/observable";
|
|
5
3
|
|
|
6
|
-
export interface IButtonProperties extends
|
|
7
|
-
content?: string |
|
|
4
|
+
export interface IButtonProperties extends IElementProperties {
|
|
5
|
+
content?: string | ElementProperties | ISubscribable<string | ElementProperties>;
|
|
8
6
|
}
|
|
9
7
|
|
|
10
8
|
export class ButtonElement extends Element<IButtonProperties> {
|
|
@@ -27,9 +25,9 @@ export class ButtonElement extends Element<IButtonProperties> {
|
|
|
27
25
|
|
|
28
26
|
const properties = this.properties;
|
|
29
27
|
if (properties.content) {
|
|
30
|
-
this.buildContent(unwrap(properties.content));
|
|
28
|
+
this.buildContent(observable.unwrap(properties.content));
|
|
31
29
|
|
|
32
|
-
if (isSubscribable(properties.content)) {
|
|
30
|
+
if (observable.isSubscribable(properties.content)) {
|
|
33
31
|
this.disposers.push(
|
|
34
32
|
properties.content.subscribe((content) => {
|
|
35
33
|
this.buildContent(content);
|
|
@@ -39,15 +37,15 @@ export class ButtonElement extends Element<IButtonProperties> {
|
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
39
|
|
|
42
|
-
private buildContent(content: string |
|
|
40
|
+
private buildContent(content: string | ElementProperties) {
|
|
43
41
|
if (content == null || content === undefined) {
|
|
44
|
-
this.
|
|
42
|
+
this.htmlElement.innerText = null;
|
|
45
43
|
}
|
|
46
44
|
else if (typeof content === "string") {
|
|
47
|
-
this.
|
|
45
|
+
this.htmlElement.innerText = content;
|
|
48
46
|
}
|
|
49
|
-
else if (content instanceof
|
|
50
|
-
this.setChildren(getElement(content as
|
|
47
|
+
else if (content instanceof ElementProperties) {
|
|
48
|
+
this.setChildren(getElement(content as ElementProperties));
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
51
|
}
|
|
@@ -56,12 +54,12 @@ export function createButton(properties: IButtonProperties) {
|
|
|
56
54
|
return new ButtonElement(properties);
|
|
57
55
|
}
|
|
58
56
|
|
|
59
|
-
export class ButtonProperties extends
|
|
57
|
+
export class ButtonProperties extends ElementProperties implements IButtonProperties {
|
|
60
58
|
constructor(properties: IButtonProperties) {
|
|
61
59
|
super();
|
|
62
60
|
this.setProperties(this, properties);
|
|
63
61
|
}
|
|
64
|
-
content?: string |
|
|
62
|
+
content?: string | ElementProperties | ISubscribable<string | ElementProperties>;
|
|
65
63
|
}
|
|
66
64
|
|
|
67
65
|
addElementToDictionary(
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Element, IElement, addElementToDictionary } from "../../../framework/element";
|
|
2
|
-
import {
|
|
3
|
-
import { ISubscribable } from "../../../framework/observableInterfaces";
|
|
1
|
+
import { Element, ElementProperties, IElement, IElementProperties, extendProperties, addElementToDictionary } from "../../../framework/element";
|
|
2
|
+
import { ISubscribable } from "../../../framework/observable";
|
|
4
3
|
|
|
5
|
-
export interface IDivProperties extends
|
|
4
|
+
export interface IDivProperties extends IElementProperties {
|
|
6
5
|
children?: Array<IElement> | ISubscribable<Array<IElement>>;
|
|
7
6
|
}
|
|
8
7
|
export class DivElement extends Element<IDivProperties> {
|
|
@@ -26,7 +25,7 @@ export function createDiv(properties: IDivProperties) {
|
|
|
26
25
|
return new DivElement(properties);
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
export class DivProperties extends
|
|
28
|
+
export class DivProperties extends ElementProperties implements IDivProperties {
|
|
30
29
|
constructor(properties: IDivProperties) {
|
|
31
30
|
super();
|
|
32
31
|
this.setProperties(this, properties);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Element, addElementToDictionary } from "../../../framework/element";
|
|
2
|
-
import {
|
|
3
|
-
import { ISubscribable } from "../../../framework/observableInterfaces";
|
|
1
|
+
import { Element, addElementToDictionary,ElementProperties, IElementProperties, extendProperties } from "../../../framework/element";
|
|
2
|
+
import { ISubscribable } from "../../../framework/observable";
|
|
4
3
|
|
|
5
|
-
export interface IImageProperties extends
|
|
4
|
+
export interface IImageProperties extends IElementProperties {
|
|
6
5
|
src: string | ISubscribable<string>;
|
|
7
6
|
alt: string | ISubscribable<string>;
|
|
8
7
|
}
|
|
@@ -33,7 +32,7 @@ export function createImage(properties: IImageProperties) {
|
|
|
33
32
|
return new ImageElement(properties);
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
export class ImageProperties extends
|
|
35
|
+
export class ImageProperties extends ElementProperties implements IImageProperties {
|
|
37
36
|
constructor(properties: IImageProperties) {
|
|
38
37
|
super();
|
|
39
38
|
this.setProperties(this, properties);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Element, addElementToDictionary } from "../../../framework/element";
|
|
2
|
-
import { Properties, IProperties, extendProperties, isNullOrUndefined } from "../../../framework/properties";
|
|
1
|
+
import { Element, addElementToDictionary, ElementProperties, IElementProperties, extendProperties } from "../../../framework/element";
|
|
3
2
|
import { isInteger } from "../../../utilities/integer/integer";
|
|
4
3
|
import { isFloat } from "../../../utilities/float/float";
|
|
5
|
-
import { ISubscribable } from "../../../framework/
|
|
6
|
-
import
|
|
4
|
+
import { ISubscribable, observable } from "../../../framework/observable";
|
|
5
|
+
import{isNullOrUndefined} from "../../../utilities/value/value";
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
export type InputType = "text" | "checkbox" | "file" | "integer" | "float" | "range" | "radio";
|
|
@@ -13,7 +12,7 @@ export enum ValueUpdateModeEnum {
|
|
|
13
12
|
OnInput = 2
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
export interface IInputProperties<TValue> extends
|
|
15
|
+
export interface IInputProperties<TValue> extends IElementProperties {
|
|
17
16
|
value?: TValue | ISubscribable<TValue>;
|
|
18
17
|
inputValidator?: (event: Event, inputViewModel: IInputProperties<TValue>, value: string) => Promise<boolean>;
|
|
19
18
|
placeholder?: string | ISubscribable<string>;
|
|
@@ -43,13 +42,13 @@ export class InputElement<TValue> extends Element<IInputProperties<TValue>> {
|
|
|
43
42
|
protected build() {
|
|
44
43
|
super.build();
|
|
45
44
|
|
|
46
|
-
const element = this.
|
|
45
|
+
const element = this.htmlElement;
|
|
47
46
|
const properties = this.properties;
|
|
48
47
|
if (!properties.valueUpdateMode) {
|
|
49
48
|
properties.valueUpdateMode = ValueUpdateModeEnum.OnChange;
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
const input = this.
|
|
51
|
+
const input = this.htmlElement as HTMLInputElement;
|
|
53
52
|
input.type = properties.type;
|
|
54
53
|
|
|
55
54
|
if (!isNullOrUndefined(properties.min)) {
|
|
@@ -64,8 +63,8 @@ export class InputElement<TValue> extends Element<IInputProperties<TValue>> {
|
|
|
64
63
|
|
|
65
64
|
switch (properties.type) {
|
|
66
65
|
case "checkbox":
|
|
67
|
-
input.checked = unwrap(properties.value) as unknown as boolean;
|
|
68
|
-
if (isSubscribable(properties.value)) {
|
|
66
|
+
input.checked = observable.unwrap(properties.value) as unknown as boolean;
|
|
67
|
+
if (observable.isSubscribable(properties.value)) {
|
|
69
68
|
this.disposers.push(
|
|
70
69
|
properties.value.subscribe((value) => {
|
|
71
70
|
input.checked = value as unknown as boolean;
|
|
@@ -80,8 +79,8 @@ export class InputElement<TValue> extends Element<IInputProperties<TValue>> {
|
|
|
80
79
|
break;
|
|
81
80
|
|
|
82
81
|
case "radio":
|
|
83
|
-
input.checked = input.value === ((unwrap(properties.value)) as unknown as string);
|
|
84
|
-
if (isSubscribable(properties.value)) {
|
|
82
|
+
input.checked = input.value === ((observable.unwrap(properties.value)) as unknown as string);
|
|
83
|
+
if (observable.isSubscribable(properties.value)) {
|
|
85
84
|
this.disposers.push(
|
|
86
85
|
properties.value.subscribe((value) => {
|
|
87
86
|
input.checked = input.value === (value as unknown as string);
|
|
@@ -91,11 +90,11 @@ export class InputElement<TValue> extends Element<IInputProperties<TValue>> {
|
|
|
91
90
|
break;
|
|
92
91
|
|
|
93
92
|
default:
|
|
94
|
-
const value = unwrap(properties.value);
|
|
93
|
+
const value = observable.unwrap(properties.value);
|
|
95
94
|
if (value) {
|
|
96
95
|
input.value = value as unknown as string;
|
|
97
96
|
}
|
|
98
|
-
if (isSubscribable(properties.value)) {
|
|
97
|
+
if (observable.isSubscribable(properties.value)) {
|
|
99
98
|
this.disposers.push(
|
|
100
99
|
properties.value.subscribe((value) => {
|
|
101
100
|
input.value = value as unknown as string;
|
|
@@ -104,11 +103,11 @@ export class InputElement<TValue> extends Element<IInputProperties<TValue>> {
|
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
105
|
|
|
107
|
-
const placeholder = unwrap(properties.placeholder) as unknown as string;
|
|
106
|
+
const placeholder = observable.unwrap(properties.placeholder) as unknown as string;
|
|
108
107
|
if (placeholder) {
|
|
109
108
|
input.placeholder = placeholder;
|
|
110
109
|
}
|
|
111
|
-
if (isSubscribable(properties.placeholder)) {
|
|
110
|
+
if (observable.isSubscribable(properties.placeholder)) {
|
|
112
111
|
this.disposers.push(
|
|
113
112
|
properties.placeholder.subscribe((placeholder) => {
|
|
114
113
|
if (placeholder) {
|
|
@@ -121,14 +120,14 @@ export class InputElement<TValue> extends Element<IInputProperties<TValue>> {
|
|
|
121
120
|
}
|
|
122
121
|
|
|
123
122
|
if (this.properties.valueUpdateMode === ValueUpdateModeEnum.OnChange) {
|
|
124
|
-
this.
|
|
123
|
+
this.htmlElement.addEventListener(
|
|
125
124
|
"change",
|
|
126
125
|
handleEvent
|
|
127
126
|
);
|
|
128
127
|
}
|
|
129
128
|
|
|
130
129
|
if (this.properties.valueUpdateMode === ValueUpdateModeEnum.OnInput || properties.inputValidator) {
|
|
131
|
-
this.
|
|
130
|
+
this.htmlElement.addEventListener(
|
|
132
131
|
"input",
|
|
133
132
|
handleEvent
|
|
134
133
|
);
|
|
@@ -164,7 +163,7 @@ export class InputElement<TValue> extends Element<IInputProperties<TValue>> {
|
|
|
164
163
|
|
|
165
164
|
if (properties.inputValidator) {
|
|
166
165
|
if (!await properties.inputValidator(event, properties, newValue as unknown as string)) {
|
|
167
|
-
input.value = unwrap(properties.value) as unknown as string;
|
|
166
|
+
input.value = observable.unwrap(properties.value) as unknown as string;
|
|
168
167
|
return;
|
|
169
168
|
};
|
|
170
169
|
}
|
|
@@ -173,7 +172,7 @@ export class InputElement<TValue> extends Element<IInputProperties<TValue>> {
|
|
|
173
172
|
if (isInteger(newValue)) {
|
|
174
173
|
newValue = parseInt(newValue);
|
|
175
174
|
} else {
|
|
176
|
-
input.value = unwrap(properties.value) as unknown as string;
|
|
175
|
+
input.value = observable.unwrap(properties.value) as unknown as string;
|
|
177
176
|
return;
|
|
178
177
|
}
|
|
179
178
|
}
|
|
@@ -182,13 +181,13 @@ export class InputElement<TValue> extends Element<IInputProperties<TValue>> {
|
|
|
182
181
|
if (isFloat(newValue)) {
|
|
183
182
|
newValue = parseFloat(newValue);
|
|
184
183
|
} else {
|
|
185
|
-
input.value = unwrap(properties.value) as unknown as string;
|
|
184
|
+
input.value = observable.unwrap(properties.value) as unknown as string;
|
|
186
185
|
return;
|
|
187
186
|
}
|
|
188
187
|
}
|
|
189
188
|
|
|
190
189
|
//if validation has succeeded we set the viewModel value
|
|
191
|
-
if (isObservableValue(properties.value)) {
|
|
190
|
+
if (observable.isObservableValue(properties.value)) {
|
|
192
191
|
if ((event.type === "change" && properties.valueUpdateMode === ValueUpdateModeEnum.OnChange) ||
|
|
193
192
|
(event.type === "input" && properties.valueUpdateMode === ValueUpdateModeEnum.OnInput)) {
|
|
194
193
|
|
|
@@ -205,7 +204,7 @@ export function createInput<TValue>(properties: IInputProperties<TValue>) {
|
|
|
205
204
|
return new InputElement<TValue>(properties);
|
|
206
205
|
}
|
|
207
206
|
|
|
208
|
-
export class InputProperties<TValue> extends
|
|
207
|
+
export class InputProperties<TValue> extends ElementProperties implements IInputProperties<TValue> {
|
|
209
208
|
constructor(properties: IInputProperties<TValue>) {
|
|
210
209
|
super();
|
|
211
210
|
this.setProperties(this, properties);
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { Element, addElementToDictionary } from "../../../framework/element";
|
|
2
|
-
import {
|
|
3
|
-
import { ISubscribable } from "../../../framework/observableInterfaces";
|
|
4
|
-
import { isSubscribable, unwrap , isObservableValue} from "../../../framework/observablelmplementations";
|
|
1
|
+
import { Element, addElementToDictionary, ElementProperties, IElementProperties, extendProperties } from "../../../framework/element";
|
|
2
|
+
import { ISubscribable, observable } from "../../../framework/observable";
|
|
5
3
|
|
|
6
|
-
export interface ISelectProperties<TItem, TValue, TSetter = TValue> extends
|
|
4
|
+
export interface ISelectProperties<TItem, TValue, TSetter = TValue> extends IElementProperties {
|
|
7
5
|
value?: TValue | ISubscribable<TValue>;
|
|
8
6
|
items?: Array<TItem> | ISubscribable<Array<TItem>>;
|
|
9
7
|
textFunction: (item: TItem) => string;
|
|
@@ -30,12 +28,12 @@ export class SelectElement<TItem, TValue, TSetter = TValue> extends Element<ISel
|
|
|
30
28
|
//Protected members
|
|
31
29
|
protected build() {
|
|
32
30
|
super.build();
|
|
33
|
-
const select = this.
|
|
31
|
+
const select = this.htmlElement as HTMLSelectElement;
|
|
34
32
|
|
|
35
33
|
const properties = this.properties;
|
|
36
34
|
|
|
37
|
-
this.setItems(unwrap(properties.items) as Array<TItem>);
|
|
38
|
-
if (isSubscribable(properties.items)) {
|
|
35
|
+
this.setItems(observable.unwrap(properties.items) as Array<TItem>);
|
|
36
|
+
if (observable.isSubscribable(properties.items)) {
|
|
39
37
|
this.disposers.push(
|
|
40
38
|
properties.items.subscribe((items) => {
|
|
41
39
|
this.setItems(items);
|
|
@@ -43,8 +41,8 @@ export class SelectElement<TItem, TValue, TSetter = TValue> extends Element<ISel
|
|
|
43
41
|
);
|
|
44
42
|
}
|
|
45
43
|
|
|
46
|
-
this.setSelectedValue(unwrap(properties.value) as TValue);
|
|
47
|
-
if (isSubscribable(properties.value)) {
|
|
44
|
+
this.setSelectedValue(observable.unwrap(properties.value) as TValue);
|
|
45
|
+
if (observable.isSubscribable(properties.value)) {
|
|
48
46
|
this.disposers.push(
|
|
49
47
|
properties.value.subscribe((value) => {
|
|
50
48
|
this.setSelectedValue(value);
|
|
@@ -52,7 +50,7 @@ export class SelectElement<TItem, TValue, TSetter = TValue> extends Element<ISel
|
|
|
52
50
|
);
|
|
53
51
|
}
|
|
54
52
|
|
|
55
|
-
this.
|
|
53
|
+
this.htmlElement.addEventListener(
|
|
56
54
|
"change",
|
|
57
55
|
async (event: Event) => {
|
|
58
56
|
let selectedValue = select.value as unknown as TValue;
|
|
@@ -65,12 +63,12 @@ export class SelectElement<TItem, TValue, TSetter = TValue> extends Element<ISel
|
|
|
65
63
|
}
|
|
66
64
|
if (properties.inputValidator) {
|
|
67
65
|
if (!await properties.inputValidator(event, properties, selectedValue)) {
|
|
68
|
-
select.value = unwrap(properties.value) as unknown as string;
|
|
66
|
+
select.value = observable.unwrap(properties.value) as unknown as string;
|
|
69
67
|
return;
|
|
70
68
|
};
|
|
71
69
|
}
|
|
72
70
|
|
|
73
|
-
if (isObservableValue(properties.value)) {
|
|
71
|
+
if (observable.isObservableValue(properties.value)) {
|
|
74
72
|
if (properties.setFunction) {
|
|
75
73
|
const setValue = properties.setFunction(selectedItem) as unknown as TValue;
|
|
76
74
|
properties.value.setValueInAction(setValue);
|
|
@@ -85,10 +83,10 @@ export class SelectElement<TItem, TValue, TSetter = TValue> extends Element<ISel
|
|
|
85
83
|
private itemDictionary: { [key: string]: TItem };
|
|
86
84
|
|
|
87
85
|
private setItems(items: Array<TItem>) {
|
|
88
|
-
if (this.
|
|
86
|
+
if (this.htmlElement) {
|
|
89
87
|
this.itemDictionary = {};
|
|
90
88
|
if (items) {
|
|
91
|
-
const select = this.
|
|
89
|
+
const select = this.htmlElement as HTMLSelectElement;
|
|
92
90
|
select.innerHTML = null;
|
|
93
91
|
if (this.properties.emptyItemText) {
|
|
94
92
|
const emptyOption = document.createElement("option") as HTMLOptionElement;
|
|
@@ -110,8 +108,8 @@ export class SelectElement<TItem, TValue, TSetter = TValue> extends Element<ISel
|
|
|
110
108
|
}
|
|
111
109
|
|
|
112
110
|
private setSelectedValue(value: TValue) {
|
|
113
|
-
if (this.
|
|
114
|
-
const select = this.
|
|
111
|
+
if (this.htmlElement) {
|
|
112
|
+
const select = this.htmlElement as HTMLSelectElement;
|
|
115
113
|
if (value === null || value === undefined) {
|
|
116
114
|
select.value = "";
|
|
117
115
|
} else {
|
|
@@ -125,7 +123,7 @@ export function createSelect<TItem, TValue, TSetter = TValue>(properties: ISelec
|
|
|
125
123
|
return new SelectElement(properties);
|
|
126
124
|
}
|
|
127
125
|
|
|
128
|
-
export class SelectProperties<TItem, TValue, TSetter = TValue> extends
|
|
126
|
+
export class SelectProperties<TItem, TValue, TSetter = TValue> extends ElementProperties implements ISelectProperties<TItem, TValue, TSetter> {
|
|
129
127
|
constructor(properties: ISelectProperties<TItem, TValue, TSetter>) {
|
|
130
128
|
super();
|
|
131
129
|
this.setProperties(this, properties);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Element, addElementToDictionary } from "../../../framework/element";
|
|
2
|
-
import { Properties, IProperties, extendProperties } from "../../../framework/properties";
|
|
1
|
+
import { Element, addElementToDictionary,ElementProperties, IElementProperties, extendProperties } from "../../../framework/element";
|
|
3
2
|
|
|
4
3
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
5
|
-
export interface ISpanProperties extends
|
|
4
|
+
export interface ISpanProperties extends IElementProperties {
|
|
6
5
|
|
|
7
6
|
}
|
|
8
7
|
|
|
@@ -26,7 +25,7 @@ export function createSpan(properties: ISpanProperties) {
|
|
|
26
25
|
return new SpanElement(properties);
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
export class SpanProperties extends
|
|
28
|
+
export class SpanProperties extends ElementProperties implements ISpanProperties {
|
|
30
29
|
constructor(properties: SpanProperties) {
|
|
31
30
|
super();
|
|
32
31
|
this.setProperties(this, properties);
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { Element, addElementToDictionary } from "../../../framework/element";
|
|
2
|
-
import { Properties, IProperties, extendProperties } from "../../../framework/properties";
|
|
1
|
+
import { Element, ElementProperties, IElementProperties, extendProperties, addElementToDictionary } from "../../../framework/element";
|
|
3
2
|
import { JSONFormatter } from "json-viewer-awesome/lib/json-formatter";
|
|
4
|
-
import { ISubscribable } from "../../../framework/
|
|
5
|
-
import { isSubscribable, unwrap } from "../../../framework/observablelmplementations";
|
|
3
|
+
import { ISubscribable, observable } from "../../../framework/observable";
|
|
6
4
|
|
|
7
|
-
export interface IJsonFormatterProperties extends
|
|
5
|
+
export interface IJsonFormatterProperties extends IElementProperties {
|
|
8
6
|
json: object | ISubscribable<object>;
|
|
9
7
|
showArrayIndex?: boolean;
|
|
10
8
|
quotesOnKeys?: boolean;
|
|
@@ -33,11 +31,11 @@ export class JsonFormatterElement extends Element<IJsonFormatterProperties> {
|
|
|
33
31
|
super.build();
|
|
34
32
|
|
|
35
33
|
const properties = this.properties;
|
|
36
|
-
this.setJson(unwrap(properties.json));
|
|
37
|
-
if (isSubscribable(properties.json)) {
|
|
34
|
+
this.setJson(observable.unwrap(properties.json));
|
|
35
|
+
if (observable.isSubscribable(properties.json)) {
|
|
38
36
|
this.disposers.push(
|
|
39
|
-
properties.json.subscribe((json)=>{
|
|
40
|
-
|
|
37
|
+
properties.json.subscribe((json) => {
|
|
38
|
+
this.setJson(json as unknown as object);
|
|
41
39
|
})
|
|
42
40
|
);
|
|
43
41
|
}
|
|
@@ -58,9 +56,9 @@ export class JsonFormatterElement extends Element<IJsonFormatterProperties> {
|
|
|
58
56
|
src: json
|
|
59
57
|
});
|
|
60
58
|
|
|
61
|
-
this.
|
|
59
|
+
this.htmlElement.replaceChildren(jsonFormatter.render());
|
|
62
60
|
} else {
|
|
63
|
-
this.
|
|
61
|
+
this.htmlElement.innerHTML = (json as unknown).toString();
|
|
64
62
|
}
|
|
65
63
|
} else {
|
|
66
64
|
this.empty();
|
|
@@ -72,7 +70,7 @@ export function createJsonFormatter(properties: IJsonFormatterProperties) {
|
|
|
72
70
|
return new JsonFormatterElement(properties);
|
|
73
71
|
}
|
|
74
72
|
|
|
75
|
-
export class JsonFormatterProperties extends
|
|
73
|
+
export class JsonFormatterProperties extends ElementProperties implements IJsonFormatterProperties {
|
|
76
74
|
constructor(properties: IJsonFormatterProperties) {
|
|
77
75
|
super();
|
|
78
76
|
this.setProperties(this, properties);
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import * as kendo from "@progress/kendo-ui/js/kendo.dataviz.chart";
|
|
2
|
-
import { Element } from "../../../framework/element";
|
|
3
|
-
import {
|
|
4
|
-
import { ISubscribable } from "../../../framework/observableInterfaces";
|
|
5
|
-
import { isSubscribable, unwrap } from "../../../framework/observablelmplementations";
|
|
2
|
+
import { Element, IElementProperties, extendProperties } from "../../../framework/element";
|
|
3
|
+
import { ISubscribable, observable } from "../../../framework/observable";
|
|
6
4
|
|
|
7
|
-
export interface IChartProperties extends
|
|
5
|
+
export interface IChartProperties extends IElementProperties {
|
|
8
6
|
data?: Array<unknown> | ISubscribable<Array<unknown>>;
|
|
9
7
|
chartArea?: kendo.dataviz.ui.ChartChartArea | undefined;
|
|
10
8
|
series?: kendo.dataviz.ui.ChartSeriesItem[] | ISubscribable<kendo.dataviz.ui.ChartSeriesItem[]>;
|
|
@@ -13,7 +11,7 @@ export interface IChartProperties extends IProperties {
|
|
|
13
11
|
legend?: kendo.dataviz.ui.ChartLegend | undefined;
|
|
14
12
|
}
|
|
15
13
|
|
|
16
|
-
export class ChartElement extends Element<IChartProperties>{
|
|
14
|
+
export class ChartElement extends Element<IChartProperties> {
|
|
17
15
|
constructor(properties: IChartProperties) {
|
|
18
16
|
super(
|
|
19
17
|
{
|
|
@@ -39,12 +37,12 @@ export class ChartElement extends Element<IChartProperties>{
|
|
|
39
37
|
if (properties.data) {
|
|
40
38
|
this.dataSource = new kendo.data.DataSource(
|
|
41
39
|
{
|
|
42
|
-
data: unwrap(properties.data)
|
|
40
|
+
data: observable.unwrap(properties.data)
|
|
43
41
|
}
|
|
44
42
|
);
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
if (isSubscribable(properties.data)) {
|
|
45
|
+
if (observable.isSubscribable(properties.data)) {
|
|
48
46
|
this.disposers.push(
|
|
49
47
|
properties.data.subscribe((data) => {
|
|
50
48
|
this.dataSource.data(data);
|
|
@@ -54,20 +52,20 @@ export class ChartElement extends Element<IChartProperties>{
|
|
|
54
52
|
|
|
55
53
|
setTimeout(() => {
|
|
56
54
|
this.chart = new kendo.dataviz.ui.Chart(
|
|
57
|
-
this.
|
|
55
|
+
this.htmlElement,
|
|
58
56
|
{
|
|
59
57
|
autoBind: false,
|
|
60
58
|
legend: properties.legend,
|
|
61
59
|
dataSource: this.dataSource,
|
|
62
60
|
chartArea: properties.chartArea,
|
|
63
|
-
series: unwrap(properties.series),
|
|
64
|
-
categoryAxis: unwrap(properties.categoryAxis),
|
|
61
|
+
series: observable.unwrap(properties.series),
|
|
62
|
+
categoryAxis: observable.unwrap(properties.categoryAxis),
|
|
65
63
|
valueAxis: properties.valueAxis
|
|
66
64
|
}
|
|
67
65
|
);
|
|
68
66
|
});
|
|
69
67
|
|
|
70
|
-
if (isSubscribable(properties.series)) {
|
|
68
|
+
if (observable.isSubscribable(properties.series)) {
|
|
71
69
|
this.disposers.push(
|
|
72
70
|
properties.series.subscribe((series) => {
|
|
73
71
|
if (this.chart) {
|
|
@@ -79,14 +77,14 @@ export class ChartElement extends Element<IChartProperties>{
|
|
|
79
77
|
);
|
|
80
78
|
}
|
|
81
79
|
|
|
82
|
-
if (isSubscribable(properties.categoryAxis)) {
|
|
80
|
+
if (observable.isSubscribable(properties.categoryAxis)) {
|
|
83
81
|
this.disposers.push(
|
|
84
|
-
properties.categoryAxis.subscribe((categoryAxis)=>{
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
properties.categoryAxis.subscribe((categoryAxis) => {
|
|
83
|
+
if (this.chart) {
|
|
84
|
+
this.chart.setOptions({
|
|
85
|
+
categoryAxis: categoryAxis
|
|
86
|
+
});
|
|
87
|
+
}
|
|
90
88
|
})
|
|
91
89
|
);
|
|
92
90
|
}
|