@finos/legend-application 3.0.3 → 4.0.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 (176) hide show
  1. package/lib/application/LegendApplication.d.ts +2 -2
  2. package/lib/application/LegendApplication.d.ts.map +1 -1
  3. package/lib/application/LegendApplication.js +4 -4
  4. package/lib/application/LegendApplication.js.map +1 -1
  5. package/lib/application/LegendApplicationPluginManager.d.ts +3 -3
  6. package/lib/application/LegendApplicationPluginManager.d.ts.map +1 -1
  7. package/lib/components/ActionAlert.d.ts +1 -0
  8. package/lib/components/ActionAlert.d.ts.map +1 -1
  9. package/lib/components/ActionAlert.js +2 -2
  10. package/lib/components/ActionAlert.js.map +1 -1
  11. package/lib/components/ApplicationStoreProvider.d.ts +3 -3
  12. package/lib/components/ApplicationStoreProvider.d.ts.map +1 -1
  13. package/lib/components/ApplicationStoreProvider.js +2 -2
  14. package/lib/components/ApplicationStoreProvider.js.map +1 -1
  15. package/lib/components/ApplicationStoreProviderTestUtils.d.ts +5 -5
  16. package/lib/components/ApplicationStoreProviderTestUtils.d.ts.map +1 -1
  17. package/lib/components/ApplicationStoreProviderTestUtils.js +5 -4
  18. package/lib/components/ApplicationStoreProviderTestUtils.js.map +1 -1
  19. package/lib/components/ApplicationTestID.js +1 -1
  20. package/lib/components/ApplicationTestID.js.map +1 -1
  21. package/lib/components/BasicValueSpecificationEditor.d.ts +44 -0
  22. package/lib/components/BasicValueSpecificationEditor.d.ts.map +1 -0
  23. package/lib/components/BasicValueSpecificationEditor.js +276 -0
  24. package/lib/components/BasicValueSpecificationEditor.js.map +1 -0
  25. package/lib/components/BlockingAlert.d.ts +1 -0
  26. package/lib/components/BlockingAlert.d.ts.map +1 -1
  27. package/lib/components/BlockingAlert.js +1 -1
  28. package/lib/components/BlockingAlert.js.map +1 -1
  29. package/lib/components/CustomDatePicker.d.ts +38 -0
  30. package/lib/components/CustomDatePicker.d.ts.map +1 -0
  31. package/lib/components/CustomDatePicker.js +592 -0
  32. package/lib/components/CustomDatePicker.js.map +1 -0
  33. package/lib/components/DocumentationLink.d.ts +1 -1
  34. package/lib/components/DocumentationLink.js +2 -2
  35. package/lib/components/DocumentationLink.js.map +1 -1
  36. package/lib/components/LambdaEditor.d.ts +2 -1
  37. package/lib/components/LambdaEditor.d.ts.map +1 -1
  38. package/lib/components/LambdaEditor.js +3 -3
  39. package/lib/components/LambdaEditor.js.map +1 -1
  40. package/lib/components/LambdaParameterValuesEditor.d.ts +25 -0
  41. package/lib/components/LambdaParameterValuesEditor.d.ts.map +1 -0
  42. package/lib/components/LambdaParameterValuesEditor.js +52 -0
  43. package/lib/components/LambdaParameterValuesEditor.js.map +1 -0
  44. package/lib/components/LegendApplicationComponentFrameworkProvider.d.ts +1 -1
  45. package/lib/components/LegendApplicationComponentFrameworkProvider.js +3 -3
  46. package/lib/components/LegendApplicationComponentFrameworkProvider.js.map +1 -1
  47. package/lib/components/LegendApplicationNavigationContextServiceUtils.d.ts +32 -0
  48. package/lib/components/LegendApplicationNavigationContextServiceUtils.d.ts.map +1 -0
  49. package/lib/components/LegendApplicationNavigationContextServiceUtils.js +57 -0
  50. package/lib/components/LegendApplicationNavigationContextServiceUtils.js.map +1 -0
  51. package/lib/components/NotificationManager.d.ts +1 -0
  52. package/lib/components/NotificationManager.d.ts.map +1 -1
  53. package/lib/components/NotificationManager.js +2 -2
  54. package/lib/components/NotificationManager.js.map +1 -1
  55. package/lib/components/TextInputEditor.d.ts +2 -2
  56. package/lib/components/TextInputEditor.d.ts.map +1 -1
  57. package/lib/components/TextInputEditor.js +2 -2
  58. package/lib/components/TextInputEditor.js.map +1 -1
  59. package/lib/components/{AppHeader.d.ts → VirtualAssistant.d.ts} +5 -5
  60. package/lib/components/VirtualAssistant.d.ts.map +1 -0
  61. package/lib/components/VirtualAssistant.js +171 -0
  62. package/lib/components/VirtualAssistant.js.map +1 -0
  63. package/lib/components/WebApplicationNavigatorProvider.d.ts +2 -2
  64. package/lib/components/WebApplicationNavigatorProvider.d.ts.map +1 -1
  65. package/lib/components/WebApplicationNavigatorProvider.js +1 -1
  66. package/lib/components/WebApplicationNavigatorProvider.js.map +1 -1
  67. package/lib/components/WebApplicationNavigatorProviderTestUtils.d.ts +2 -2
  68. package/lib/components/WebApplicationNavigatorProviderTestUtils.d.ts.map +1 -1
  69. package/lib/components/WebApplicationNavigatorProviderTestUtils.js +3 -2
  70. package/lib/components/WebApplicationNavigatorProviderTestUtils.js.map +1 -1
  71. package/lib/const.js +2 -2
  72. package/lib/const.js.map +1 -1
  73. package/lib/index.css +2 -2
  74. package/lib/index.css.map +1 -1
  75. package/lib/index.d.ts +30 -22
  76. package/lib/index.d.ts.map +1 -1
  77. package/lib/index.js +32 -22
  78. package/lib/index.js.map +1 -1
  79. package/lib/stores/ApplicationEvent.d.ts +9 -7
  80. package/lib/stores/ApplicationEvent.d.ts.map +1 -1
  81. package/lib/stores/ApplicationEvent.js +10 -8
  82. package/lib/stores/ApplicationEvent.js.map +1 -1
  83. package/lib/stores/ApplicationStore.d.ts +15 -9
  84. package/lib/stores/ApplicationStore.d.ts.map +1 -1
  85. package/lib/stores/ApplicationStore.js +26 -21
  86. package/lib/stores/ApplicationStore.js.map +1 -1
  87. package/lib/stores/ApplicationStoreTestUtils.d.ts +3 -3
  88. package/lib/stores/ApplicationStoreTestUtils.d.ts.map +1 -1
  89. package/lib/stores/ApplicationStoreTestUtils.js +2 -2
  90. package/lib/stores/ApplicationStoreTestUtils.js.map +1 -1
  91. package/lib/stores/ApplicationTelemetry.d.ts +1 -1
  92. package/lib/stores/ApplicationTelemetry.d.ts.map +1 -1
  93. package/lib/stores/ApplicationTelemetry.js +2 -2
  94. package/lib/stores/ApplicationTelemetry.js.map +1 -1
  95. package/lib/stores/CJS__Fuse.cjs +35 -0
  96. package/lib/stores/CJS__Fuse.cjs.map +1 -0
  97. package/lib/stores/CJS__Fuse.d.cts +28 -0
  98. package/lib/stores/CJS__Fuse.d.cts.map +1 -0
  99. package/lib/stores/LambdaParameterState.d.ts +59 -0
  100. package/lib/stores/LambdaParameterState.d.ts.map +1 -0
  101. package/lib/stores/LambdaParameterState.js +184 -0
  102. package/lib/stores/LambdaParameterState.js.map +1 -0
  103. package/lib/stores/LegendApplicationAssistantService.d.ts +63 -0
  104. package/lib/stores/LegendApplicationAssistantService.d.ts.map +1 -0
  105. package/lib/stores/LegendApplicationAssistantService.js +167 -0
  106. package/lib/stores/LegendApplicationAssistantService.js.map +1 -0
  107. package/lib/stores/LegendApplicationConfig.d.ts +5 -4
  108. package/lib/stores/LegendApplicationConfig.d.ts.map +1 -1
  109. package/lib/stores/LegendApplicationConfig.js +8 -3
  110. package/lib/stores/LegendApplicationConfig.js.map +1 -1
  111. package/lib/stores/LegendApplicationDocumentationService.d.ts +70 -0
  112. package/lib/stores/LegendApplicationDocumentationService.d.ts.map +1 -0
  113. package/lib/stores/LegendApplicationDocumentationService.js +152 -0
  114. package/lib/stores/LegendApplicationDocumentationService.js.map +1 -0
  115. package/lib/stores/LegendApplicationEventService.d.ts +22 -0
  116. package/lib/stores/LegendApplicationEventService.d.ts.map +1 -0
  117. package/lib/stores/LegendApplicationEventService.js +25 -0
  118. package/lib/stores/LegendApplicationEventService.js.map +1 -0
  119. package/lib/stores/LegendApplicationNavigationContextService.d.ts +74 -0
  120. package/lib/stores/LegendApplicationNavigationContextService.d.ts.map +1 -0
  121. package/lib/stores/LegendApplicationNavigationContextService.js +118 -0
  122. package/lib/stores/LegendApplicationNavigationContextService.js.map +1 -0
  123. package/lib/stores/LegendApplicationPlugin.d.ts +6 -2
  124. package/lib/stores/LegendApplicationPlugin.d.ts.map +1 -1
  125. package/lib/stores/LegendApplicationPlugin.js.map +1 -1
  126. package/lib/stores/PureLanguageSupport.d.ts.map +1 -1
  127. package/lib/stores/PureLanguageSupport.js +8 -2
  128. package/lib/stores/PureLanguageSupport.js.map +1 -1
  129. package/lib/stores/ValueSpecificationModifierHelper.d.ts +27 -0
  130. package/lib/stores/ValueSpecificationModifierHelper.d.ts.map +1 -0
  131. package/lib/stores/ValueSpecificationModifierHelper.js +49 -0
  132. package/lib/stores/ValueSpecificationModifierHelper.js.map +1 -0
  133. package/package.json +24 -18
  134. package/src/application/LegendApplication.tsx +6 -6
  135. package/src/application/LegendApplicationPluginManager.tsx +3 -3
  136. package/src/components/ActionAlert.tsx +2 -2
  137. package/src/components/ApplicationStoreProvider.tsx +4 -4
  138. package/src/components/ApplicationStoreProviderTestUtils.tsx +7 -6
  139. package/src/components/BasicValueSpecificationEditor.tsx +703 -0
  140. package/src/components/BlockingAlert.tsx +1 -1
  141. package/src/components/CustomDatePicker.tsx +1235 -0
  142. package/src/components/DocumentationLink.tsx +2 -2
  143. package/src/components/LambdaEditor.tsx +4 -4
  144. package/src/components/LambdaParameterValuesEditor.tsx +114 -0
  145. package/src/components/LegendApplicationComponentFrameworkProvider.tsx +3 -3
  146. package/src/components/LegendApplicationNavigationContextServiceUtils.tsx +63 -0
  147. package/src/components/NotificationManager.tsx +2 -2
  148. package/src/components/TextInputEditor.tsx +2 -2
  149. package/src/components/VirtualAssistant.tsx +600 -0
  150. package/src/components/WebApplicationNavigatorProvider.tsx +1 -1
  151. package/src/components/WebApplicationNavigatorProviderTestUtils.tsx +3 -2
  152. package/src/index.ts +39 -28
  153. package/src/stores/ApplicationEvent.ts +11 -7
  154. package/src/stores/ApplicationStore.ts +29 -27
  155. package/src/stores/ApplicationStoreTestUtils.ts +4 -4
  156. package/src/stores/ApplicationTelemetry.ts +2 -2
  157. package/src/stores/CJS__Fuse.cts +28 -0
  158. package/src/stores/LambdaParameterState.ts +314 -0
  159. package/src/stores/LegendApplicationAssistantService.ts +218 -0
  160. package/src/stores/LegendApplicationConfig.ts +20 -6
  161. package/src/stores/LegendApplicationDocumentationService.ts +276 -0
  162. package/src/stores/LegendApplicationEventService.ts +32 -0
  163. package/src/stores/LegendApplicationNavigationContextService.ts +131 -0
  164. package/src/stores/LegendApplicationPlugin.ts +10 -2
  165. package/src/stores/PureLanguageSupport.ts +8 -2
  166. package/src/stores/ValueSpecificationModifierHelper.ts +104 -0
  167. package/tsconfig.json +18 -12
  168. package/lib/components/AppHeader.d.ts.map +0 -1
  169. package/lib/components/AppHeader.js +0 -26
  170. package/lib/components/AppHeader.js.map +0 -1
  171. package/lib/stores/LegendApplicationDocumentationRegistry.d.ts +0 -36
  172. package/lib/stores/LegendApplicationDocumentationRegistry.d.ts.map +0 -1
  173. package/lib/stores/LegendApplicationDocumentationRegistry.js +0 -47
  174. package/lib/stores/LegendApplicationDocumentationRegistry.js.map +0 -1
  175. package/src/components/AppHeader.tsx +0 -49
  176. package/src/stores/LegendApplicationDocumentationRegistry.ts +0 -81
