@finos/legend-lego 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/application/DocumentationLink.d.ts +27 -0
- package/lib/application/DocumentationLink.d.ts.map +1 -0
- package/lib/application/DocumentationLink.js +45 -0
- package/lib/application/DocumentationLink.js.map +1 -0
- package/lib/application/FuzzySearchAdvancedConfigMenu.d.ts +23 -0
- package/lib/application/FuzzySearchAdvancedConfigMenu.d.ts.map +1 -0
- package/lib/application/FuzzySearchAdvancedConfigMenu.js +35 -0
- package/lib/application/FuzzySearchAdvancedConfigMenu.js.map +1 -0
- package/lib/application/TabManager.d.ts +24 -0
- package/lib/application/TabManager.d.ts.map +1 -0
- package/lib/application/TabManager.js +117 -0
- package/lib/application/TabManager.js.map +1 -0
- package/lib/application/TabManagerState.d.ts +40 -0
- package/lib/application/TabManagerState.d.ts.map +1 -0
- package/lib/application/TabManagerState.js +93 -0
- package/lib/application/TabManagerState.js.map +1 -0
- package/lib/application/index.d.ts +20 -0
- package/lib/application/index.d.ts.map +1 -0
- package/lib/application/index.js +20 -0
- package/lib/application/index.js.map +1 -0
- package/lib/code-editor/CodeDiffView.d.ts +35 -0
- package/lib/code-editor/CodeDiffView.d.ts.map +1 -0
- package/lib/code-editor/CodeDiffView.js +78 -0
- package/lib/code-editor/CodeDiffView.js.map +1 -0
- package/lib/code-editor/CodeEditor.d.ts +1 -1
- package/lib/code-editor/CodeEditor.d.ts.map +1 -1
- package/lib/code-editor/CodeEditor.js +5 -3
- package/lib/code-editor/CodeEditor.js.map +1 -1
- package/lib/code-editor/CodeEditorConfig.d.ts +31 -0
- package/lib/code-editor/CodeEditorConfig.d.ts.map +1 -0
- package/lib/code-editor/CodeEditorConfig.js +33 -0
- package/lib/code-editor/CodeEditorConfig.js.map +1 -0
- package/lib/code-editor/CodeEditorUtils.d.ts +2 -0
- package/lib/code-editor/CodeEditorUtils.d.ts.map +1 -1
- package/lib/code-editor/CodeEditorUtils.js +46 -1
- package/lib/code-editor/CodeEditorUtils.js.map +1 -1
- package/lib/code-editor/PureLanguageCodeEditorSupport.d.ts +70 -0
- package/lib/code-editor/PureLanguageCodeEditorSupport.d.ts.map +1 -0
- package/lib/code-editor/PureLanguageCodeEditorSupport.js +237 -0
- package/lib/code-editor/PureLanguageCodeEditorSupport.js.map +1 -0
- package/lib/code-editor/PureLanguageService.d.ts +42 -0
- package/lib/code-editor/PureLanguageService.d.ts.map +1 -0
- package/lib/code-editor/PureLanguageService.js +437 -0
- package/lib/code-editor/PureLanguageService.js.map +1 -0
- package/lib/code-editor/__test-utils__/MockedMonacoEditor.d.ts.map +1 -0
- package/lib/code-editor/__test-utils__/MockedMonacoEditor.js.map +1 -0
- package/lib/code-editor/__test-utils__/MonacoEditorMockUtils.d.ts.map +1 -0
- package/lib/code-editor/{testing → __test-utils__}/MonacoEditorMockUtils.js +1 -1
- package/lib/code-editor/__test-utils__/MonacoEditorMockUtils.js.map +1 -0
- package/lib/code-editor/__test__.d.ts +17 -0
- package/lib/code-editor/__test__.d.ts.map +1 -0
- package/lib/code-editor/{testing/index.js → __test__.js} +2 -2
- package/lib/code-editor/__test__.js.map +1 -0
- package/lib/code-editor/index.d.ts +4 -0
- package/lib/code-editor/index.d.ts.map +1 -1
- package/lib/code-editor/index.js +4 -0
- package/lib/code-editor/index.js.map +1 -1
- package/lib/graph-editor/ElementIconUtils.d.ts +18 -0
- package/lib/graph-editor/ElementIconUtils.d.ts.map +1 -0
- package/lib/graph-editor/ElementIconUtils.js +37 -0
- package/lib/graph-editor/ElementIconUtils.js.map +1 -0
- package/lib/graph-editor/PackageableElementOption.d.ts +25 -0
- package/lib/graph-editor/PackageableElementOption.d.ts.map +1 -0
- package/lib/graph-editor/PackageableElementOption.js +46 -0
- package/lib/graph-editor/PackageableElementOption.js.map +1 -0
- package/lib/graph-editor/index.d.ts +18 -0
- package/lib/graph-editor/index.d.ts.map +1 -0
- package/lib/graph-editor/index.js +18 -0
- package/lib/graph-editor/index.js.map +1 -0
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/package.json +14 -9
- package/src/application/DocumentationLink.tsx +82 -0
- package/src/application/FuzzySearchAdvancedConfigMenu.tsx +66 -0
- package/src/application/TabManager.tsx +285 -0
- package/src/application/TabManagerState.ts +124 -0
- package/src/application/index.ts +22 -0
- package/src/code-editor/CodeDiffView.tsx +128 -0
- package/src/code-editor/CodeEditor.tsx +8 -5
- package/src/code-editor/CodeEditorConfig.ts +32 -0
- package/src/code-editor/CodeEditorUtils.ts +76 -1
- package/src/code-editor/PureLanguageCodeEditorSupport.ts +338 -0
- package/src/code-editor/PureLanguageService.ts +501 -0
- package/src/code-editor/{testing → __test-utils__}/MonacoEditorMockUtils.tsx +1 -1
- package/src/code-editor/{testing/index.ts → __test__.ts} +1 -1
- package/src/code-editor/index.ts +8 -0
- package/src/graph-editor/ElementIconUtils.tsx +47 -0
- package/src/graph-editor/PackageableElementOption.tsx +86 -0
- package/{lib/code-editor/testing/index.d.ts → src/graph-editor/index.ts} +3 -2
- package/tsconfig.json +16 -4
- package/lib/code-editor/testing/MockedMonacoEditor.d.ts.map +0 -1
- package/lib/code-editor/testing/MockedMonacoEditor.js.map +0 -1
- package/lib/code-editor/testing/MonacoEditorMockUtils.d.ts.map +0 -1
- package/lib/code-editor/testing/MonacoEditorMockUtils.js.map +0 -1
- package/lib/code-editor/testing/index.d.ts.map +0 -1
- package/lib/code-editor/testing/index.js.map +0 -1
- /package/lib/code-editor/{testing → __test-utils__}/MockedMonacoEditor.d.ts +0 -0
- /package/lib/code-editor/{testing → __test-utils__}/MockedMonacoEditor.js +0 -0
- /package/lib/code-editor/{testing → __test-utils__}/MonacoEditorMockUtils.d.ts +0 -0
- /package/src/code-editor/{testing → __test-utils__}/MockedMonacoEditor.ts +0 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
/**
|
3
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
4
|
+
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License.
|
7
|
+
* You may obtain a copy of the License at
|
8
|
+
*
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
*
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
* See the License for the specific language governing permissions and
|
15
|
+
* limitations under the License.
|
16
|
+
*/
|
17
|
+
import { isSystemElement, isGeneratedElement, isDependencyElement, } from '@finos/legend-graph';
|
18
|
+
export const buildElementOption = (element) => ({
|
19
|
+
label: element.name,
|
20
|
+
value: element,
|
21
|
+
});
|
22
|
+
const getElementColorCode = (element) => isSystemElement(element)
|
23
|
+
? 'system'
|
24
|
+
: isGeneratedElement(element)
|
25
|
+
? 'generated'
|
26
|
+
: isDependencyElement(element)
|
27
|
+
? 'dependency'
|
28
|
+
: '';
|
29
|
+
const generateOptionTooltipText = (element) => isSystemElement(element)
|
30
|
+
? 'system element'
|
31
|
+
: isGeneratedElement(element)
|
32
|
+
? 'generated element'
|
33
|
+
: isDependencyElement(element)
|
34
|
+
? 'dependency element'
|
35
|
+
: undefined;
|
36
|
+
export const getPackageableElementOptionFormatter = (props) => function PackageableElementOptionLabel(option) {
|
37
|
+
const { darkMode } = props;
|
38
|
+
const className = darkMode
|
39
|
+
? 'packageable-element-option-label--dark'
|
40
|
+
: 'packageable-element-option-label';
|
41
|
+
const colorCode = getElementColorCode(option.value);
|
42
|
+
return (_jsxs("div", { className: className, children: [_jsx("div", { title: generateOptionTooltipText(option.value), className: `packageable-element-option-label__type ${colorCode
|
43
|
+
? `packageable-element-option-label__type--${colorCode}`
|
44
|
+
: ''} ` }), _jsx("div", { className: `${className}__name`, children: option.label }), option.value.package && (_jsx("div", { className: `${className}__tag`, children: option.value.path }))] }));
|
45
|
+
};
|
46
|
+
//# sourceMappingURL=PackageableElementOption.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"PackageableElementOption.js","sourceRoot":"","sources":["../../src/graph-editor/PackageableElementOption.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,eAAe,EACf,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAO7B,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,OAAU,EACmB,EAAE,CAAC,CAAC;IACjC,KAAK,EAAE,OAAO,CAAC,IAAI;IACnB,KAAK,EAAE,OAAO;CACf,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,CAAC,OAA2B,EAAU,EAAE,CAClE,eAAe,CAAC,OAAO,CAAC;IACtB,CAAC,CAAC,QAAQ;IACV,CAAC,CAAC,kBAAkB,CAAC,OAAO,CAAC;QAC7B,CAAC,CAAC,WAAW;QACb,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC;YAC9B,CAAC,CAAC,YAAY;YACd,CAAC,CAAC,EAAE,CAAC;AAET,MAAM,yBAAyB,GAAG,CAChC,OAA2B,EACP,EAAE,CACtB,eAAe,CAAC,OAAO,CAAC;IACtB,CAAC,CAAC,gBAAgB;IAClB,CAAC,CAAC,kBAAkB,CAAC,OAAO,CAAC;QAC7B,CAAC,CAAC,mBAAmB;QACrB,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC;YAC9B,CAAC,CAAC,oBAAoB;YACtB,CAAC,CAAC,SAAS,CAAC;AAEhB,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,KAEpD,EAEqB,EAAE,CACtB,SAAS,6BAA6B,CACpC,MAAoD;IAEpD,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC3B,MAAM,SAAS,GAAG,QAAQ;QACxB,CAAC,CAAC,wCAAwC;QAC1C,CAAC,CAAC,kCAAkC,CAAC;IACvC,MAAM,SAAS,GAAG,mBAAmB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEpD,OAAO,CACL,eAAK,SAAS,EAAE,SAAS,aACvB,cACE,KAAK,EAAE,yBAAyB,CAAC,MAAM,CAAC,KAAK,CAAC,EAC9C,SAAS,EAAE,0CACT,SAAS;oBACP,CAAC,CAAC,2CAA2C,SAAS,EAAE;oBACxD,CAAC,CAAC,EACN,GAAG,GACE,EACP,cAAK,SAAS,EAAE,GAAG,SAAS,QAAQ,YAAG,MAAM,CAAC,KAAK,GAAO,EACzD,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,CACvB,cAAK,SAAS,EAAE,GAAG,SAAS,OAAO,YAAG,MAAM,CAAC,KAAK,CAAC,IAAI,GAAO,CAC/D,IACG,CACP,CAAC;AACJ,CAAC,CAAC"}
|
@@ -0,0 +1,18 @@
|
|
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
|
+
export * from './PackageableElementOption.js';
|
17
|
+
export * from './ElementIconUtils.js';
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/graph-editor/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC"}
|
@@ -0,0 +1,18 @@
|
|
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
|
+
export * from './PackageableElementOption.js';
|
17
|
+
export * from './ElementIconUtils.js';
|
18
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/graph-editor/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC"}
|
package/lib/index.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/** @license @finos/legend-lego v0.1.
|
1
|
+
/** @license @finos/legend-lego v0.1.5
|
2
2
|
* Copyright (c) 2020-present, Goldman Sachs
|
3
3
|
*
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -14,4 +14,4 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
@import"@ag-grid-community/styles/ag-grid.css";@import"@ag-grid-community/styles/ag-theme-balham.css";.
|
17
|
+
@import"@ag-grid-community/styles/ag-grid.css";@import"@ag-grid-community/styles/ag-theme-balham.css";.fuzzy-search__advanced-config__panel{width:100%;background:var(--color-dark-grey-250)}.fuzzy-search__advanced-config__panel__header__label{display:flex;align-items:center;font-weight:500;color:var(--color-light-grey-50);background:var(--color-dark-grey-300);padding:0 1rem;line-height:2rem;font-size:1.2rem;cursor:default;user-select:none}.tab-manager{display:flex;flex:1;overflow:hidden;height:100%}.tab-manager__content{width:calc(100% - 2.8rem);display:flex;overflow-x:overlay}.tab-manager__tab{display:flex;align-items:center;cursor:pointer;color:var(--color-light-grey-400);background:var(--color-dark-grey-80);border-right:.1rem solid var(--color-dark-grey-50)}.tab-manager__tab--active{color:var(--color-light-grey-100);background:var(--color-dark-grey-50)}.tab-manager__tab--dragged{filter:opacity(0.7)}.tab-manager__tab__content{display:flex;align-items:center;height:100%;width:100%}.tab-manager__tab__label{height:100%;color:inherit;padding:0 .5rem 0 1rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tab-manager__tab__close-btn{visibility:hidden;display:flex;align-items:center}.tab-manager__tab__close-btn svg{color:var(--color-light-grey-200);font-size:1.2rem;margin-right:1rem}.tab-manager__tab--active .tab-manager__tab__close-btn,.tab-manager__tab:hover .tab-manager__tab__close-btn{visibility:visible}.tab-manager__tab--active .tab-manager__tab__close-btn svg,.tab-manager__tab:hover .tab-manager__tab__close-btn svg{color:var(--color-light-grey-100)}.tab-manager__tab__dnd__placeholder{text-align:left;margin:0;padding:0 .5rem;background-color:var(--color-dark-grey-100)}.tab-manager__menu{min-width:15rem;max-width:30rem;height:100%;padding:0}.tab-manager__menu__toggler{display:flex;align-items:center;justify-content:center;flex-grow:0;flex-shrink:0;color:var(--color-light-grey-400);border-left:.1rem solid var(--color-dark-grey-50);height:100%;width:2.8rem}.tab-manager__menu__item{justify-content:space-between}.tab-manager__menu__item--active,.tab-manager__menu__item:not([disabled]):hover{background:var(--color-dark-grey-250)}.tab-manager__menu__item__label{text-align:left;white-space:nowrap;font-size:1.3rem;overflow:hidden;text-overflow:ellipsis}.tab-manager__menu__item__close-btn{display:flex;align-items:center;justify-content:center;flex-grow:0;flex-shrink:0;padding:.4rem;margin-left:.6rem;flex-direction:end}.tab-manager__menu__item__close-btn svg{width:1.2rem;height:1.2rem}.documentation-link{display:inline-flex;align-self:center;color:var(--color-dark-grey-500);cursor:pointer}.documentation-preview{display:flex;background:var(--color-dark-grey-85);border:.1rem solid var(--color-dark-grey-280);border-radius:.2rem}.documentation-preview__text{padding:1rem;width:calc(100% - 3rem);color:var(--color-light-grey-400);line-height:2rem}.documentation-preview__hint{display:flex;justify-content:center;padding:1rem 0;width:3rem}.monaco-editor *{font-size:1.4rem}.monaco-editor--small-font *{font-size:1.2rem}.code-editor__container{height:100%;width:100%;position:relative;background:var(--color-dark-grey-50)}.code-editor__body{height:100%;width:100%;position:absolute;top:0;left:0;overflow:hidden}.packageable-element-option-label{display:flex;align-items:center}.packageable-element-option-label__tag{display:flex;align-items:center;color:var(--color-dark-grey-500);background:var(--color-light-grey-50);border:.1rem solid var(--color-light-grey-180);margin-left:1rem;border-radius:.2rem;font-size:1rem;padding:0 .5rem;height:1.6rem;font-weight:500}.packageable-element-option-label__name{display:flex;align-items:center;height:1.8rem}.packageable-element-option-label__type{margin:-1rem .8rem -1rem -1.2rem;height:3.2rem;padding-left:.5rem;background:rgba(0,0,0,0)}.packageable-element-option-label__type--system{background:var(--color-system)}.packageable-element-option-label__type--generated{background:var(--color-generated)}.packageable-element-option-label__type--dependency{background:var(--color-dependency)}.packageable-element-option-label--dark{display:flex;align-items:center;display:flex}.packageable-element-option-label--dark__tag{display:flex;align-items:center;color:var(--color-dark-grey-250);background:var(--color-dark-grey-400);margin-left:1rem;border-radius:.2rem;font-size:1rem;padding:0 .5rem;height:1.6rem;font-weight:500}.packageable-element-option-label--dark__name{display:flex;align-items:center;height:1.8rem}/*# sourceMappingURL=index.css.map */
|
package/lib/index.css.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../style/_data-grid.scss","../style/
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../style/_data-grid.scss","../style/application/_fuzzy-search.scss","../../../node_modules/@finos/legend-art/scss/_mixins.scss","../style/application/_tab-manager.scss","../style/application/_documentation-link.scss","../style/reset/_monaco-editor.scss","../style/_code-editor.scss","../style/graph-editor/_packageable-element-option-label.scss"],"names":[],"mappings":"AAgBQ,+CACA,uDCCR,sCACE,WACA,sCAEA,qDCQA,aACA,mBDNE,gBACA,iCACA,sCACA,eACA,iBACA,iBACA,eACA,iBEdJ,aACE,aACA,OACA,gBACA,YAEA,sBACE,0BACA,aACA,mBAGF,+BDCA,mBCEE,eACA,kCACA,qCACA,mDAEA,0BACE,kCACA,qCAGF,2BACE,oBAGF,2BDjBF,aACA,mBCmBI,YACA,WAGF,yBACE,YACA,cACA,uBACA,mBACA,gBACA,uBAGF,6BACE,kBDlCJ,aACA,mBCqCI,iCACE,kCACA,iBACA,kBAIJ,4GAEE,mBAEA,oHACE,kCAIJ,oCACE,gBACA,SACA,gBACA,4CAIJ,mBACE,gBACA,gBACA,YACA,UAEA,4BD1EF,aACA,mBACA,uBA2BA,YACA,cCgDI,kCACA,kDACA,YACA,aAGF,yBACE,8BAEA,gFAEE,sCAIJ,gCACE,gBACA,mBACA,iBACA,gBACA,uBAGF,oCDrGF,aACA,mBACA,uBA2BA,YACA,cC2EI,cACA,kBACA,mBAEA,wCACE,aACA,cCrHR,oBACE,oBACA,kBACA,iCACA,eAGF,uBACE,aACA,qCACA,8CACA,oBAEA,6BACE,aACA,wBACA,kCACA,iBAGF,6BFHA,aACA,uBEKE,eACA,WC1BJ,iBACE,iBAGF,6BACE,iBCJA,wBACE,YACA,WACA,kBACA,qCAGF,mBACE,YACA,WACA,kBACA,MACA,OACA,gBCZJ,kCLYE,aACA,mBKVA,uCLSA,aACA,mBKPE,iCACA,sCACA,+CACA,iBACA,oBACA,eACA,gBACA,cACA,gBAGF,wCLLA,aACA,mBKOE,cAIJ,wCACE,iCACA,cACA,mBACA,yBAEA,gDACE,+BAGF,mDACE,kCAGF,oDACE,mCAIJ,wCL/BE,aACA,mBKiCA,aAEA,6CLpCA,aACA,mBKsCE,iCACA,sCACA,iBACA,oBACA,eACA,gBACA,cACA,gBAGF,8CLjDA,aACA,mBKmDE","file":"index.css"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@finos/legend-lego",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.5",
|
4
4
|
"description": "Legend shared advanced application components and building blocks",
|
5
5
|
"keywords": [
|
6
6
|
"legend",
|
@@ -20,10 +20,12 @@
|
|
20
20
|
"sideEffects": false,
|
21
21
|
"type": "module",
|
22
22
|
"exports": {
|
23
|
-
"./
|
23
|
+
"./application": "./lib/application/index.js",
|
24
24
|
"./code-editor": "./lib/code-editor/index.js",
|
25
|
-
"./code-editor/test": "./lib/code-editor/
|
26
|
-
"./code-editor/test/MockedMonacoEditor.js": "./lib/code-editor/
|
25
|
+
"./code-editor/test": "./lib/code-editor/__test__.js",
|
26
|
+
"./code-editor/test/MockedMonacoEditor.js": "./lib/code-editor/__test-utils__/MockedMonacoEditor.js",
|
27
|
+
"./data-grid": "./lib/data-grid/index.js",
|
28
|
+
"./graph-editor": "./lib/graph-editor/index.js",
|
27
29
|
"./lib/index.css": "./lib/index.css"
|
28
30
|
},
|
29
31
|
"module": "lib/index.js",
|
@@ -49,19 +51,22 @@
|
|
49
51
|
"@ag-grid-community/core": "29.2.0",
|
50
52
|
"@ag-grid-community/react": "29.2.0",
|
51
53
|
"@ag-grid-community/styles": "29.2.0",
|
52
|
-
"@finos/legend-application": "
|
53
|
-
"@finos/legend-art": "7.0.
|
54
|
-
"@finos/legend-
|
55
|
-
"@
|
54
|
+
"@finos/legend-application": "15.0.0",
|
55
|
+
"@finos/legend-art": "7.0.1",
|
56
|
+
"@finos/legend-graph": "28.0.0",
|
57
|
+
"@finos/legend-shared": "9.0.0",
|
58
|
+
"@types/css-font-loading-module": "0.0.8",
|
59
|
+
"@types/react": "18.0.37",
|
56
60
|
"@types/react-dom": "18.0.11",
|
57
61
|
"mobx": "6.9.0",
|
58
62
|
"mobx-react-lite": "3.4.3",
|
59
63
|
"monaco-editor": "0.37.1",
|
60
64
|
"react": "18.2.0",
|
65
|
+
"react-dnd": "16.0.1",
|
61
66
|
"react-dom": "18.2.0"
|
62
67
|
},
|
63
68
|
"devDependencies": {
|
64
|
-
"@finos/legend-dev-utils": "2.0.
|
69
|
+
"@finos/legend-dev-utils": "2.0.54",
|
65
70
|
"@jest/globals": "29.5.0",
|
66
71
|
"cross-env": "7.0.3",
|
67
72
|
"eslint": "8.38.0",
|
@@ -0,0 +1,82 @@
|
|
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 {
|
18
|
+
shouldDisplayVirtualAssistantDocumentationEntry,
|
19
|
+
useApplicationStore,
|
20
|
+
} from '@finos/legend-application';
|
21
|
+
import { clsx, QuestionCircleIcon } from '@finos/legend-art';
|
22
|
+
|
23
|
+
export const DocumentationLink: React.FC<{
|
24
|
+
documentationKey: string;
|
25
|
+
title?: string | undefined;
|
26
|
+
className?: string | undefined;
|
27
|
+
}> = (props) => {
|
28
|
+
const { documentationKey, title, className } = props;
|
29
|
+
const applicationStore = useApplicationStore();
|
30
|
+
const documentationEntry =
|
31
|
+
applicationStore.documentationService.getDocEntry(documentationKey);
|
32
|
+
const openDocLink: React.MouseEventHandler<HTMLDivElement> = (
|
33
|
+
event,
|
34
|
+
): void => {
|
35
|
+
event.preventDefault();
|
36
|
+
event.stopPropagation();
|
37
|
+
applicationStore.assistantService.openDocumentationEntryLink(
|
38
|
+
documentationKey,
|
39
|
+
);
|
40
|
+
};
|
41
|
+
|
42
|
+
if (
|
43
|
+
!documentationEntry ||
|
44
|
+
(!documentationEntry.url &&
|
45
|
+
!shouldDisplayVirtualAssistantDocumentationEntry(documentationEntry))
|
46
|
+
) {
|
47
|
+
return null;
|
48
|
+
}
|
49
|
+
return (
|
50
|
+
<div
|
51
|
+
onClick={openDocLink}
|
52
|
+
title={title ?? 'Click to see documentation'}
|
53
|
+
className={clsx('documentation-link', className)}
|
54
|
+
>
|
55
|
+
<QuestionCircleIcon />
|
56
|
+
</div>
|
57
|
+
);
|
58
|
+
};
|
59
|
+
|
60
|
+
export const DocumentationPreview: React.FC<{
|
61
|
+
text?: string | undefined;
|
62
|
+
documentationKey: string;
|
63
|
+
className?: string | undefined;
|
64
|
+
}> = (props) => {
|
65
|
+
const { documentationKey, text, className } = props;
|
66
|
+
const applicationStore = useApplicationStore();
|
67
|
+
const documentationEntry =
|
68
|
+
applicationStore.documentationService.getDocEntry(documentationKey);
|
69
|
+
const textContent = text ?? documentationEntry?.text;
|
70
|
+
|
71
|
+
if (!documentationEntry || !textContent) {
|
72
|
+
return null;
|
73
|
+
}
|
74
|
+
return (
|
75
|
+
<div className={clsx('documentation-preview', className)}>
|
76
|
+
<div className="documentation-preview__text">{textContent}</div>
|
77
|
+
<div className="documentation-preview__hint">
|
78
|
+
<DocumentationLink documentationKey={documentationKey} />
|
79
|
+
</div>
|
80
|
+
</div>
|
81
|
+
);
|
82
|
+
};
|
@@ -0,0 +1,66 @@
|
|
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 { BaseRadioGroup } from '@finos/legend-art';
|
18
|
+
import { observer } from 'mobx-react-lite';
|
19
|
+
import { DocumentationLink } from './DocumentationLink.js';
|
20
|
+
import {
|
21
|
+
ADVANCED_FUZZY_SEARCH_MODE,
|
22
|
+
type FuzzySearchAdvancedConfigState,
|
23
|
+
} from '@finos/legend-shared';
|
24
|
+
import { LEGEND_APPLICATION_DOCUMENTATION_KEY } from '@finos/legend-application';
|
25
|
+
|
26
|
+
export const FuzzySearchAdvancedConfigMenu = observer(
|
27
|
+
(props: { configState: FuzzySearchAdvancedConfigState }) => {
|
28
|
+
const { configState } = props;
|
29
|
+
|
30
|
+
const handleSearchMode: React.ChangeEventHandler<HTMLInputElement> = (
|
31
|
+
event,
|
32
|
+
): void => {
|
33
|
+
const searchMode = event.target.value as ADVANCED_FUZZY_SEARCH_MODE;
|
34
|
+
configState.setCurrentMode(searchMode);
|
35
|
+
};
|
36
|
+
|
37
|
+
return (
|
38
|
+
<div className="fuzzy-search__advanced-config__panel">
|
39
|
+
<div className="fuzzy-search__advanced-config__panel__header__label">
|
40
|
+
search config
|
41
|
+
<DocumentationLink
|
42
|
+
className="fuzzy-search__advanced-config__panel__header__hint"
|
43
|
+
documentationKey={
|
44
|
+
LEGEND_APPLICATION_DOCUMENTATION_KEY.QUESTION_HOW_TO_USE_ADVANCED_SEARCH_SYNTAX
|
45
|
+
}
|
46
|
+
/>
|
47
|
+
</div>
|
48
|
+
<div>
|
49
|
+
<BaseRadioGroup
|
50
|
+
className="text-search-advanced-config__options"
|
51
|
+
value={configState.currentMode}
|
52
|
+
onChange={handleSearchMode}
|
53
|
+
row={false}
|
54
|
+
options={[
|
55
|
+
ADVANCED_FUZZY_SEARCH_MODE.STANDARD,
|
56
|
+
ADVANCED_FUZZY_SEARCH_MODE.INCLUDE,
|
57
|
+
ADVANCED_FUZZY_SEARCH_MODE.EXACT,
|
58
|
+
ADVANCED_FUZZY_SEARCH_MODE.INVERSE,
|
59
|
+
]}
|
60
|
+
size={1}
|
61
|
+
/>
|
62
|
+
</div>
|
63
|
+
</div>
|
64
|
+
);
|
65
|
+
},
|
66
|
+
);
|
@@ -0,0 +1,285 @@
|
|
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 {
|
18
|
+
ChevronDownIcon,
|
19
|
+
clsx,
|
20
|
+
ContextMenu,
|
21
|
+
DragPreviewLayer,
|
22
|
+
DropdownMenu,
|
23
|
+
MenuContent,
|
24
|
+
MenuContentItem,
|
25
|
+
PanelEntryDropZonePlaceholder,
|
26
|
+
TimesIcon,
|
27
|
+
useDragPreviewLayer,
|
28
|
+
} from '@finos/legend-art';
|
29
|
+
import { observer } from 'mobx-react-lite';
|
30
|
+
import { useRef, useCallback } from 'react';
|
31
|
+
import { type DropTargetMonitor, useDrop, useDrag } from 'react-dnd';
|
32
|
+
import type { TabManagerState, TabState } from './TabManagerState.js';
|
33
|
+
|
34
|
+
type TabDragSource = {
|
35
|
+
tab: TabState;
|
36
|
+
};
|
37
|
+
|
38
|
+
const horizontalToVerticalScroll: React.WheelEventHandler = (event) => {
|
39
|
+
// if scrolling is more horizontal than vertical, there's nothing much to do, the OS should handle it just fine
|
40
|
+
// else, intercept
|
41
|
+
if (Math.abs(event.deltaY) <= Math.abs(event.deltaX)) {
|
42
|
+
return;
|
43
|
+
}
|
44
|
+
event.stopPropagation();
|
45
|
+
let deltaX;
|
46
|
+
// NOTE: only convert horizontal to vertical scroll when the scroll causes more horizontal than vertical displacement
|
47
|
+
// let the direction of `deltaY` be the direction of the scroll, i.e.
|
48
|
+
// - if we scroll upward, that translate to a left scroll
|
49
|
+
// - if we scroll downward, that translates to a right scroll
|
50
|
+
if (event.deltaY === 0) {
|
51
|
+
deltaX = event.deltaY;
|
52
|
+
} else if (event.deltaY < 0) {
|
53
|
+
deltaX = -Math.abs(event.deltaY);
|
54
|
+
} else {
|
55
|
+
deltaX = Math.abs(event.deltaY);
|
56
|
+
}
|
57
|
+
event.currentTarget.scrollBy(deltaX, 0);
|
58
|
+
};
|
59
|
+
|
60
|
+
const TabContextMenu = observer(
|
61
|
+
(props: { tabState: TabState; managerTabState: TabManagerState }) => {
|
62
|
+
const { tabState, managerTabState } = props;
|
63
|
+
const close = (): void => managerTabState.closeTab(tabState);
|
64
|
+
const closeOthers = (): void => managerTabState.closeAllOtherTabs(tabState);
|
65
|
+
const closeAll = (): void => managerTabState.closeAllTabs();
|
66
|
+
|
67
|
+
return (
|
68
|
+
<MenuContent>
|
69
|
+
<MenuContentItem onClick={close}>Close</MenuContentItem>
|
70
|
+
<MenuContentItem
|
71
|
+
disabled={managerTabState.tabs.length < 2}
|
72
|
+
onClick={closeOthers}
|
73
|
+
>
|
74
|
+
Close Others
|
75
|
+
</MenuContentItem>
|
76
|
+
<MenuContentItem onClick={closeAll}>Close All</MenuContentItem>
|
77
|
+
</MenuContent>
|
78
|
+
);
|
79
|
+
},
|
80
|
+
);
|
81
|
+
|
82
|
+
const Tab = observer(
|
83
|
+
(props: {
|
84
|
+
tabState: TabState;
|
85
|
+
tabManagerState: TabManagerState;
|
86
|
+
tabRenderer?: ((editorState: TabState) => React.ReactNode) | undefined;
|
87
|
+
}) => {
|
88
|
+
const ref = useRef<HTMLDivElement>(null);
|
89
|
+
const { tabManagerState, tabState, tabRenderer } = props;
|
90
|
+
|
91
|
+
// Drag and Drop
|
92
|
+
const handleHover = useCallback(
|
93
|
+
(item: TabDragSource, monitor: DropTargetMonitor): void => {
|
94
|
+
const draggingTab = item.tab;
|
95
|
+
const hoveredTab = tabState;
|
96
|
+
|
97
|
+
const dragIndex = tabManagerState.tabs.findIndex(
|
98
|
+
(e) => e === draggingTab,
|
99
|
+
);
|
100
|
+
const hoverIndex = tabManagerState.tabs.findIndex(
|
101
|
+
(e) => e === hoveredTab,
|
102
|
+
);
|
103
|
+
|
104
|
+
const hoverBoundingReact = ref.current?.getBoundingClientRect();
|
105
|
+
const distanceThreshold =
|
106
|
+
((hoverBoundingReact?.left ?? 0) - (hoverBoundingReact?.right ?? 0)) /
|
107
|
+
2;
|
108
|
+
const dragDistance =
|
109
|
+
(monitor.getClientOffset()?.x ?? 0) -
|
110
|
+
(hoverBoundingReact?.right ?? 0);
|
111
|
+
if (dragIndex < hoverIndex && dragDistance < distanceThreshold) {
|
112
|
+
return;
|
113
|
+
}
|
114
|
+
if (dragIndex > hoverIndex && dragDistance > distanceThreshold) {
|
115
|
+
return;
|
116
|
+
}
|
117
|
+
|
118
|
+
tabManagerState.swapTabs(draggingTab, hoveredTab);
|
119
|
+
},
|
120
|
+
[tabManagerState, tabState],
|
121
|
+
);
|
122
|
+
|
123
|
+
const closeTabOnMiddleClick =
|
124
|
+
(currTab: TabState): React.MouseEventHandler =>
|
125
|
+
(event): void => {
|
126
|
+
if (event.nativeEvent.button === 1) {
|
127
|
+
tabManagerState.closeTab(currTab);
|
128
|
+
}
|
129
|
+
};
|
130
|
+
|
131
|
+
const [{ isBeingDraggedEditorPanel }, dropConnector] = useDrop<
|
132
|
+
TabDragSource,
|
133
|
+
void,
|
134
|
+
{ isBeingDraggedEditorPanel: TabState | undefined }
|
135
|
+
>(
|
136
|
+
() => ({
|
137
|
+
accept: [tabManagerState.dndType],
|
138
|
+
hover: (item, monitor) => handleHover(item, monitor),
|
139
|
+
collect: (
|
140
|
+
monitor,
|
141
|
+
): {
|
142
|
+
isBeingDraggedEditorPanel: TabState | undefined;
|
143
|
+
} => ({
|
144
|
+
isBeingDraggedEditorPanel: monitor.getItem<TabDragSource | null>()
|
145
|
+
?.tab,
|
146
|
+
}),
|
147
|
+
}),
|
148
|
+
[handleHover],
|
149
|
+
);
|
150
|
+
const isBeingDragged = tabState === isBeingDraggedEditorPanel;
|
151
|
+
|
152
|
+
const [, dragConnector, dragPreviewConnector] = useDrag<TabDragSource>(
|
153
|
+
() => ({
|
154
|
+
type: tabManagerState.dndType,
|
155
|
+
item: () => ({
|
156
|
+
tab: tabState,
|
157
|
+
}),
|
158
|
+
}),
|
159
|
+
[tabState, tabManagerState],
|
160
|
+
);
|
161
|
+
dragConnector(dropConnector(ref));
|
162
|
+
useDragPreviewLayer(dragPreviewConnector);
|
163
|
+
|
164
|
+
return (
|
165
|
+
<div
|
166
|
+
ref={ref}
|
167
|
+
className={clsx('tab-manager__tab', {
|
168
|
+
'tab-manager__tab--active': tabState === tabManagerState.currentTab,
|
169
|
+
'tab-manager__tab--dragged': isBeingDragged,
|
170
|
+
})}
|
171
|
+
onMouseUp={closeTabOnMiddleClick(tabState)}
|
172
|
+
>
|
173
|
+
<PanelEntryDropZonePlaceholder
|
174
|
+
showPlaceholder={false}
|
175
|
+
className="tab-manager__tab__dnd__placeholder"
|
176
|
+
>
|
177
|
+
<ContextMenu
|
178
|
+
content={
|
179
|
+
<TabContextMenu
|
180
|
+
tabState={tabState}
|
181
|
+
managerTabState={tabManagerState}
|
182
|
+
/>
|
183
|
+
}
|
184
|
+
className="tab-manager__tab__content"
|
185
|
+
>
|
186
|
+
<button
|
187
|
+
className="tab-manager__tab__label"
|
188
|
+
tabIndex={-1}
|
189
|
+
onClick={() => tabManagerState.openTab(tabState)}
|
190
|
+
title={tabState.description}
|
191
|
+
>
|
192
|
+
{tabRenderer?.(tabState) ?? tabState.label}
|
193
|
+
</button>
|
194
|
+
<button
|
195
|
+
className="tab-manager__tab__close-btn"
|
196
|
+
onClick={() => tabManagerState.closeTab(tabState)}
|
197
|
+
tabIndex={-1}
|
198
|
+
title="Close"
|
199
|
+
>
|
200
|
+
<TimesIcon />
|
201
|
+
</button>
|
202
|
+
</ContextMenu>
|
203
|
+
</PanelEntryDropZonePlaceholder>
|
204
|
+
</div>
|
205
|
+
);
|
206
|
+
},
|
207
|
+
);
|
208
|
+
|
209
|
+
const TabMenu = observer((props: { managerTabState: TabManagerState }) => {
|
210
|
+
const { managerTabState } = props;
|
211
|
+
return (
|
212
|
+
<DropdownMenu
|
213
|
+
className="tab-manager__menu__toggler"
|
214
|
+
title="Show All Tabs"
|
215
|
+
content={
|
216
|
+
<MenuContent className="tab-manager__menu">
|
217
|
+
{managerTabState.tabs.map((tabState) => (
|
218
|
+
<MenuContentItem
|
219
|
+
key={tabState.uuid}
|
220
|
+
className={clsx('tab-manager__menu__item', {
|
221
|
+
'tab-manager__menu__item--active':
|
222
|
+
tabState === managerTabState.currentTab,
|
223
|
+
})}
|
224
|
+
onClick={() => managerTabState.openTab(tabState)}
|
225
|
+
>
|
226
|
+
<div className="tab-manager__menu__item__label">
|
227
|
+
{tabState.label}
|
228
|
+
</div>
|
229
|
+
<div
|
230
|
+
className="tab-manager__menu__item__close-btn"
|
231
|
+
onClick={(event) => {
|
232
|
+
// NOTE: prevent default action of dropdown menu
|
233
|
+
event.stopPropagation();
|
234
|
+
managerTabState.closeTab(tabState);
|
235
|
+
}}
|
236
|
+
tabIndex={-1}
|
237
|
+
title="Close"
|
238
|
+
>
|
239
|
+
<TimesIcon />
|
240
|
+
</div>
|
241
|
+
</MenuContentItem>
|
242
|
+
))}
|
243
|
+
</MenuContent>
|
244
|
+
}
|
245
|
+
menuProps={{
|
246
|
+
anchorOrigin: { vertical: 'bottom', horizontal: 'right' },
|
247
|
+
transformOrigin: { vertical: 'top', horizontal: 'right' },
|
248
|
+
}}
|
249
|
+
>
|
250
|
+
<ChevronDownIcon />
|
251
|
+
</DropdownMenu>
|
252
|
+
);
|
253
|
+
});
|
254
|
+
|
255
|
+
export const TabManager = observer(
|
256
|
+
(props: {
|
257
|
+
tabManagerState: TabManagerState;
|
258
|
+
tabRenderer?: ((editorState: TabState) => React.ReactNode) | undefined;
|
259
|
+
}) => {
|
260
|
+
const { tabManagerState, tabRenderer } = props;
|
261
|
+
|
262
|
+
return (
|
263
|
+
<div className="tab-manager">
|
264
|
+
<div
|
265
|
+
className="tab-manager__content"
|
266
|
+
onWheel={horizontalToVerticalScroll}
|
267
|
+
>
|
268
|
+
{tabManagerState.tabs.map((tab) => (
|
269
|
+
<Tab
|
270
|
+
key={tab.uuid}
|
271
|
+
tabState={tab}
|
272
|
+
tabManagerState={tabManagerState}
|
273
|
+
tabRenderer={tabRenderer}
|
274
|
+
/>
|
275
|
+
))}
|
276
|
+
<DragPreviewLayer
|
277
|
+
labelGetter={(item: TabDragSource): string => item.tab.label}
|
278
|
+
types={[tabManagerState.dndType]}
|
279
|
+
/>
|
280
|
+
</div>
|
281
|
+
<TabMenu managerTabState={tabManagerState} />
|
282
|
+
</div>
|
283
|
+
);
|
284
|
+
},
|
285
|
+
);
|