@finos/legend-application 7.0.2 → 7.1.0

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 (40) hide show
  1. package/lib/components/shared/BasicValueSpecificationEditor.d.ts +8 -0
  2. package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -1
  3. package/lib/components/shared/BasicValueSpecificationEditor.js +44 -6
  4. package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -1
  5. package/lib/components/shared/CustomDatePicker.d.ts.map +1 -1
  6. package/lib/components/shared/CustomDatePicker.js +2 -0
  7. package/lib/components/shared/CustomDatePicker.js.map +1 -1
  8. package/lib/components/shared/LambdaEditor.d.ts +1 -0
  9. package/lib/components/shared/LambdaEditor.d.ts.map +1 -1
  10. package/lib/components/shared/LambdaEditor.js +12 -5
  11. package/lib/components/shared/LambdaEditor.js.map +1 -1
  12. package/lib/components/shared/LambdaParameterValuesEditor.d.ts.map +1 -1
  13. package/lib/components/shared/LambdaParameterValuesEditor.js +2 -2
  14. package/lib/components/shared/LambdaParameterValuesEditor.js.map +1 -1
  15. package/lib/components/shared/PackageableElementOptionRenderer.d.ts +2 -2
  16. package/lib/components/shared/PackageableElementOptionRenderer.d.ts.map +1 -1
  17. package/lib/components/shared/PackageableElementOptionRenderer.js +36 -3
  18. package/lib/components/shared/PackageableElementOptionRenderer.js.map +1 -1
  19. package/lib/components/shared/TextInputEditor.d.ts.map +1 -1
  20. package/lib/components/shared/TextInputEditor.js +3 -1
  21. package/lib/components/shared/TextInputEditor.js.map +1 -1
  22. package/lib/const.d.ts +2 -1
  23. package/lib/const.d.ts.map +1 -1
  24. package/lib/const.js +1 -0
  25. package/lib/const.js.map +1 -1
  26. package/lib/index.css +2 -2
  27. package/lib/index.css.map +1 -1
  28. package/lib/stores/ApplicationStore.d.ts +7 -0
  29. package/lib/stores/ApplicationStore.d.ts.map +1 -1
  30. package/lib/stores/ApplicationStore.js +11 -0
  31. package/lib/stores/ApplicationStore.js.map +1 -1
  32. package/package.json +11 -11
  33. package/src/components/shared/BasicValueSpecificationEditor.tsx +105 -11
  34. package/src/components/shared/CustomDatePicker.tsx +2 -0
  35. package/src/components/shared/LambdaEditor.tsx +19 -2
  36. package/src/components/shared/LambdaParameterValuesEditor.tsx +7 -5
  37. package/src/components/shared/PackageableElementOptionRenderer.tsx +37 -3
  38. package/src/components/shared/TextInputEditor.tsx +3 -1
  39. package/src/const.ts +1 -0
  40. package/src/stores/ApplicationStore.ts +13 -0
@@ -100,6 +100,7 @@ const LambdaEditorInline = observer(
100
100
  backdropSetter?: ((val: boolean) => void) | undefined;
101
101
  onKeyDownEventHandlers: LambdaEditorOnKeyDownEventHandler[];
102
102
  openInPopUp: () => void;
103
+ onEditorFocusEventHandler?: (() => void) | undefined;
103
104
  }) => {
104
105
  const {
105
106
  className,
@@ -118,12 +119,16 @@ const LambdaEditorInline = observer(
118
119
  hideErrorBar,
119
120
  onKeyDownEventHandlers,
120
121
  openInPopUp,
122
+ onEditorFocusEventHandler,
121
123
  } = props;
122
124
  const applicationStore = useApplicationStore();
123
125
  const onDidChangeModelContentEventDisposer = useRef<
124
126
  IDisposable | undefined
125
127
  >(undefined);
126
128
  const onKeyDownEventDisposer = useRef<IDisposable | undefined>(undefined);
129
+ const onDidFocusEditorWidgetDisposer = useRef<IDisposable | undefined>(
130
+ undefined,
131
+ );
127
132
  const value = normalizeLineEnding(lambdaEditorState.lambdaString);
128
133
  const parserError = lambdaEditorState.parserError;
129
134
  const compilationError = lambdaEditorState.compilationError;
@@ -183,13 +188,15 @@ const LambdaEditorInline = observer(
183
188
  const _editor = monacoEditorAPI.create(element, {
184
189
  ...baseTextEditorSettings,
185
190
  language: EDITOR_LANGUAGE.PURE,
186
- theme: EDITOR_THEME.LEGEND,
191
+ theme: applicationStore.TEMPORARY__isLightThemeEnabled
192
+ ? EDITOR_THEME.TEMPORARY__VSCODE_LIGHT
193
+ : EDITOR_THEME.LEGEND,
187
194
  ...lambdaEditorOptions,
188
195
  });
189
196
  disableEditorHotKeys(_editor);
190
197
  setEditor(_editor);
191
198
  }
192
- }, [editor, useBaseTextEditorSettings]);
199
+ }, [editor, applicationStore, useBaseTextEditorSettings]);
193
200
 
