codenotch-react 1.0.63 → 1.0.65

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.
@@ -1,8 +1,10 @@
1
1
  import React from "react";
2
2
  import { SpaRenderStatus } from '@echino/echino.ui.framework/components/SpaBuilder/common/ISpaRenderProps';
3
+ import type { ICodenotchEnv } from "../models/Codenotch";
3
4
  interface IAumlProps {
4
5
  value: string;
5
6
  verbose?: boolean;
7
+ env?: ICodenotchEnv;
6
8
  }
7
9
  interface IAumlState {
8
10
  loaded: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"Auml.d.ts","sourceRoot":"","sources":["../../src/components/Auml.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,0EAA0E,CAAC;AAW3G,UAAU,UAAU;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,UAAU;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,gBAAgB,EAAE,OAAO,CAAC;CAC7B;AAED,qBAAa,IAAK,SAAQ,KAAK,CAAC,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;IAE7D,kBAAkB,EAAE,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC;gBAEnC,KAAK,EAAE,UAAU;IAa7B,iBAAiB;IAIjB,oBAAoB;IAoCpB,oBAAoB;IAOpB,QAAQ,CAAC,CAAC,EAAE,eAAe;IAS3B,cAAc;;;IAMd,wBAAwB,IAAI,MAAM,GAAG,IAAI;IAqCzC,2BAA2B,CAAC,kBAAkB,EAAE,MAAM,GAAG,MAAM;IAO/D,QAAQ,CAAC,EAAE,EAAE,MAAM;IAmBnB,QAAQ,CAAC,KAAK,EAAE,MAAM;IAUtB,MAAM;IAkDN,oBAAoB;IAkBd,mBAAmB;CAoC5B"}
1
+ {"version":3,"file":"Auml.d.ts","sourceRoot":"","sources":["../../src/components/Auml.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,0EAA0E,CAAC;AAE3G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AASzD,UAAU,UAAU;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,UAAU,UAAU;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,gBAAgB,EAAE,OAAO,CAAC;CAC7B;AAED,qBAAa,IAAK,SAAQ,KAAK,CAAC,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;IAE7D,kBAAkB,EAAE,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC;gBAEnC,KAAK,EAAE,UAAU;IAa7B,iBAAiB;IAIjB,oBAAoB;IAoCpB,oBAAoB;IAOpB,QAAQ,CAAC,CAAC,EAAE,eAAe;IAS3B,cAAc;;;IAMd,wBAAwB,IAAI,MAAM,GAAG,IAAI;IAqCzC,2BAA2B,CAAC,kBAAkB,EAAE,MAAM,GAAG,MAAM;IAO/D,QAAQ,CAAC,EAAE,EAAE,MAAM;IAmBnB,QAAQ,CAAC,KAAK,EAAE,MAAM;IAUtB,MAAM;IAoDN,oBAAoB;IAkBd,mBAAmB;CAoC5B"}
@@ -1,37 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
4
  };
@@ -40,7 +7,6 @@ exports.Auml = void 0;
40
7
  const react_1 = __importDefault(require("react"));
41
8
  const SpaRenderWithBrowserRouter_1 = require("@echino/echino.ui.framework/components/SpaBuilder/SpaRender/SpaRenderWithBrowserRouter");
42
9
  const I18nUtils_1 = __importDefault(require("../utils/I18nUtils"));
43
- const Codenotch = __importStar(require("../index"));
44
10
  class Auml extends react_1.default.Component {
45
11
  constructor(props) {
46
12
  super(props);
@@ -157,8 +123,7 @@ class Auml extends react_1.default.Component {
157
123
  }
158
124
  render() {
159
125
  let inputs = this.retrieveInputs();
160
- const cn = Codenotch.useCodenotch();
161
- let theme = cn.env.theme === "dark";
126
+ let theme = this.props.env?.theme === "dark";
162
127
  let aumlManifest = null;
163
128
  try {
164
129
  let appManifestObj = JSON.parse(appManifest);
@@ -166,19 +131,22 @@ class Auml extends react_1.default.Component {
166
131
  }
167
132
  catch { }
168
133
  let auml = this.props.value;
169
- try {
170
- auml = I18nUtils_1.default.compileAuml(auml, cn);
171
- if (this.props.verbose === true) {
172
- console.log("Compiled AUML with i18n variables: ", auml);
134
+ if (this.props.env) {
135
+ try {
136
+ auml = I18nUtils_1.default.compileAuml(auml, this.props.env);
137
+ if (this.props.verbose === true) {
138
+ console.log("Compiled AUML with i18n variables: ", auml);
139
+ console.log("i18n variables: ", this.props.env.i18n);
140
+ }
141
+ }
142
+ catch (err) {
143
+ console.error("Error compiling AUML with i18n variables: " + err);
173
144
  }
174
- }
175
- catch (err) {
176
- console.error("Error compiling AUML with i18n variables: " + err);
177
145
  }
178
146
  return react_1.default.createElement("div", { className: "app" },
179
147
  react_1.default.createElement(SpaRenderWithBrowserRouter_1.SpaRenderWithBrowserRouter, { appDescription: auml, tenant: tenant, serviceName: serviceName, packageVersions: packageVersions, user: user, languages: languages, onProgress: (s) => this.progress(s), input: inputs, theme: theme, manifest: aumlManifest, inspectorEnabled: this.state.inspectorEnabled, children: [] }),
180
148
  !this.state.loaded &&
181
- react_1.default.createElement("div", { className: `app-loading ${cn.env.theme ?? 'light'}` },
149
+ react_1.default.createElement("div", { className: `app-loading ${this.props.env?.theme ?? 'light'}` },
182
150
  this.renderLoadingContent(),
183
151
  react_1.default.createElement("i", { className: "fas fa-circle-notch fa-spin" })));
184
152
  }
@@ -1,6 +1,6 @@
1
- import { ICodenotchApi } from "..";
1
+ import { ICodenotchEnv } from "..";
2
2
  export default abstract class I18nUtils {
3
- static compileAuml(auml: string, api: ICodenotchApi): string;
3
+ static compileAuml(auml: string, env: ICodenotchEnv): string;
4
4
  private static injectI18n;
5
5
  }
6
6
  //# sourceMappingURL=I18nUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"I18nUtils.d.ts","sourceRoot":"","sources":["../../src/utils/I18nUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAgB,MAAM,IAAI,CAAC;AAEjD,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,SAAS;WAErB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,GAAG,MAAM;IAOnE,OAAO,CAAC,MAAM,CAAC,UAAU;CAqB5B"}
1
+ {"version":3,"file":"I18nUtils.d.ts","sourceRoot":"","sources":["../../src/utils/I18nUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAgB,MAAM,IAAI,CAAC;AAEhE,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,SAAS;WAErB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,GAAG,MAAM;IAOnE,OAAO,CAAC,MAAM,CAAC,UAAU;CAqB5B"}
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class I18nUtils {
4
- static compileAuml(auml, api) {
5
- auml = this.injectI18n(auml, api);
4
+ static compileAuml(auml, env) {
5
+ auml = this.injectI18n(auml, env);
6
6
  return auml;
7
7
  }
8
- static injectI18n(auml, api) {
9
- let i18n = api.env.i18n ?? {};
8
+ static injectI18n(auml, env) {
9
+ let i18n = env.i18n ?? {};
10
10
  if (Object.keys(i18n).length === 0) {
11
11
  // No i18n variables, return original auml
12
12
  return auml;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codenotch-react",
3
- "version": "1.0.63",
3
+ "version": "1.0.65",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "author": "Codenotch SA",