jpf 5.0.61 → 5.0.63

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 (160) hide show
  1. package/dist/controls/codeMirror/Editor/Editor.d.ts +4 -5
  2. package/dist/controls/codeMirror/Editor/Editor.js +8 -9
  3. package/dist/controls/codeMirror/Editor/Editor.js.map +1 -1
  4. package/dist/controls/custom/FileSelector/FileSelector.d.ts +3 -4
  5. package/dist/controls/custom/FileSelector/FileSelector.js +5 -6
  6. package/dist/controls/custom/FileSelector/FileSelector.js.map +1 -1
  7. package/dist/controls/custom/LabeledControl/LabeledControl.d.ts +5 -6
  8. package/dist/controls/custom/LabeledControl/LabeledControl.js +3 -4
  9. package/dist/controls/custom/LabeledControl/LabeledControl.js.map +1 -1
  10. package/dist/controls/custom/ListItem/ListItem.d.ts +8 -9
  11. package/dist/controls/custom/ListItem/ListItem.js +8 -9
  12. package/dist/controls/custom/ListItem/ListItem.js.map +1 -1
  13. package/dist/controls/html/Button/Button.d.ts +6 -7
  14. package/dist/controls/html/Button/Button.js +8 -9
  15. package/dist/controls/html/Button/Button.js.map +1 -1
  16. package/dist/controls/html/Div/Div.d.ts +4 -5
  17. package/dist/controls/html/Div/Div.js +2 -3
  18. package/dist/controls/html/Div/Div.js.map +1 -1
  19. package/dist/controls/html/Image/Image.d.ts +4 -5
  20. package/dist/controls/html/Image/Image.js +2 -3
  21. package/dist/controls/html/Image/Image.js.map +1 -1
  22. package/dist/controls/html/Input/Input.d.ts +4 -5
  23. package/dist/controls/html/Input/Input.js +23 -23
  24. package/dist/controls/html/Input/Input.js.map +1 -1
  25. package/dist/controls/html/Select/Select.d.ts +4 -5
  26. package/dist/controls/html/Select/Select.js +15 -16
  27. package/dist/controls/html/Select/Select.js.map +1 -1
  28. package/dist/controls/html/Span/Span.d.ts +3 -4
  29. package/dist/controls/html/Span/Span.js +2 -3
  30. package/dist/controls/html/Span/Span.js.map +1 -1
  31. package/dist/controls/jsonViewerAwesome/jsonFormatter/JsonFormatter.d.ts +4 -5
  32. package/dist/controls/jsonViewerAwesome/jsonFormatter/JsonFormatter.js +7 -8
  33. package/dist/controls/jsonViewerAwesome/jsonFormatter/JsonFormatter.js.map +1 -1
  34. package/dist/controls/kendo/Chart/Chart.d.ts +3 -4
  35. package/dist/controls/kendo/Chart/Chart.js +9 -10
  36. package/dist/controls/kendo/Chart/Chart.js.map +1 -1
  37. package/dist/controls/kendo/Editor/Editor.d.ts +3 -4
  38. package/dist/controls/kendo/Editor/Editor.js +13 -14
  39. package/dist/controls/kendo/Editor/Editor.js.map +1 -1
  40. package/dist/controls/kendo/Grid/Grid.d.ts +4 -5
  41. package/dist/controls/kendo/Grid/Grid.js +12 -13
  42. package/dist/controls/kendo/Grid/Grid.js.map +1 -1
  43. package/dist/controls/kendo/Menu/Menu.d.ts +3 -4
  44. package/dist/controls/kendo/Menu/Menu.js +9 -10
  45. package/dist/controls/kendo/Menu/Menu.js.map +1 -1
  46. package/dist/controls/kendo/Treeview/Treeview.d.ts +3 -4
  47. package/dist/controls/kendo/Treeview/Treeview.js +9 -10
  48. package/dist/controls/kendo/Treeview/Treeview.js.map +1 -1
  49. package/dist/controls/leaflet/LabelControl/LabelControl.d.ts +2 -3
  50. package/dist/controls/leaflet/LabelControl/LabelControl.js +1 -2
  51. package/dist/controls/leaflet/LabelControl/LabelControl.js.map +1 -1
  52. package/dist/controls/leaflet/Map/Map.d.ts +4 -5
  53. package/dist/controls/leaflet/Map/Map.js +9 -10
  54. package/dist/controls/leaflet/Map/Map.js.map +1 -1
  55. package/dist/controls/svg/Circle/Circle.d.ts +3 -4
  56. package/dist/controls/svg/Circle/Circle.js +1 -2
  57. package/dist/controls/svg/Circle/Circle.js.map +1 -1
  58. package/dist/controls/svg/Ellipse/Ellipse.d.ts +3 -4
  59. package/dist/controls/svg/Ellipse/Ellipse.js +1 -2
  60. package/dist/controls/svg/Ellipse/Ellipse.js.map +1 -1
  61. package/dist/controls/svg/ForeignObject/ForeignObject.d.ts +3 -4
  62. package/dist/controls/svg/ForeignObject/ForeignObject.js +1 -2
  63. package/dist/controls/svg/ForeignObject/ForeignObject.js.map +1 -1
  64. package/dist/controls/svg/Group/Group.d.ts +3 -4
  65. package/dist/controls/svg/Group/Group.js +1 -2
  66. package/dist/controls/svg/Group/Group.js.map +1 -1
  67. package/dist/controls/svg/Line/Line.d.ts +3 -4
  68. package/dist/controls/svg/Line/Line.js +1 -2
  69. package/dist/controls/svg/Line/Line.js.map +1 -1
  70. package/dist/controls/svg/Pattern/Pattern.d.ts +3 -4
  71. package/dist/controls/svg/Pattern/Pattern.js +1 -2
  72. package/dist/controls/svg/Pattern/Pattern.js.map +1 -1
  73. package/dist/controls/svg/Polygon/Polygon.d.ts +3 -4
  74. package/dist/controls/svg/Polygon/Polygon.js +3 -4
  75. package/dist/controls/svg/Polygon/Polygon.js.map +1 -1
  76. package/dist/controls/svg/Polyline/Polyline.d.ts +3 -4
  77. package/dist/controls/svg/Polyline/Polyline.js +1 -2
  78. package/dist/controls/svg/Polyline/Polyline.js.map +1 -1
  79. package/dist/controls/svg/Rectangle/Rectangle.d.ts +3 -4
  80. package/dist/controls/svg/Rectangle/Rectangle.js +1 -2
  81. package/dist/controls/svg/Rectangle/Rectangle.js.map +1 -1
  82. package/dist/controls/svg/Svg/Svg.d.ts +3 -4
  83. package/dist/controls/svg/Svg/Svg.js +1 -2
  84. package/dist/controls/svg/Svg/Svg.js.map +1 -1
  85. package/dist/controls/svg/Text/Text.d.ts +3 -4
  86. package/dist/controls/svg/Text/Text.js +1 -2
  87. package/dist/controls/svg/Text/Text.js.map +1 -1
  88. package/dist/controls/svg/Title/Title.d.ts +3 -4
  89. package/dist/controls/svg/Title/Title.js +1 -2
  90. package/dist/controls/svg/Title/Title.js.map +1 -1
  91. package/dist/controls/svg/svg.d.ts +1 -1
  92. package/dist/controls/svg/svg.js +5 -5
  93. package/dist/controls/svg/svg.js.map +1 -1
  94. package/dist/framework/attributes.d.ts +1 -46
  95. package/dist/framework/css.d.ts +1 -4
  96. package/dist/framework/element.d.ts +48 -15
  97. package/dist/framework/element.js +279 -29
  98. package/dist/framework/element.js.map +1 -1
  99. package/dist/framework/observable.d.ts +41 -0
  100. package/dist/framework/observable.js +46 -0
  101. package/dist/framework/observable.js.map +1 -0
  102. package/dist/framework/observablelmplementations.d.ts +1 -24
  103. package/dist/framework/observablelmplementations.js +0 -110
  104. package/dist/framework/observablelmplementations.js.map +1 -1
  105. package/dist/framework/properties.d.ts +1 -40
  106. package/dist/framework/properties.js +0 -265
  107. package/dist/framework/properties.js.map +1 -1
  108. package/dist/framework/style.d.ts +1 -328
  109. package/dist/index.d.ts +2 -4
  110. package/dist/index.js +3 -5
  111. package/dist/index.js.map +1 -1
  112. package/dist/utilities/object/object.d.ts +5 -0
  113. package/dist/utilities/object/object.js +47 -0
  114. package/dist/utilities/object/object.js.map +1 -0
  115. package/dist/utilities/value/value.d.ts +1 -0
  116. package/dist/utilities/value/value.js +7 -0
  117. package/dist/utilities/value/value.js.map +1 -0
  118. package/package.json +1 -1
  119. package/src/controls/codeMirror/Editor/Editor.ts +9 -11
  120. package/src/controls/custom/FileSelector/FileSelector.ts +5 -6
  121. package/src/controls/custom/LabeledControl/LabeledControl.ts +5 -6
  122. package/src/controls/custom/ListItem/ListItem.ts +13 -15
  123. package/src/controls/html/Button/Button.ts +13 -15
  124. package/src/controls/html/Div/Div.ts +4 -5
  125. package/src/controls/html/Image/Image.ts +4 -5
  126. package/src/controls/html/Input/Input.ts +21 -22
  127. package/src/controls/html/Select/Select.ts +16 -18
  128. package/src/controls/html/Span/Span.ts +3 -4
  129. package/src/controls/jsonViewerAwesome/jsonFormatter/JsonFormatter.ts +10 -12
  130. package/src/controls/kendo/Chart/Chart.ts +17 -19
  131. package/src/controls/kendo/Editor/Editor.ts +14 -16
  132. package/src/controls/kendo/Grid/Grid.ts +13 -15
  133. package/src/controls/kendo/Menu/Menu.ts +11 -13
  134. package/src/controls/kendo/Treeview/Treeview.ts +9 -11
  135. package/src/controls/leaflet/LabelControl/LabelControl.ts +4 -5
  136. package/src/controls/leaflet/Map/Map.ts +10 -12
  137. package/src/controls/svg/Circle/Circle.ts +3 -4
  138. package/src/controls/svg/Ellipse/Ellipse.ts +3 -4
  139. package/src/controls/svg/ForeignObject/ForeignObject.ts +3 -4
  140. package/src/controls/svg/Group/Group.ts +3 -4
  141. package/src/controls/svg/Line/Line.ts +3 -4
  142. package/src/controls/svg/Pattern/Pattern.ts +3 -4
  143. package/src/controls/svg/Polygon/Polygon.ts +4 -6
  144. package/src/controls/svg/Polyline/Polyline.ts +3 -4
  145. package/src/controls/svg/Rectangle/Rectangle.ts +3 -4
  146. package/src/controls/svg/Svg/Svg.ts +3 -4
  147. package/src/controls/svg/Text/Text.ts +3 -4
  148. package/src/controls/svg/Title/Title.ts +3 -4
  149. package/src/controls/svg/svg.ts +5 -6
  150. package/src/framework/attributes.ts +1 -47
  151. package/src/framework/css.ts +3 -5
  152. package/src/framework/element.ts +380 -44
  153. package/src/framework/observable.ts +100 -0
  154. package/src/framework/observablelmplementations.ts +135 -135
  155. package/src/framework/properties.ts +1 -342
  156. package/src/framework/style.ts +1556 -1556
  157. package/src/index.ts +2 -4
  158. package/src/utilities/object/object.ts +56 -0
  159. package/src/utilities/value/value.ts +3 -0
  160. package/src/framework/observableInterfaces.ts +0 -39
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.css = exports.style = exports.root = exports.properties = exports.event = exports.observableImplementations = exports.observableInterfaces = exports.element = exports.attributes = exports.utilities = exports.controls = void 0;
36
+ exports.css = exports.style = exports.root = exports.properties = exports.event = exports.observable = exports.element = exports.attributes = exports.utilities = exports.controls = void 0;
37
37
  const controls = __importStar(require("./controls/index"));