194
201
  // set styling for expanded mode
195
202
  useEffect(() => {
@@ -305,6 +312,13 @@ const LambdaEditorInline = observer(
305
312
  });
306
313
  });
307
314
 
315
+ onDidFocusEditorWidgetDisposer.current?.dispose();
316
+ onDidFocusEditorWidgetDisposer.current = editor.onDidFocusEditorWidget(
317
+ () => {
318
+ onEditorFocusEventHandler?.();
319
+ },
320
+ );
321
+
308
322
  // Set the text value
309
323
  const currentValue = getEditorValue(editor);
310
324
  const editorModel = editor.getModel();
@@ -738,6 +752,7 @@ export const LambdaEditor = observer(
738
752
  * to allow activating global hotkeys while typing in the editor
739
753
  */
740
754
  onKeyDownEventHandlers?: LambdaEditorOnKeyDownEventHandler[];
755
+ onEditorFocusEventHandler?: (() => void) | undefined;
741
756
  }) => {
742
757
  const {
743
758
  className,
@@ -754,6 +769,7 @@ export const LambdaEditor = observer(
754
769
  useBaseTextEditorSettings,
755
770
  hideErrorBar,
756
771
  onKeyDownEventHandlers,
772
+ onEditorFocusEventHandler,
757
773
  } = props;
758
774
  const [showPopUp, setShowPopUp] = useState(false);
759
775
  const openInPopUp = (): void => setShowPopUp(true);
@@ -831,6 +847,7 @@ export const LambdaEditor = observer(
831
847
  hideErrorBar={hideErrorBar}
832
848
  onKeyDownEventHandlers={onKeyDownEventHandlers ?? []}
833
849
  openInPopUp={openInPopUp}
850
+ onEditorFocusEventHandler={onEditorFocusEventHandler}
834
851
  />
835
852
  );
836
853
  },
@@ -53,11 +53,11 @@ export const LambdaParameterValuesEditor = observer(
53
53
  paper: 'editor-modal__content',
54
54
  }}
55
55
  >
56
- <div className="modal modal--dark editor-modal lambda__parameters__editor__modal">
56
+ <div className="modal modal--dark editor-modal lambda-parameter-values__modal">
57
57
  <div className="modal__header">
58
58
  <div className="modal__title">Set Parameter Values</div>
59
59
  </div>
