x4js 1.4.5 → 1.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,8 +36,9 @@ interface ApplicationEventMap extends BaseComponentEventMap {
36
36
  export interface ApplicationProps extends BaseComponentProps<ApplicationEventMap> {
37
37
  app_name: string;
38
38
  app_version: string;
39
- app_uid: string;
40
- locale: string;
39
+ app_uid?: string;
40
+ locale?: string;
41
+ renderTo?: HTMLElement;
41
42
  }
42
43
  /**
43
44
  * Represents an x4 application, which is typically a single page app.
@@ -117,7 +117,11 @@ class Application extends base_component_1.BaseComponent {
117
117
  set mainView(root) {
118
118
  this.m_mainView = root;
119
119
  (0, tools_1.deferCall)(() => {
120
- document.body.appendChild(root._build());
120
+ const dest = this.m_props.renderTo ?? document.body;
121
+ while (dest.firstChild) {
122
+ dest.removeChild(dest.firstChild);
123
+ }
124
+ dest.appendChild(root._build());
121
125
  });
122
126
  }
123
127
  get mainView() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x4js",
3
- "version": "1.4.5",
3
+ "version": "1.4.6",
4
4
  "description": "X4js core files",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -43,8 +43,9 @@ interface ApplicationEventMap extends BaseComponentEventMap {
43
43
  export interface ApplicationProps extends BaseComponentProps<ApplicationEventMap> {
44
44
  app_name: string; //
45
45
  app_version: string; //
46
- app_uid: string;
47
- locale: string; // fr-FR
46
+ app_uid?: string;
47
+ locale?: string; // fr-FR
48
+ renderTo?: HTMLElement;
48
49
  }
49
50
 
50
51
  /**
@@ -113,7 +114,6 @@ export class Application<P extends ApplicationProps = ApplicationProps, E extend
113
114
  }
114
115
 
115
116
  ApplicationCreated( ) {
116
-
117
117
  }
118
118
 
119
119
  public get app_name( ) {
@@ -160,7 +160,11 @@ export class Application<P extends ApplicationProps = ApplicationProps, E extend
160
160
  this.m_mainView = root;
161
161
 
162
162
  deferCall( ( ) => {
163
- document.body.appendChild(root._build());
163
+ const dest = this.m_props.renderTo ?? document.body;
164
+ while (dest.firstChild) {
165
+ dest.removeChild(dest.firstChild);
166
+ }
167
+ dest.appendChild(root._build());
164
168
  } );
165
169
  }
166
170