38
38
  exports.controls = controls;
39
39
  const utilities = __importStar(require("./utilities/index"));
@@ -44,10 +44,8 @@ const element = __importStar(require("./framework/element"));
44
44
  exports.element = element;
45
45
  const event = __importStar(require("./framework/event"));
46
46
  exports.event = event;
47
- const observableInterfaces = __importStar(require("./framework/observableInterfaces"));
48
- exports.observableInterfaces = observableInterfaces;
49
- const observableImplementations = __importStar(require("./framework/observablelmplementations"));
50
- exports.observableImplementations = observableImplementations;
47
+ const observable = __importStar(require("./framework/observable"));
48
+ exports.observable = observable;
51
49
  const properties = __importStar(require("./framework/properties"));
52
50
  exports.properties = properties;
53
51
  const root = __importStar(require("./framework/root"));
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAA6C;AAapC,4BAAQ;AAZjB,6DAA+C;AAatC,8BAAS;AAXlB,mEAAqD;AAa5C,gCAAU;AAZnB,6DAA+C;AAatC,0BAAO;AAZhB,yDAA2C;AAelC,sBAAK;AAdd,uFAAyE;AAYhE,oDAAoB;AAX7B,iGAAmF;AAY1E,8DAAyB;AAXlC,mEAAqD;AAa5C,gCAAU;AAZnB,uDAAyC;AAahC,oBAAI;AAZb,yDAA2C;AAalC,sBAAK;AAZd,qDAAuC;AAa9B,kBAAG"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAA6C;AAYpC,4BAAQ;AAXjB,6DAA+C;AAYtC,8BAAS;AAVlB,mEAAqD;AAY5C,gCAAU;AAXnB,6DAA+C;AAYtC,0BAAO;AAXhB,yDAA2C;AAalC,sBAAK;AAZd,mEAAqD;AAW5C,gCAAU;AAVnB,mEAAqD;AAY5C,gCAAU;AAXnB,uDAAyC;AAYhC,oBAAI;AAXb,yDAA2C;AAYlC,sBAAK;AAXd,qDAAuC;AAY9B,kBAAG"}
@@ -0,0 +1,5 @@
1
+ export interface IWebSocketMessageHandler {
2
+ handleWebSocketMessage: (message: unknown) => void;
3
+ }
4
+ export declare function handleWebSocketMessage(context: object, message: unknown): void;
5
+ export declare function executeHandlerOnContext(context: object, handler: (context: any) => void, alreadyProcessedContexts?: Set<object>): void;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleWebSocketMessage = handleWebSocketMessage;
4
+ exports.executeHandlerOnContext = executeHandlerOnContext;
5
+ const observable_js_1 = require("../../framework/observable.js");
6
+ function handleWebSocketMessage(context, message) {
7
+ executeHandlerOnContext(context, (context) => {
8
+ const webSocketMessageHandler = context;
9
+ if (webSocketMessageHandler.handleWebSocketMessage && typeof webSocketMessageHandler.handleWebSocketMessage === "function") {
10
+ webSocketMessageHandler.handleWebSocketMessage(message);
11
+ }
12
+ });
13
+ }
14
+ function executeHandlerOnContext(context, handler, alreadyProcessedContexts) {
15
+ if (!alreadyProcessedContexts) {
16
+ alreadyProcessedContexts = new Set();
17
+ }
18
+ if (!context || typeof context !== "object" || alreadyProcessedContexts.has(context)) {
19
+ return;
20
+ }
21
+ alreadyProcessedContexts.add(context);
22
+ if (Array.isArray(context)) {
23
+ for (const arrayEntry of context) {
24
+ if (typeof arrayEntry === "object") {
25
+ executeHandlerOnContext(arrayEntry, handler, alreadyProcessedContexts);
26
+ }
27
+ }
28
+ }
29
+ else {
30
+ if (observable_js_1.observable.isSubscribable(context)) {
31
+ const unwrapped = observable_js_1.observable.unwrap(context);
32
+ if (typeof unwrapped === "object") {
33
+ executeHandlerOnContext(unwrapped, handler, alreadyProcessedContexts);
34
+ }
35
+ }
36
+ else {
37
+ handler(context);
38
+ for (const key of Object.keys(context)) {
39
+ const property = context[key];
40
+ if (property && typeof property === "object") {
41
+ executeHandlerOnContext(property, handler, alreadyProcessedContexts);
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ //# sourceMappingURL=object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.js","sourceRoot":"","sources":["../../../src/utilities/object/object.ts"],"names":[],"mappings":";;AAKA,wDAWC;AACD,0DAsCC;AAvDD,iEAA2D;AAK3D,SAAgB,sBAAsB,CAAC,OAAe,EAAE,OAAgB;IACpE,uBAAuB,CACnB,OAAO,EACP,CAAC,OAAO,EAAE,EAAE;QACR,MAAM,uBAAuB,GAAG,OAAmC,CAAC;QACpE,IAAI,uBAAuB,CAAC,sBAAsB,IAAI,OAAO,uBAAuB,CAAC,sBAAsB,KAAK,UAAU,EAAE,CAAC;YAEzH,uBAAuB,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAC5D,CAAC;IACL,CAAC,CACJ,CAAC;AACN,CAAC;AACD,SAAgB,uBAAuB,CAAC,OAAe,EAAE,OAA0B,EAAE,wBAAsC;IACvH,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAC5B,wBAAwB,GAAG,IAAI,GAAG,EAAE,CAAC;IACzC,CAAC;IAED,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,wBAAwB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QACnF,OAAO;IACX,CAAC;IAGD,wBAAwB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAGtC,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACzB,KAAK,MAAM,UAAU,IAAI,OAAyB,EAAE,CAAC;YACjD,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;gBACjC,uBAAuB,CAAC,UAAU,EAAE,OAAO,EAAE,wBAAwB,CAAC,CAAC;YAC3E,CAAC;QACL,CAAC;IACL,CAAC;SAAM,CAAC;QACJ,IAAI,0BAAU,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;YACrC,MAAM,SAAS,GAAG,0BAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC7C,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;gBAChC,uBAAuB,CAAC,SAAS,EAAE,OAAO,EAAE,wBAAwB,CAAC,CAAC;YAC1E,CAAC;QACL,CAAC;aAAM,CAAC;YAEJ,OAAO,CAAC,OAAO,CAAC,CAAC;YAGjB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;gBACrC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;gBAC9B,IAAI,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;oBAC3C,uBAAuB,CAAC,QAAQ,EAAE,OAAO,EAAE,wBAAwB,CAAC,CAAC;gBACzE,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;AACL,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function isNullOrUndefined(value: any): boolean;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isNullOrUndefined = isNullOrUndefined;
4
+ function isNullOrUndefined(value) {
5
+ return value === null || typeof value === "undefined";
6
+ }
7
+ //# sourceMappingURL=value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value.js","sourceRoot":"","sources":["../../../src/utilities/value/value.ts"],"names":[],"mappings":";;AAAA,8CAEC;AAFD,SAAgB,iBAAiB,CAAC,KAAK;IACnC,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,WAAW,CAAC;AAC1D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jpf",
3
- "version": "5.0.61",
3
+ "version": "5.0.63",
4
4
  "description": "Javascript Presentation Foundation base classes and interfaces",
5
5
  "keywords": [
6
6
  "mvvm",
@@ -1,8 +1,6 @@
1
- import { Element, addElementToDictionary } from "../../../framework/element";
1
+ import { Element, addElementToDictionary,ElementProperties, IElementProperties, extendProperties } from "../../../framework/element";
2
2
  import { createClickEvent } from "../../../framework/event";
3
- import { Properties, IProperties, extendProperties } from "../../../framework/properties";
4
- import { ISubscribable } from "../../../framework/observableInterfaces";
5
- import { isSubscribable, isObservableValue, unwrap } from "../../../framework/observablelmplementations";
3
+ import { ISubscribable , observable} from "../../../framework/observable";
6
4
  import { EditorView, basicSetup } from "codemirror";
7
5
  import { EditorState, Extension } from "@codemirror/state";
8
6
  import { keymap } from "@codemirror/view";
@@ -18,7 +16,7 @@ import { createDiv } from "../../html/Div/Div";
18
16
 
19
17
  export type mode = "json" | "html" | "css" | "less" | "javascript" | "typescript";
20
18
 
21
- export interface IEditorProperties extends IProperties {
19
+ export interface IEditorProperties extends IElementProperties {
22
20
  mode: mode;
23
21
  value?: string | ISubscribable<string>;
24
22
  }
@@ -112,7 +110,7 @@ export class EditorElement extends Element<IEditorProperties> {
112
110
  },
113
111
  eventListeners: [
114
112
  createClickEvent(() => {
115
- if (isObservableValue(properties.value)) {
113
+ if (observable.isObservableValue(properties.value)) {
116
114
  properties.value.setValue(this.editor.state.doc.toString());
117
115
  }
118
116
  })
@@ -132,7 +130,7 @@ export class EditorElement extends Element<IEditorProperties> {
132
130
  }
133
131
  );
134
132
 
135
- this.element.appendChild(buttons.render());
133
+ this.htmlElement.appendChild(buttons.render());
136
134
  const extensions: Extension[] = [
137
135
  basicSetup,
138
136
  EditorView.lineWrapping,
@@ -162,17 +160,17 @@ export class EditorElement extends Element<IEditorProperties> {
162
160
  extensions: extensions
163
161
  }
164
162
  ),
165
- parent: this.element,
163
+ parent: this.htmlElement,
166
164
 
167
165
  });
168
166
 
169
167
  this.editor.dom.style.overflow = "auto";
170
168
 
171
169
  //Set the initial value;
172
- this.editor.dispatch({ changes: { from: 0, to: this.editor.state.doc.length, insert: unwrap(properties.value) } });
170
+ this.editor.dispatch({ changes: { from: 0, to: this.editor.state.doc.length, insert: observable.unwrap(properties.value) } });
173
171
 
174
172
  //Find out if the viewModel property is observable.
175
- if (isSubscribable(properties.value)) {
173
+ if (observable.isSubscribable(properties.value)) {
176
174
  this.disposers.push(
177
175
  properties.value.subscribe(
178
176
  (html) => {
@@ -188,7 +186,7 @@ export function createEditor(properties: IEditorProperties) {
188
186
  return new EditorElement(properties);
189
187
  }
190
188
 
191
- export class EditorProperties extends Properties implements IEditorProperties {
189
+ export class EditorProperties extends ElementProperties implements IEditorProperties {
192
190
  constructor(properties: IEditorProperties) {
193
191
  super();
194
192
  this.setProperties(this, properties);
@@ -1,9 +1,8 @@
1
- import { Properties, IProperties, extendProperties } from "../../../framework/properties";
2
- import { Element, addElementToDictionary } from "../../../framework/element";
1
+ import { Element, addElementToDictionary ,ElementProperties, IElementProperties, extendProperties } from "../../../framework/element";
3
2
  import { IButtonProperties, createButton} from "../../html/Button/Button";
4
3
  import { createInput, IInputProperties } from "../../html/Input/Input";
5
4
 
6
- export interface IFileSelectorProperties extends IProperties {
5
+ export interface IFileSelectorProperties extends IElementProperties {
7
6
  button?: IButtonProperties;
8
7
  inputFile: IInputProperties<FileList>;
9
8
  }
@@ -33,7 +32,7 @@ export class FileSelectorElement extends Element<IFileSelectorProperties> {
33
32
 
34
33
  const fileInput = createInput(inputProperties).render();
35
34
 
36
- this.element.appendChild(fileInput);
35
+ this.htmlElement.appendChild(fileInput);
37
36
 
38
37
  if (properties.button) {
39
38
  const button = createButton(
@@ -52,7 +51,7 @@ export class FileSelectorElement extends Element<IFileSelectorProperties> {
52
51
  )
53
52
  ).render();
54
53
 
55
- this.element.appendChild(button);
54
+ this.htmlElement.appendChild(button);
56
55
  }
57
56
  }
58
57
  }
@@ -61,7 +60,7 @@ export function createFileSelector(properties: IFileSelectorProperties) {
61
60
  return new FileSelectorElement(properties);
62
61
  }
63
62
 
64
- export class FileSelectorProperties extends Properties implements IFileSelectorProperties {
63
+ export class FileSelectorProperties extends ElementProperties implements IFileSelectorProperties {
65
64
  constructor(properties: IFileSelectorProperties) {
66
65
  super();
67
66
  this.setProperties(this, properties);
@@ -1,9 +1,8 @@
1
- import { Properties, IProperties, extendProperties } from "../../../framework/properties"
2
- import { Element, IElement, addElementToDictionary } from "../../../framework/element";
1
+ import { Element, IElement, addElementToDictionary,ElementProperties, IElementProperties, extendProperties } from "../../../framework/element";
3
2
  import { createDiv } from "../../html/Div/Div";
4
3
 
5
- export interface ILabeledViewProperties extends IProperties {
6
- labelProperties: IProperties;
4
+ export interface ILabeledViewProperties extends IElementProperties {
5
+ labelProperties: IElementProperties;
7
6
  element: IElement;
8
7
  }
9
8
 
@@ -39,12 +38,12 @@ export function createLabeledControl(properties: ILabeledViewProperties) {
39
38
  return new LabeledControlElement(properties);
40
39
  }
41
40
 
42
- export class LabeledControlProperties extends Properties implements ILabeledViewProperties {
41
+ export class LabeledControlProperties extends ElementProperties implements ILabeledViewProperties {
43
42
  constructor(properties: ILabeledViewProperties) {
44
43
  super();
45
44
  this.setProperties(this, properties);
46
45
  }
47
- labelProperties: Properties;
46
+ labelProperties: ElementProperties;
48
47
  element: IElement;
49
48
  }
50
49
 
@@ -1,14 +1,12 @@
1
- import { Element, getElement, addElementToDictionary } from "../../../framework/element";
2
- import { Properties, IProperties, extendProperties } from "../../../framework/properties";
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 IProperties {
7
+ export interface IListItemProperties extends IElementProperties {
10
8
  id: number | string;
11
- text?: string | ISubscribable<string> | Properties;
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 | Properties) {
52
+ private setContent(content: string | ElementProperties) {
55
53
  if (typeof content === "string") {
56
- this.element.innerHTML = content;
57
- } else if (content instanceof Properties) {
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 Properties implements IListItemProperties {
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 | Properties;
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 Properties implements IHierarchicalListItemProperties {
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 | Properties;
87
+ text?: string | ElementProperties;
90
88
  select?: () => void;
91
89
  order?: number | string;
92
90
  parentId?: number | string;
@@ -1,10 +1,8 @@
1
- import { Properties, IProperties, extendProperties } from "../../../framework/properties"
2
- import { Element, getElement, addElementToDictionary } from "../../../framework/element";
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 IProperties {
7
- content?: string | Properties | ISubscribable<string | Properties>;
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 | Properties) {
40
+ private buildContent(content: string | ElementProperties) {
43
41
  if (content == null || content === undefined) {
44
- this.element.innerText = null;
42
+ this.htmlElement.innerText = null;
45
43
  }
46
44
  else if (typeof content === "string") {
47
- this.element.innerText = content;
45
+ this.htmlElement.innerText = content;
48
46
  }
49
- else if (content instanceof Properties) {
50
- this.setChildren(getElement(content as Properties));
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 Properties implements IButtonProperties {
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 | Properties | ISubscribable<string | Properties>;
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 { IProperties, extendProperties, Properties } from "../../../framework/properties";
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 IProperties {
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 Properties implements IDivProperties {
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 { Properties, IProperties, extendProperties } from "../../../framework/properties";
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 IProperties {
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 Properties implements IImageProperties {
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/observableInterfaces";
6
- import { isSubscribable, unwrap, isObservableValue } from "../../../framework/observablelmplementations";
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 IProperties {
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.element;
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.element as HTMLInputElement;
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.element.addEventListener(
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.element.addEventListener(
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 Properties implements IInputProperties<TValue> {
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);