jpf 4.2.15 → 4.2.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/controls/kendo/Menu/Menu.js.map +1 -1
  2. package/package.json +2 -1
  3. package/src/controls/codeMirror/HtmlEditor/HtmlEditor.ts +149 -0
  4. package/src/controls/codeMirror/JsonEditor/JsonEditor.ts +132 -0
  5. package/src/controls/codeMirror/index.ts +2 -0
  6. package/src/controls/custom/FileSelector/FileSelector.ts +70 -0
  7. package/src/controls/custom/LabeledControl/LabeledControl.ts +54 -0
  8. package/src/controls/custom/ListItem/ListItem.ts +91 -0
  9. package/src/controls/custom/index.ts +3 -0
  10. package/src/controls/html/Button/Button.ts +66 -0
  11. package/src/controls/html/Div/Div.ts +37 -0
  12. package/src/controls/html/Image/Image.ts +42 -0
  13. package/src/controls/html/Input/Input.ts +223 -0
  14. package/src/controls/html/Select/Select.ts +142 -0
  15. package/src/controls/html/Span/Span.ts +35 -0
  16. package/src/controls/html/index.ts +6 -0
  17. package/src/controls/index.ts +15 -0
  18. package/src/controls/jsonViewAwesome/index.ts +1 -0
  19. package/src/controls/jsonViewAwesome/jsonFormatter/JsonFormatter.ts +87 -0
  20. package/src/controls/kendo/Chart/Chart.ts +97 -0
  21. package/src/controls/kendo/Culture/Culture.ts +32 -0
  22. package/src/controls/kendo/DataSource/DataSource.ts +4 -0
  23. package/src/controls/kendo/Dialog/Dialog.ts +64 -0
  24. package/src/controls/kendo/Editor/Editor.ts +138 -0
  25. package/src/controls/kendo/Grid/Grid.ts +286 -0
  26. package/src/controls/kendo/Menu/Menu.ts +125 -0
  27. package/src/controls/kendo/ObservableObject/ObservableObject.ts +45 -0
  28. package/src/controls/kendo/Tree/Tree.ts +147 -0
  29. package/src/controls/kendo/index.ts +9 -0
  30. package/src/controls/leaflet/LabelControl/LabelControl.ts +42 -0
  31. package/src/controls/leaflet/Map/Map.ts +177 -0
  32. package/src/controls/leaflet/OpenStreetMapTileLayer/OpenStreetMapTileLayer.ts +19 -0
  33. package/src/controls/leaflet/PointerEvent/PointerEvent.ts +9 -0
  34. package/src/controls/leaflet/index.ts +4 -0
  35. package/src/controls/svg/Circle/Circle.ts +34 -0
  36. package/src/controls/svg/Ellipse/Ellipse.ts +36 -0
  37. package/src/controls/svg/ForeignObject/ForeignObject.ts +38 -0
  38. package/src/controls/svg/Group/Group.ts +38 -0
  39. package/src/controls/svg/Line/Line.ts +36 -0
  40. package/src/controls/svg/Pattern/Pattern.ts +49 -0
  41. package/src/controls/svg/Polygon/Polygon.ts +31 -0
  42. package/src/controls/svg/Polyline/Polyline.ts +31 -0
  43. package/src/controls/svg/Rectangle/Rectangle.ts +36 -0
  44. package/src/controls/svg/Svg/Svg.ts +43 -0
  45. package/src/controls/svg/Text/Text.ts +38 -0
  46. package/src/controls/svg/Title/Title.ts +28 -0
  47. package/src/controls/svg/index.ts +13 -0
  48. package/src/controls/svg/svg.ts +20 -0
  49. package/src/framework/View.ts +213 -0
  50. package/src/framework/ViewModel.ts +525 -0
  51. package/src/framework/attributes.ts +92 -0
  52. package/src/framework/event.ts +98 -0
  53. package/src/framework/observable.ts +80 -0
  54. package/src/framework/style.ts +3271 -0
  55. package/src/framework/types.ts +277 -0
  56. package/src/framework/userAgent.ts +51 -0
  57. package/src/index.ts +14 -0
  58. package/src/utilities/blob/blob.ts +19 -0
  59. package/src/utilities/cookie/cookie.ts +28 -0
  60. package/src/utilities/dataReaderTable/dataReaderTable.ts +34 -0
  61. package/src/utilities/fetch/fetch.ts +179 -0
  62. package/src/utilities/float/float.ts +3 -0
  63. package/src/utilities/formData/formData.ts +12 -0
  64. package/src/utilities/html/html.ts +8 -0
  65. package/src/utilities/htmlElement/htmlElement.ts +15 -0
  66. package/src/utilities/image/image.ts +1 -0
  67. package/src/utilities/index.ts +37 -0
  68. package/src/utilities/integer/integer.ts +31 -0
  69. package/src/utilities/key/key.ts +7 -0
  70. package/src/utilities/navigator/navigator.ts +7 -0
  71. package/src/utilities/notification/notification.ts +88 -0
  72. package/src/utilities/querystring/querystring.ts +61 -0
  73. package/src/utilities/router/router.ts +124 -0
  74. package/src/utilities/stylesheet/stylesheet.ts +58 -0
  75. package/src/utilities/uniqueId/uniqueId.ts +5 -0
  76. package/src/utilities/webSocket/webSocket.ts +72 -0
