@finos/legend-application 0.1.0 → 0.2.2

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 (50) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/lib/components/ActionAlert.d.ts.map +1 -1
  3. package/lib/components/ActionAlert.js +5 -8
  4. package/lib/components/ActionAlert.js.map +1 -1
  5. package/lib/components/AppHeader.d.ts +20 -0
  6. package/lib/components/AppHeader.d.ts.map +1 -0
  7. package/lib/components/AppHeader.js +26 -0
  8. package/lib/components/AppHeader.js.map +1 -0
  9. package/lib/components/ApplicationStoreProvider.js +1 -1
  10. package/lib/components/ApplicationStoreProvider.js.map +1 -1
  11. package/lib/components/ApplicationStoreProviderTestUtils.js +1 -1
  12. package/lib/components/ApplicationStoreProviderTestUtils.js.map +1 -1
  13. package/lib/components/BlockingAlert.js +2 -2
  14. package/lib/components/BlockingAlert.js.map +1 -1
  15. package/lib/components/LambdaEditor.d.ts.map +1 -1
  16. package/lib/components/LambdaEditor.js +18 -19
  17. package/lib/components/LambdaEditor.js.map +1 -1
  18. package/lib/components/NotificationSnackbar.js +12 -12
  19. package/lib/components/NotificationSnackbar.js.map +1 -1
  20. package/lib/components/TextInputEditor.d.ts.map +1 -1
  21. package/lib/components/TextInputEditor.js +16 -7
  22. package/lib/components/TextInputEditor.js.map +1 -1
  23. package/lib/components/WebApplicationNavigatorProvider.d.ts.map +1 -1
  24. package/lib/components/WebApplicationNavigatorProvider.js +1 -1
  25. package/lib/components/WebApplicationNavigatorProvider.js.map +1 -1
  26. package/lib/index.css +2 -2
  27. package/lib/index.css.map +1 -1
  28. package/lib/index.d.ts +1 -0
  29. package/lib/index.d.ts.map +1 -1
  30. package/lib/index.js +1 -0
  31. package/lib/index.js.map +1 -1
  32. package/lib/stores/ApplicationStore.d.ts +1 -1
  33. package/lib/stores/ApplicationStore.d.ts.map +1 -1
  34. package/lib/stores/ApplicationStore.js +2 -4
  35. package/lib/stores/ApplicationStore.js.map +1 -1
  36. package/lib/stores/WebApplicationNavigator.d.ts +18 -1
  37. package/lib/stores/WebApplicationNavigator.d.ts.map +1 -1
  38. package/lib/stores/WebApplicationNavigator.js +5 -2
  39. package/lib/stores/WebApplicationNavigator.js.map +1 -1
  40. package/package.json +17 -17
  41. package/src/components/ActionAlert.tsx +1 -4
  42. package/src/components/AppHeader.tsx +47 -0
  43. package/src/components/LambdaEditor.tsx +11 -10
  44. package/src/components/TextInputEditor.tsx +17 -5
  45. package/src/components/WebApplicationNavigatorProvider.tsx +2 -1
  46. package/src/index.ts +1 -0
  47. package/src/stores/ApplicationStore.ts +2 -8
  48. package/src/stores/WebApplicationNavigator.ts +22 -2
  49. package/tsconfig.json +2 -5
  50. package/tsconfig.package.json +0 -40
@@ -20,6 +20,20 @@ import { guaranteeNonNullable } from '@finos/legend-shared';
20
20
  /**
21
21
  * This is an initial attempt to try to generalize the application
22
22
  * to other platforms. But regardless, this is more convenient for testing.
23
+ *
24
+ * FIXME: this is not the right way to do this. Our intention here is to make
25
+ * app navigator something generic enough so we are somewhat platform-agnostic
26
+ * i.e. browser, electron, PC, UNIX, etc.
27
+ *
28
+ * Parameterize on the type of the location might not be the best thing to do.
29
+ * Because typing wise, this forces us to also parameterize consumers of this,
30
+ * which is `ApplicationStore`. It means that we must dictate in the source
31
+ * code the platform the app depends on, clearly for web browser, `string` is the
32
+ * easy option, but if we do so, it defeats the purpose of this abstraction in the
33
+ * first place.
34
+ *
35
+ * As such, instead, we should design a more generic concept `Location` to pass around.
36
+ * We would need to flesh out the details, but this is the rough idea.
23
37
  */
