codenotch-react 1.0.62 → 1.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.
@@ -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;IAmDN,oBAAoB;IAkBd,mBAAmB;CAoC5B"}
@@ -7,7 +7,6 @@ exports.Auml = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const SpaRenderWithBrowserRouter_1 = require("@echino/echino.ui.framework/components/SpaBuilder/SpaRender/SpaRenderWithBrowserRouter");
9
9
  const I18nUtils_1 = __importDefault(require("../utils/I18nUtils"));
10
- const index_1 = require("../index");
11
10
  class Auml extends react_1.default.Component {
12
11
  constructor(props) {
13
12
  super(props);
@@ -124,8 +123,7 @@ class Auml extends react_1.default.Component {
124
123
  }
125
124
  render() {
126
125
  let inputs = this.retrieveInputs();
127
- const cn = (0, index_1.useCodenotch)();
128
- let theme = cn.env.theme === "dark";
126
+ let theme = this.props.env?.theme === "dark";
129
127
  let aumlManifest = null;
130
128
  try {
131
129
  let appManifestObj = JSON.parse(appManifest);
@@ -133,19 +131,21 @@ class Auml extends react_1.default.Component {
133
131
  }
134
132
  catch { }
135
133
  let auml = this.props.value;
136
- try {
137
- auml = I18nUtils_1.default.compileAuml(auml, cn);
138
- if (this.props.verbose === true) {
139
- 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
+ }
140
+ }
141
+ catch (err) {
142
+ console.error("Error compiling AUML with i18n variables: " + err);
140
143
  }
141
- }
142
- catch (err) {
143
- console.error("Error compiling AUML with i18n variables: " + err);
144
144
  }
145
145
  return react_1.default.createElement("div", { className: "app" },
146
146
  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: [] }),
147
147
  !this.state.loaded &&
148
- react_1.default.createElement("div", { className: `app-loading ${cn.env.theme ?? 'light'}` },
148
+ react_1.default.createElement("div", { className: `app-loading ${this.props.env?.theme ?? 'light'}` },
149
149
  this.renderLoadingContent(),
150
150
  react_1.default.createElement("i", { className: "fas fa-circle-notch fa-spin" })));
151
151
  }
@@ -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.62",
3
+ "version": "1.0.64",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "author": "Codenotch SA",