@@ -0,0 +1,31 @@
1
+ import { View } from "../../../framework/View";
2
+ import { Properties , extendProperties } from "../../../framework/ViewModel";
3
+ import { Subscribable } from "knockout";
4
+ import { SvgPoint, serializePoints } from "../svg";
5
+
6
+ export interface PolylineProperties extends Properties {
7
+ points: Array<SvgPoint> | Subscribable<Array<SvgPoint>>;
8
+ }
9
+
10
+ export class PolylineView extends View<PolylineProperties> {
11
+ constructor(properties: PolylineProperties) {
12
+ super(
13
+ {
14
+ tagName: "polyline",
15
+ properties: extendProperties(
16
+ {
17
+ viewType: "Polyline",
18
+ attributes: {
19
+ points: serializePoints(properties.points)
20
+ }
21
+ },
22
+ properties
23
+ )
24
+ }
25
+ );
26
+ }
27
+ }
28
+
29
+ export function polylineView(properties: PolylineProperties) {
30
+ return new PolylineView(properties);
31
+ }
@@ -0,0 +1,36 @@
1
+ import { View } from "../../../framework/View";
2
+ import { Properties, extendProperties } from "../../../framework/ViewModel";
3
+ import { Subscribable } from "knockout";
4
+
5
+ export interface RectangleProperties extends Properties {
6
+ x?: number | string | Subscribable<number | string>;
7
+ y?: number | string | Subscribable<number | string>;
8
+ width?: number | string | Subscribable<number | string>;
9
+ height?: number | string | Subscribable<number | string>;
10
+ }
11
+
12
+ export class RectangleView extends View<RectangleProperties> {
13
+ constructor(properties: RectangleProperties) {
14
+ super(
15
+ {
16
+ tagName: "rect",
17
+ properties: extendProperties(
18
+ {
19
+ viewType: "Rectangle",
20
+ attributes: {
21
+ x: properties.x,
22
+ y: properties.y,
23
+ width: properties.width,
24
+ height: properties.height
25
+ }
26
+ },
27
+ properties
28
+ )
29
+ }
30
+ );
31
+ }
32
+ }
33
+
34
+ export function rectangleView(properties: RectangleProperties) {
35
+ return new RectangleView(properties);
36
+ }
@@ -0,0 +1,43 @@
1
+ import { View, IView } from "../../../framework/View";
2
+ import { Properties, extendProperties } from "../../../framework/ViewModel";
3
+ import { ObservableArray, Computed, Subscribable } from "knockout";
4
+ import { PreserveAspectRatio } from "../../../framework/types";
5
+
6
+ export interface SvgProperties extends Properties {
7
+ x?: number | string | Subscribable<number | string>;
8
+ y?: number | string | Subscribable<number | string>;
9
+ height?: number | string | Subscribable<number | string>;
10
+ width?: number | string | Subscribable<number | string>;
11
+ viewBox?: string;
12
+ preserveAspectRatio?: PreserveAspectRatio | Subscribable<PreserveAspectRatio>;
13
+ children?: Array<IView> | ObservableArray<IView> | Computed<Array<IView>>;
14
+ }
15
+
16
+ export class SvgView extends View<SvgProperties> {
17
+ constructor(properties: SvgProperties) {
18
+ super(
19
+ {
20
+ tagName: "svg",
21
+ properties: extendProperties(
22
+ {
23
+ viewType: "Svg",
24
+ attributes: {
25
+ x: properties.x,
26
+ y: properties.y,
27
+ height: properties.height,
28
+ width: properties.width,
29
+ viewBox: properties.viewBox,
30
+ preserveAspectRatio: properties.preserveAspectRatio
31
+ }
32
+ },
33
+ properties
34
+ ),
35
+ children: properties.children
36
+ },
37
+ );
38
+ }
39
+ }
40
+
41
+ export function svgView(properties: SvgProperties) {
42
+ return new SvgView(properties);
43
+ }
@@ -0,0 +1,38 @@
1
+ import { View } from "../../../framework/View";
2
+ import { Properties, extendProperties } from "../../../framework/ViewModel";
3
+ import { Subscribable } from "knockout";
4
+
5
+ export interface TextProperties extends Properties {
6
+ x?: number | string | Subscribable<number | string>;
7
+ y?: number | string | Subscribable<number | string>;
8
+ dx?: number | string | Subscribable<number | string>;
9
+ dy?: number | string | Subscribable<number | string>;
10
+ rotate?: string | Subscribable<string>;
11
+ }
12
+
13
+ export class TextView extends View<TextProperties> {
14
+ constructor(properties: TextProperties) {
15
+ super(
16
+ {
17
+ tagName: "text",
18
+ properties: extendProperties(
19
+ {
20
+ viewType: "Text",
21
+ attributes: {
22
+ x: properties.x,
23
+ y: properties.y,
24
+ dx: properties.dx,
25
+ dy: properties.dy,
26
+ rotate: properties.rotate
27
+ }
28
+ },
29
+ properties
30
+ )
31
+ }
32
+ );
33
+ }
34
+ }
35
+
36
+ export function textView(properties: TextProperties) {
37
+ return new TextView(properties);
38
+ }
@@ -0,0 +1,28 @@
1
+ import { View } from "../../../framework/View";
2
+ import { Properties, extendProperties } from "../../../framework/ViewModel";
3
+ import { Subscribable } from "knockout";
4
+
5
+ export interface TitleProperties extends Properties{
6
+ title: string | Subscribable<string>
7
+ }
8
+
9
+ export class TitleView extends View<TitleProperties> {
10
+ constructor(properties: TitleProperties) {
11
+ super(
12
+ {
13
+ tagName: "title",
14
+ properties: extendProperties(
15
+ {
16
+ viewType: "Title",
17
+ textContent: properties.title
18
+ },
19
+ properties
20
+ )
21
+ }
22
+ );
23
+ }
24
+ }
25
+
26
+ export function titleView(properties: TitleProperties) {
27
+ return new TitleView(properties);
28
+ }
@@ -0,0 +1,13 @@
1
+ export * from "./Circle/Circle";
2
+ export * from "./Ellipse/Ellipse";
3
+ export * from "./ForeignObject/ForeignObject";
4
+ export * from "./Group/Group";
5
+ export * from "./Line/Line";
6
+ export * from "./Pattern/Pattern";
7
+ export * from "./Polygon/Polygon";
8
+ export * from "./Polyline/Polyline";
9
+ export * from "./Rectangle/Rectangle";
10
+ export * from "./Svg/Svg";
11
+ export * from "./Text/Text";
12
+ export * from "./Title/Title";
13
+ export * from "./svg";
@@ -0,0 +1,20 @@
1
+ import { Subscribable, isSubscribable, unwrap, computed } from "knockout";
2
+
3
+ export interface SvgPoint {
4
+ x: number;
5
+ y: number;
6
+ }
7
+
8
+ export function serializePoints(points: Array<SvgPoint> | Subscribable<Array<SvgPoint>>): string | Subscribable<string> {
9
+ if (points) {
10
+ if (isSubscribable(points)) {
11
+ return computed<string>(
12
+ () => {
13
+ return unwrap(points).map((point) => { return point.x + "," + point.y }).join(" ");
14
+ }
15
+ );
16
+ }
17
+ return unwrap(points).map((point) => { return point.x + "," + point.y }).join(" ");
18
+ }
19
+ return null;
20
+ }
@@ -0,0 +1,213 @@
1
+ import "tocca";
2
+ import { unwrap, isSubscribable, Subscribable, Subscription } from "knockout";
3
+ import { ViewModel, applyBindings as applyViewModelToElement } from "./ViewModel";
4
+
5
+ const htmlTags = {
6
+ a: true,
7
+ div: true,
8
+ img: true,
9
+ pre: true,
10
+ form: true,
11
+ span: true,
12
+ input: true,
13
+ button: true,
14
+ select: true,
15
+ textarea: true
16
+ }
17
+
18
+ const svgTags = {
19
+ g: true,
20
+ svg: true,
21
+ rect: true,
22
+ text: true,
23
+ line: true,
24
+ title: true,
25
+ circle: true,
26
+ pattern: true,
27
+ ellipse: true,
28
+ polygon: true,
29
+ polyline: true,
30
+ foreignObject: true
31
+ }
32
+
33
+ type TagName = keyof typeof htmlTags | keyof typeof svgTags;
34
+
35
+ const svgNamespace = "http://www.w3.org/2000/svg";
36
+
37
+ //#region View class
38
+ export interface IView {
39
+ render(): HTMLElement;
40
+ dispose(): void;
41
+ }
42
+
43
+ export interface ViewOptions<TProperties> {
44
+ tagName: TagName;
45
+ properties?: TProperties;
46
+ children?: Array<IView> | Subscribable<Array<IView>>;
47
+ }
48
+
49
+ export class View<TProperties = any> implements IView {
50
+ constructor(properties: ViewOptions<TProperties>) {
51
+ this.tagName = properties.tagName;
52
+ this.properties = properties.properties;
53
+ this.optionsChildren = properties.children;
54
+ this.children = unwrap(properties.children);
55
+ }
56
+
57
+ // #region Private members
58
+ private readonly tagName: TagName;
59
+ private readonly optionsChildren: Array<IView> | Subscribable<Array<IView>>;
60
+ private children = new Array<IView>();
61
+
62
+
63
+ private buildChildren() {
64
+ if (this.element && this.children && this.children.length > 0) {
65
+ //Create a documentFragment to reduce browser repaints
66
+ const documentFragment = document.createDocumentFragment();
67
+ this.children.forEach((childView) => {
68
+ documentFragment.appendChild(childView.render());
69
+ });
70
+
71
+ //Add the documentFragment to the dom
72
+ this.element.appendChild(documentFragment);
73
+ }
74
+ }
75
+ // #endregion
76
+
77
+ // #region Protected members
78
+ protected element: HTMLElement;
79
+ protected readonly properties: TProperties;
80
+ protected readonly subscriptions = new Array<Subscription>();
81
+
82
+ protected build(): void {
83
+ applyViewModelToElement(this.properties, this.element, this.subscriptions);
84
+
85
+ if (this.children) {
86
+ this.buildChildren();
87
+ }
88
+
89
+ //Find out if the options.Children are observable.
90
+ if (isSubscribable(this.optionsChildren)) {
91
+ this.subscriptions.push(
92
+ this.optionsChildren.subscribe((children) => {
93
+ this.setChildren(...children);
94
+ })
95
+ );
96
+ }
97
+ }
98
+
99
+ protected remove(): void {
100
+ if (this.element) {
101
+ if (this.element.remove) {
102
+ this.element.remove();
103
+ } else {
104
+ if (this.element.parentElement) {
105
+ this.element.parentElement.removeChild(this.element);
106
+ }
107
+ }
108
+
109
+ this.element = null;
110
+ }
111
+ }
112
+
113
+ protected addChild(child: IView): View<TProperties> {
114
+ this.children.push(child);
115
+ this.buildChildren();
116
+ return this;
117
+ }
118
+
119
+ protected setChildren(...children: Array<IView>): View<TProperties> {
120
+ this.empty();
121
+
122
+ this.children = children;
123
+ this.buildChildren();
124
+
125
+ return this;
126
+ }
127
+
128
+ protected empty(): void {
129
+ this.children = [];
130
+
131
+ if (this.element) {
132
+ this.element.innerHTML = "";
133
+ while (this.element.firstChild) {
134
+ this.element.removeChild(this.element.firstChild);
135
+ }
136
+ }
137
+ }
138
+ // #endregion
139
+
140
+ // #region Public members
141
+ render(): HTMLElement {
142
+ if (this.element) {
143
+ //If the element has already been rendered we remove the element from the dom
144
+ this.remove();
145
+ }
146
+
147
+ //Check if the build property is pointing to a function.
148
+ if (typeof this.build === "function") {
149
+ //Create the html element.
150
+ if (svgTags.hasOwnProperty(this.tagName)) {
151
+ //Create a SVGElement
152
+ this.element = document.createElementNS(svgNamespace, this.tagName) as any as HTMLElement;
153
+ } else {
154
+ //Create a HTMLElement
155
+ this.element = document.createElement(this.tagName);
156
+ }
157
+
158
+ //Build the UiElement
159
+ this.build();
160
+
161
+ //Return the fully functional html element
162
+ return this.element;
163
+ }
164
+
165
+ throw "The build method of this UiElement has not been defined";
166
+ }
167
+ dispose(): void {
168
+ for (let subscription of this.subscriptions) {
169
+ subscription.dispose();
170
+ }
171
+ for (let child of this.children) {
172
+ child.dispose();
173
+ }
174
+ }
175
+
176
+ focus(options?: FocusOptions) {
177
+ if (this.element) {
178
+ this.element.focus(options);
179
+ }
180
+ }
181
+ // #endregion
182
+ }
183
+ //#endregion
184
+
185
+ //#region View dictionary
186
+ export var viewDictionary = new Map<any, any>();
187
+
188
+ export function registerView(viewModel, resolver: any) {
189
+ viewDictionary.set(viewModel.prototype.constructor, resolver);
190
+ }
191
+
192
+ export function getView(viewModel: ViewModel): View {
193
+ if (viewModel && viewModel.constructor) {
194
+ const view = viewDictionary.get(viewModel.constructor);
195
+ if (view.prototype) {
196
+ // ReSharper disable once InconsistentNaming
197
+ return new view(viewModel);
198
+ }
199
+ if (typeof view === "function") {
200
+ return view(viewModel);
201
+ }
202
+ }
203
+ return null;
204
+ }
205
+
206
+ export function render(viewModel: ViewModel): HTMLElement {
207
+ const view = getView(viewModel);
208
+ if (view && view.render) {
209
+ return view.render();
210
+ }
211
+ return null;
212
+ }
213
+ //#endregion