@@ -15,7 +15,7 @@
15
15
  */
16
16
 
17
17
  import { clsx, QuestionCircleIcon } from '@finos/legend-art';
18
- import { useApplicationStore } from './ApplicationStoreProvider';
18
+ import { useApplicationStore } from './ApplicationStoreProvider.js';
19
19
 
20
20
  export const DocumentationLink: React.FC<{
21
21
  documentationKey: string;
@@ -24,7 +24,7 @@ export const DocumentationLink: React.FC<{
24
24
  const { documentationKey, className } = props;
25
25
  const applicationStore = useApplicationStore();
26
26
  const documentationEntry =
27
- applicationStore.docRegistry.getEntry(documentationKey);
27
+ applicationStore.documentationService.getDocEntry(documentationKey);
28
28
  const openDocLink = (): void => {
29
29
  if (documentationEntry?.url) {
30
30
  applicationStore.navigator.openNewWindow(documentationEntry.url);
@@ -35,7 +35,7 @@ import {
35
35
  LongArrowAltUpIcon,
36
36
  Dialog,
37
37
  } from '@finos/legend-art';
38
- import type { LambdaEditorState } from '../stores/LambdaEditorState';
38
+ import type { LambdaEditorState } from '../stores/LambdaEditorState.js';
39
39
  import {
40
40
  debounce,
41
41
  noop,
@@ -44,9 +44,9 @@ import {
44
44
  } from '@finos/legend-shared';
45
45
  import { flowResult } from 'mobx';
46
46
  import { ParserError, type EngineError, type Type } from '@finos/legend-graph';
47
- import { APPLICATION_TEST_ID } from './ApplicationTestID';
48
- import { useApplicationStore } from './ApplicationStoreProvider';
49
- import { EDITOR_LANGUAGE, EDITOR_THEME, TAB_SIZE } from '../const';
47
+ import { APPLICATION_TEST_ID } from './ApplicationTestID.js';
48
+ import { useApplicationStore } from './ApplicationStoreProvider.js';
49
+ import { EDITOR_LANGUAGE, EDITOR_THEME, TAB_SIZE } from '../const.js';
50
50
 
51
51
  export type LambdaEditorOnKeyDownEventHandler = {
52
52
  matcher: (event: IKeyboardEvent) => boolean;
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { Dialog } from '@finos/legend-art';
18
+ import {
19
+ type PureModel,
20
+ type ValueSpecification,
21
+ PRIMITIVE_TYPE,
22
+ } from '@finos/legend-graph';
23
+ import { prettyCONSTName } from '@finos/legend-shared';
24
+ import { observer } from 'mobx-react-lite';
25
+ import type { LambdaParametersState } from '../stores/LambdaParameterState.js';
26
+ import { useApplicationStore } from './ApplicationStoreProvider.js';
27
+ import { BasicValueSpecificationEditor } from './BasicValueSpecificationEditor.js';
28
+
29
+ // TODO we may want to further componentize this by removing the dialog wrapper
30
+ export const LambdaParameterValuesEditor = observer(
31
+ (props: {
32
+ graph: PureModel;
33
+ lambdaParametersState: LambdaParametersState;
34
+ }) => {
35
+ const { lambdaParametersState, graph } = props;
36
+ const valuesEdtiorState = lambdaParametersState.parameterValuesEditorState;
37
+ const close = (): void => valuesEdtiorState.close();
38
+ const applicationStore = useApplicationStore();
39
+ const submitAction = valuesEdtiorState.submitAction;
40
+ const submit = applicationStore.guardUnhandledError(async () => {
41
+ if (submitAction) {
42
+ close();
43
+ await submitAction.handler();
44
+ }
45
+ });
46
+ return (
47
+ <Dialog
48
+ open={Boolean(valuesEdtiorState.showModal)}
49
+ onClose={close}
50
+ classes={{
51
+ root: 'editor-modal__root-container',
52
+ container: 'editor-modal__container',
53
+ paper: 'editor-modal__content',
54
+ }}
55
+ >
56
+ <div className="modal modal--dark editor-modal lambda__parameters__editor__modal">
57
+ <div className="modal__header">
58
+ <div className="modal__title">Set Parameter Values</div>
59
+ </div>
60
+ <div className="modal__body lambda__parameters__editor__modal__body">
61
+ {lambdaParametersState.parameterStates.map((paramState) => {
62
+ const stringType = graph.getPrimitiveType(PRIMITIVE_TYPE.STRING);
63
+ const variableType = paramState.variableType ?? stringType;
64
+ return (
65
+ <div
66
+ key={paramState.uuid}
67
+ className="panel__content__form__section"
68
+ >
69
+ <div className="lambda__parameters__editor__value__label">
70
+ <div>{paramState.parameter.name}</div>
71
+ <div className="lambda__parameters__editor__value__name">
72
+ {variableType.name}
73
+ </div>
74
+ </div>
75
+ {paramState.value && (
76
+ <BasicValueSpecificationEditor
77
+ valueSpecification={paramState.value}
78
+ updateValue={(val: ValueSpecification): void => {
79
+ paramState.setValue(val);
80
+ }}
81
+ graph={graph}
82
+ typeCheckOption={{
83
+ expectedType: variableType,
84
+ match:
85
+ variableType ===
86
+ graph.getPrimitiveType(PRIMITIVE_TYPE.DATETIME),
87
+ }}
88
+ className="query-builder__parameters__value__editor"
89
+ resetValue={(): void => paramState.mockParameterValue()}
90
+ />
91
+ )}
92
+ </div>
93
+ );
94
+ })}
95
+ </div>
96
+ <div className="modal__footer">
97
+ {submitAction && (
98
+ <button
99
+ className="btn modal__footer__close-btn"
100
+ title={submitAction.label}
101
+ onClick={submit}
102
+ >
103
+ {prettyCONSTName(submitAction.label)}
104
+ </button>
105
+ )}
106
+ <button className="btn modal__footer__close-btn" onClick={close}>
107
+ Close
108
+ </button>
109
+ </div>
110
+ </div>
111
+ </Dialog>
112
+ );
113
+ },
114
+ );
@@ -15,9 +15,9 @@
15
15
  */
16
16
 
17
17
  import { LegendStyleProvider } from '@finos/legend-art';
18
- import { ActionAlert } from './ActionAlert';
19
- import { BlockingAlert } from './BlockingAlert';
20
- import { NotificationManager } from './NotificationManager';
18
+ import { ActionAlert } from './ActionAlert.js';
19
+ import { BlockingAlert } from './BlockingAlert.js';
20
+ import { NotificationManager } from './NotificationManager.js';
21
21
 
22
22
  export const LegendApplicationComponentFrameworkProvider: React.FC<{
23
23
  children: React.ReactNode;
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { useEffect } from 'react';
18
+ import { ApplicationNavigationContextData } from '../stores/LegendApplicationNavigationContextService.js';
19
+ import { useApplicationStore } from './ApplicationStoreProvider.js';
20
+
21
+ /**
22
+ * Provides a convenient hook mechanism to handle application navigation
23
+ * context of a component.
24
+ *
25
+ * This will push the context when the component is mounted
26
+ * and will cleanup the context when the component is unmounted.
27
+ *
28
+ * NOTE: if we use this to automate context pushing and cleanup,
29
+ * we must use this for component that is mounted due to user-event
30
+ * navigation, e.g. clicking, focusing, etc. else if the component
31
+ * is already pre-rendered and just temporarily hidden away (e.g. dialog)
32
+ * it is not safe to call this as it might mess up the stack. For this,
33
+ * use {@link useConditionedApplicationNavigationContext }
34
+ */
35
+ export const useApplicationNavigationContext = (value: string): void => {
36
+ const applicationStore = useApplicationStore();
37
+
38
+ useEffect(() => {
39
+ const context = ApplicationNavigationContextData.create(value);
40
+ applicationStore.navigationContextService.push(context);
41
+ return () => applicationStore.navigationContextService.pop(context);
42
+ }, [applicationStore, value]);
43
+ };
44
+
45
+ export const useConditionedApplicationNavigationContext = (
46
+ value: string,
47
+ condition: boolean,
48
+ ): void => {
49
+ const applicationStore = useApplicationStore();
50
+
51
+ useEffect(() => {
52
+ const context = ApplicationNavigationContextData.create(value);
53
+ if (condition) {
54
+ applicationStore.navigationContextService.push(context);
55
+ } else {
56
+ applicationStore.navigationContextService.pop(context);
57
+ }
58
+ // NOTE: we are modifying a state in the clean up function, if we have
59
+ // some components observing the context stack, we could end up with `React` warning
60
+ // about bad state
61
+ return () => applicationStore.navigationContextService.pop(context);
62
+ }, [applicationStore, value, condition]);
63
+ };
@@ -18,8 +18,8 @@ import { observer } from 'mobx-react-lite';
18
18
  import {
19
19
  DEFAULT_NOTIFICATION_HIDE_TIME,
20
20
  NOTIFCATION_SEVERITY,
21
- } from '../stores/ApplicationStore';
22
- import { useApplicationStore } from './ApplicationStoreProvider';
21
+ } from '../stores/ApplicationStore.js';
22
+ import { useApplicationStore } from './ApplicationStoreProvider.js';
23
23
  import {
24
24
  Notification,
25
25
  NotificationContent,
@@ -29,8 +29,8 @@ import {
29
29
  getEditorValue,
30
30
  normalizeLineEnding,
31
31
  } from '@finos/legend-art';
32
- import { type EDITOR_LANGUAGE, EDITOR_THEME, TAB_SIZE } from '../const';
33
- import { useApplicationStore } from './ApplicationStoreProvider';
32
+ import { type EDITOR_LANGUAGE, EDITOR_THEME, TAB_SIZE } from '../const.js';
33
+ import { useApplicationStore } from './ApplicationStoreProvider.js';
34
34
 
35
35
  export type TextInputEditorOnKeyDownEventHandler = {
36
36
  matcher: (event: IKeyboardEvent) => boolean;