24
38
  interface ApplicationNavigator<T> {
25
39
  reload(): void;
@@ -27,6 +41,8 @@ interface ApplicationNavigator<T> {
27
41
  jumpTo(location: T): void;
28
42
  openNewWindow(location: T): void;
29
43
  getCurrentLocation(): T;
44
+ getCurrentLocationPath(): T;
45
+ generateLocation(locationPath: T): T;
30
46
  }
31
47
 
32
48
  export class WebApplicationNavigator implements ApplicationNavigator<string> {
@@ -63,10 +79,14 @@ export class WebApplicationNavigator implements ApplicationNavigator<string> {
63
79
  return this.window.location.href;
64
80
  }
65
81
 
66
- generateLocation(location: string): string {
82
+ getCurrentLocationPath(): string {
83
+ return this.historyAPI.location.pathname;
84
+ }
85
+
86
+ generateLocation(locationPath: string): string {
67
87
  return (
68
88
  window.location.origin +
69
- this.historyAPI.createHref({ pathname: location })
89
+ this.historyAPI.createHref({ pathname: locationPath })
70
90
  );
71
91
  }
72
92
  }
package/tsconfig.json CHANGED
@@ -22,6 +22,7 @@
22
22
  "allowSyntheticDefaultImports": true,
23
23
  "strict": true,
24
24
  "noImplicitOverride": true,
25
+ "noUncheckedIndexedAccess": true,
25
26
  "exactOptionalPropertyTypes": true,
26
27
  "forceConsistentCasingInFileNames": true,
27
28
  "outDir": "./lib",
@@ -29,11 +30,6 @@
29
30
  "rootDir": "./src",
30
31
  "jsx": "react-jsx"
31
32
  },
32
- "references": [
33
- {
34
- "path": "./tsconfig.package.json"
35
- }
36
- ],
37
33
  "files": [
38
34
  "./src/const.ts",
39
35
  "./src/index.ts",
@@ -49,6 +45,7 @@
49
45
  "./src/stores/WebApplicationNavigator.ts",
50
46
  "./src/application/LegendApplication.tsx",
51
47
  "./src/components/ActionAlert.tsx",
48
+ "./src/components/AppHeader.tsx",
52
49
  "./src/components/ApplicationBackdrop.tsx",
53
50
  "./src/components/ApplicationStoreProvider.tsx",
54
51
  "./src/components/ApplicationStoreProviderTestUtils.tsx",
@@ -1,40 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "lib": [
4
- "dom",
5
- "dom.iterable",
6
- "esnext",
7
- "webworker",
8
- "scripthost"
9
- ],
10
- "composite": true,
11
- "declaration": true,
12
- "declarationMap": true,
13
- "sourceMap": true,
14
- "target": "esnext",
15
- "module": "esnext",
16
- "skipLibCheck": true,
17
- "moduleResolution": "node",
18
- "resolveJsonModule": true,
19
- "isolatedModules": true,
20
- "importsNotUsedAsValues": "error",
21
- "esModuleInterop": true,
22
- "allowSyntheticDefaultImports": true,
23
- "strict": true,
24
- "noImplicitOverride": true,
25
- "exactOptionalPropertyTypes": true,
26
- "forceConsistentCasingInFileNames": true,
27
- "outDir": "./lib",
28
- "tsBuildInfoFile": "./build/package.tsbuildinfo",
29
- "rootDir": "./"
30
- },
31
- "files": [
32
- "./package.json"
33
- ],
34
- "include": [
35
- "package.json"
36
- ],
37
- "exclude": [
38
- "lib"
39
- ]
40
- }