60
- <div className="modal__body lambda__parameters__editor__modal__body">
60
+ <div className="modal__body lambda-parameter-values__modal__body">
61
61
  {lambdaParametersState.parameterStates.map((paramState) => {
62
62
  const stringType = graph.getPrimitiveType(PRIMITIVE_TYPE.STRING);
63
63
  const variableType = paramState.variableType ?? stringType;
@@ -66,9 +66,11 @@ export const LambdaParameterValuesEditor = observer(
66
66
  key={paramState.uuid}
67
67
  className="panel__content__form__section"
68
68
  >
69
- <div className="lambda__parameters__editor__value__label">
70
- <div>{paramState.parameter.name}</div>
71
- <div className="lambda__parameters__editor__value__name">
69
+ <div className="lambda-parameter-values__value__label">
70
+ <div className="lambda-parameter-values__value__label__name">
71
+ {paramState.parameter.name}
72
+ </div>
73
+ <div className="lambda-parameter-values__value__label__type">
72
74
  {variableType.name}
73
75
  </div>
74
76
  </div>
@@ -14,10 +14,35 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import type { PackageableElement } from '@finos/legend-graph';
17
+ import {
18
+ type PackageableElement,
19
+ isSystemElement,
20
+ isGeneratedElement,
21
+ isDependencyElement,
22
+ } from '@finos/legend-graph';
18
23
  import type { PackageableElementOption } from '../../stores/shared/PackageableElementOption.js';
19
24
 
20
- export const getPackageableElementOptionalFormatter = (props?: {
25
+ const getElementColorCode = (element: PackageableElement): string =>
26
+ isSystemElement(element)
27
+ ? 'system'
28
+ : isGeneratedElement(element)
29
+ ? 'generated'
30
+ : isDependencyElement(element)
31
+ ? 'dependency'
32
+ : '';
33
+
34
+ const generateOptionTooltipText = (
35
+ element: PackageableElement,
36
+ ): string | undefined =>
37
+ isSystemElement(element)
38
+ ? 'system element'
39
+ : isGeneratedElement(element)
40
+ ? 'generated element'
41
+ : isDependencyElement(element)
42
+ ? 'dependency element'
43
+ : undefined;
44
+
45
+ export const getPackageableElementOptionFormatter = (props: {
21
46
  darkMode?: boolean;
22
47
  }): ((
23
48
  option: PackageableElementOption<PackageableElement>,
@@ -25,12 +50,21 @@ export const getPackageableElementOptionalFormatter = (props?: {
25
50
  function PackageableElementOptionLabel(
26
51
  option: PackageableElementOption<PackageableElement>,
27
52
  ): React.ReactNode {
28
- const className = props?.darkMode
53
+ const className = props.darkMode
29
54
  ? 'packageable-element-format-option-label--dark'
30
55
  : 'packageable-element-format-option-label';
56
+ const colorCode = getElementColorCode(option.value);
31
57
 
32
58
  return (
33
59
  <div className={className}>
60
+ <div
61
+ title={generateOptionTooltipText(option.value)}
62
+ className={`packageable-element-format-option-label-type ${
63
+ colorCode
64
+ ? `packageable-element-format-option-label-type--${colorCode}`
65
+ : ''
66
+ } `}
67
+ ></div>
34
68
  <div className={`${className}__name`}>{option.label}</div>
35
69
  {option.value.package && (
36
70
  <div className={`${className}__tag`}>{option.value.path}</div>
@@ -92,7 +92,9 @@ export const TextInputEditor: React.FC<{
92
92
  const element = textInputRef.current;
93
93
  const _editor = monacoEditorAPI.create(element, {
94
94
  ...baseTextEditorSettings,
95
- theme: EDITOR_THEME.LEGEND,
95
+ theme: applicationStore.TEMPORARY__isLightThemeEnabled
96
+ ? EDITOR_THEME.TEMPORARY__VSCODE_LIGHT
97
+ : EDITOR_THEME.LEGEND,
96
98
  formatOnType: true,
97
99
  formatOnPaste: true,
98
100
  });
package/src/const.ts CHANGED
@@ -20,6 +20,7 @@ export const MONOSPACED_FONT_FAMILY = 'Roboto Mono';
20
20
 
21
21
  export enum EDITOR_THEME {
22
22
  LEGEND = 'LEGEND',
23
+ TEMPORARY__VSCODE_LIGHT = 'vs',
23
24
  }
24
25
 
25
26
  export enum EDITOR_LANGUAGE {
@@ -136,6 +136,14 @@ export class ApplicationStore<
136
136
  telemetryService = new TelemetryService();
137
137
  tracerService = new TracerService();
138
138
 
139
+ // theme
140
+ /**
141
+ * NOTE: this is the poor man way of doing theming
142
+ * we would need to revise this flag later
143
+ * See https://github.com/finos/legend-studio/issues/264
144
+ */
145
+ TEMPORARY__isLightThemeEnabled = false;
146
+
139
147
  constructor(
140
148
  config: T,
141
149
  navigator: WebApplicationNavigator,
@@ -151,6 +159,7 @@ export class ApplicationStore<
151
159
  notifyWarning: action,
152
160
  notifyIllegalState: action,
153
161
  notifyError: action,
162
+ TEMPORARY__setIsLightThemeEnabled: action,
154
163
  });
155
164
 
156
165
  this.config = config;
@@ -173,6 +182,10 @@ export class ApplicationStore<
173
182
  );
174
183
  }
175
184
 
185
+ TEMPORARY__setIsLightThemeEnabled(val: boolean): void {
186
+ this.TEMPORARY__isLightThemeEnabled = val;
187
+ }
188
+
176
189
  setBlockingAlert(alertInfo: BlockingAlertInfo | undefined): void {
177
190
  this.blockingAlertInfo = alertInfo;
178
191
  }