@finos/legend-lego 1.2.62 → 1.2.63
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/application/TabManager.d.ts.map +1 -1
- package/lib/application/TabManager.js +11 -3
- package/lib/application/TabManager.js.map +1 -1
- package/lib/application/TabManagerState.d.ts +5 -0
- package/lib/application/TabManagerState.d.ts.map +1 -1
- package/lib/application/TabManagerState.js +44 -5
- package/lib/application/TabManagerState.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/package.json +5 -5
- package/src/application/TabManager.tsx +33 -8
- package/src/application/TabManagerState.ts +53 -5
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TabManager.d.ts","sourceRoot":"","sources":["../../src/application/TabManager.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
1
|
+
{"version":3,"file":"TabManager.d.ts","sourceRoot":"","sources":["../../src/application/TabManager.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAmBH,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAMtE,eAAO,MAAM,wBAAwB,qBAAqB,CAAC;AAmP3D,eAAO,MAAM,UAAU,WACb;IACN,eAAe,EAAE,eAAe,CAAC;IACjC,WAAW,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,QAAQ,KAAK,KAAK,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;CACxE;;CA0BF,CAAC"}
|
@@ -14,7 +14,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
* See the License for the specific language governing permissions and
|
15
15
|
* limitations under the License.
|
16
16
|
*/
|
17
|
-
import { ChevronDownIcon, clsx, ContextMenu, DragPreviewLayer, ControlledDropdownMenu, MenuContent, MenuContentItem, PanelEntryDropZonePlaceholder, TimesIcon, useDragPreviewLayer, } from '@finos/legend-art';
|
17
|
+
import { ChevronDownIcon, clsx, ContextMenu, DragPreviewLayer, ControlledDropdownMenu, MenuContent, MenuContentItem, PanelEntryDropZonePlaceholder, TimesIcon, useDragPreviewLayer, MenuContentDivider, PushPinIcon, } from '@finos/legend-art';
|
18
18
|
import { observer } from 'mobx-react-lite';
|
19
19
|
import { useRef, useCallback } from 'react';
|
20
20
|
import { useDrop, useDrag } from 'react-dnd';
|
@@ -47,7 +47,15 @@ const TabContextMenu = observer((props) => {
|
|
47
47
|
const close = () => managerTabState.closeTab(tabState);
|
48
48
|
const closeOthers = () => managerTabState.closeAllOtherTabs(tabState);
|
49
49
|
const closeAll = () => managerTabState.closeAllTabs();
|
50
|
-
|
50
|
+
const togglePin = () => {
|
51
|
+
if (tabState.isPinned) {
|
52
|
+
managerTabState.unpinTab(tabState);
|
53
|
+
}
|
54
|
+
else {
|
55
|
+
managerTabState.pinTab(tabState);
|
56
|
+
}
|
57
|
+
};
|
58
|
+
return (_jsxs(MenuContent, { children: [_jsx(MenuContentItem, { onClick: close, children: "Close" }), _jsx(MenuContentItem, { disabled: managerTabState.tabs.length < 2, onClick: closeOthers, children: "Close Others" }), _jsx(MenuContentItem, { onClick: closeAll, children: "Close All" }), _jsx(MenuContentDivider, {}), _jsx(MenuContentItem, { onClick: togglePin, children: tabState.isPinned ? 'Unpin' : 'Pin' })] }));
|
51
59
|
});
|
52
60
|
const Tab = observer((props) => {
|
53
61
|
const ref = useRef(null);
|
@@ -96,7 +104,7 @@ const Tab = observer((props) => {
|
|
96
104
|
return (_jsx("div", { ref: ref, "data-testid": TAB_MANAGER__TAB_TEST_ID, className: clsx('tab-manager__tab', {
|
97
105
|
'tab-manager__tab--active': tabState === tabManagerState.currentTab,
|
98
106
|
'tab-manager__tab--dragged': isBeingDragged,
|
99
|
-
}), onMouseUp: closeTabOnMiddleClick(tabState), children: _jsx(PanelEntryDropZonePlaceholder, { isDragOver: false, className: "tab-manager__tab__dnd__placeholder", children: _jsxs(ContextMenu, { content: _jsx(TabContextMenu, { tabState: tabState, managerTabState: tabManagerState }), className: "tab-manager__tab__content", children: [_jsx("button", { className: "tab-manager__tab__label", tabIndex: -1, onClick: () => tabManagerState.openTab(tabState), title: tabState.description, children: tabRenderer?.(tabState) ?? tabState.label }), _jsx("button", { className: "tab-manager__tab__close-btn", onClick: () => tabManagerState.closeTab(tabState), tabIndex: -1, title: "Close", children: _jsx(TimesIcon, {}) })] }) }) }));
|
107
|
+
}), onMouseUp: closeTabOnMiddleClick(tabState), children: _jsx(PanelEntryDropZonePlaceholder, { isDragOver: false, className: "tab-manager__tab__dnd__placeholder", children: _jsxs(ContextMenu, { content: _jsx(TabContextMenu, { tabState: tabState, managerTabState: tabManagerState }), className: "tab-manager__tab__content", children: [_jsx("button", { className: "tab-manager__tab__label", tabIndex: -1, onClick: () => tabManagerState.openTab(tabState), title: tabState.description, children: tabRenderer?.(tabState) ?? tabState.label }), tabState.isPinned && (_jsx("button", { className: "tab-manager__tab__pin-btn", onClick: () => tabManagerState.unpinTab(tabState), tabIndex: -1, title: "Unpin", children: _jsx(PushPinIcon, {}) })), !tabState.isPinned && (_jsx("button", { className: "tab-manager__tab__close-btn", onClick: () => tabManagerState.closeTab(tabState), tabIndex: -1, title: "Close", children: _jsx(TimesIcon, {}) }))] }) }) }));
|
100
108
|
});
|
101
109
|
const TabMenu = observer((props) => {
|
102
110
|
const { managerTabState } = props;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TabManager.js","sourceRoot":"","sources":["../../src/application/TabManager.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,eAAe,EACf,IAAI,EACJ,WAAW,EACX,gBAAgB,EAChB,sBAAsB,EACtB,WAAW,EACX,eAAe,EACf,6BAA6B,EAC7B,SAAS,EACT,mBAAmB,
|
1
|
+
{"version":3,"file":"TabManager.js","sourceRoot":"","sources":["../../src/application/TabManager.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,eAAe,EACf,IAAI,EACJ,WAAW,EACX,gBAAgB,EAChB,sBAAs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KAAK,EAC5D,KAAK,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,GAChC,IACE,EACN,KAAC,OAAO,IAAC,eAAe,EAAE,eAAe,GAAI,IACzC,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
|
@@ -15,8 +15,11 @@
|
|
15
15
|
*/
|
16
16
|
export declare abstract class TabState {
|
17
17
|
readonly uuid: string;
|
18
|
+
isPinned: boolean;
|
19
|
+
constructor();
|
18
20
|
abstract get label(): string;
|
19
21
|
get description(): string | undefined;
|
22
|
+
setPinned(val: boolean): void;
|
20
23
|
match(tab: TabState): boolean;
|
21
24
|
onOpen(): void;
|
22
25
|
onClose(): void;
|
@@ -36,5 +39,7 @@ export declare abstract class TabManagerState {
|
|
36
39
|
abstract get dndType(): string;
|
37
40
|
openTab(tab: TabState): void;
|
38
41
|
closeTab(tab: TabState): void;
|
42
|
+
pinTab(tab: TabState): void;
|
43
|
+
unpinTab(tab: TabState): void;
|
39
44
|
}
|
40
45
|
//# sourceMappingURL=TabManagerState.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TabManagerState.d.ts","sourceRoot":"","sources":["../../src/application/TabManagerState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,8BAAsB,QAAQ;IAC5B,QAAQ,CAAC,IAAI,SAAU;
|
1
|
+
{"version":3,"file":"TabManagerState.d.ts","sourceRoot":"","sources":["../../src/application/TabManagerState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,8BAAsB,QAAQ;IAC5B,QAAQ,CAAC,IAAI,SAAU;IACvB,QAAQ,UAAS;;IASjB,QAAQ,KAAK,KAAK,IAAI,MAAM,CAAC;IAE7B,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAI7B,KAAK,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO;IAI7B,MAAM,IAAI,IAAI;IAId,OAAO,IAAI,IAAI;CAGhB;AAED,8BAAsB,eAAe;IACnC,UAAU,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAClC,IAAI,EAAE,QAAQ,EAAE,CAAM;;IAkBtB,aAAa,CAAC,GAAG,EAAE,QAAQ,GAAG,SAAS,GAAG,IAAI;IAI9C,iBAAiB,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI;IAStC,YAAY,IAAI,IAAI;IAOpB,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI;IAQ9C;;;OAGG;IACH,QAAQ,KAAK,OAAO,IAAI,MAAM,CAAC;IAE/B,OAAO,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI;IAmB5B,QAAQ,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI;IAqB7B,MAAM,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI;IAU3B,QAAQ,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI;CAS9B"}
|
@@ -17,9 +17,19 @@ import { assertNonNullable, assertTrue, swapEntry, uuid, } from '@finos/legend-s
|
|
17
17
|
import { action, makeObservable, observable } from 'mobx';
|
18
18
|
export class TabState {
|
19
19
|
uuid = uuid();
|
20
|
+
isPinned = false;
|
21
|
+
constructor() {
|
22
|
+
makeObservable(this, {
|
23
|
+
isPinned: observable,
|
24
|
+
setPinned: action,
|
25
|
+
});
|
26
|
+
}
|
20
27
|
get description() {
|
21
28
|
return undefined;
|
22
29
|
}
|
30
|
+
setPinned(val) {
|
31
|
+
this.isPinned = val;
|
32
|
+
}
|
23
33
|
match(tab) {
|
24
34
|
return this === tab;
|
25
35
|
}
|
@@ -36,13 +46,15 @@ export class TabManagerState {
|
|
36
46
|
constructor() {
|
37
47
|
makeObservable(this, {
|
38
48
|
currentTab: observable,
|
39
|
-
tabs: observable,
|
40
49
|
setCurrentTab: action,
|
50
|
+
tabs: observable,
|
41
51
|
closeTab: action,
|
42
52
|
closeAllTabs: action,
|
43
53
|
closeAllOtherTabs: action,
|
44
54
|
openTab: action,
|
45
55
|
swapTabs: action,
|
56
|
+
pinTab: action,
|
57
|
+
unpinTab: action,
|
46
58
|
});
|
47
59
|
}
|
48
60
|
setCurrentTab(val) {
|
@@ -51,13 +63,19 @@ export class TabManagerState {
|
|
51
63
|
closeAllOtherTabs(tab) {
|
52
64
|
assertNonNullable(this.tabs.find((e) => e === tab), 'Specified tab should be currently opened');
|
53
65
|
this.setCurrentTab(tab);
|
54
|
-
this.tabs =
|
66
|
+
this.tabs = this.tabs.filter((_tab) => _tab.isPinned || _tab === tab);
|
55
67
|
}
|
56
68
|
closeAllTabs() {
|
57
|
-
this.
|
58
|
-
this.tabs
|
69
|
+
this.tabs = this.tabs.filter((tab) => tab.isPinned);
|
70
|
+
if (!this.currentTab || !this.tabs.includes(this.currentTab)) {
|
71
|
+
this.setCurrentTab(this.tabs.length ? this.tabs[0] : undefined);
|
72
|
+
}
|
59
73
|
}
|
60
74
|
swapTabs(tab1, tab2) {
|
75
|
+
if (tab1.isPinned !== tab2.isPinned) {
|
76
|
+
// cannot swap pinned tab with unpinned tab or vice versa
|
77
|
+
return;
|
78
|
+
}
|
61
79
|
swapEntry(this.tabs, tab1, tab2);
|
62
80
|
}
|
63
81
|
openTab(tab) {
|
@@ -65,7 +83,7 @@ export class TabManagerState {
|
|
65
83
|
if (!existingTab) {
|
66
84
|
if (this.currentTab) {
|
67
85
|
const currIndex = this.tabs.findIndex((e) => e === this.currentTab);
|
68
|
-
this.tabs.splice(currIndex + 1, 0, tab);
|
86
|
+
this.tabs.splice(Math.max(currIndex + 1, this.tabs.filter((t) => t.isPinned).length), 0, tab);
|
69
87
|
}
|
70
88
|
else {
|
71
89
|
this.tabs.push(tab);
|
@@ -75,6 +93,9 @@ export class TabManagerState {
|
|
75
93
|
tab.onOpen();
|
76
94
|
}
|
77
95
|
closeTab(tab) {
|
96
|
+
if (tab.isPinned) {
|
97
|
+
return;
|
98
|
+
}
|
78
99
|
const tabIndex = this.tabs.findIndex((t) => t.match(tab));
|
79
100
|
assertTrue(tabIndex !== -1, `Can't close a tab which is not opened`);
|
80
101
|
this.tabs.splice(tabIndex, 1);
|
@@ -89,5 +110,23 @@ export class TabManagerState {
|
|
89
110
|
}
|
90
111
|
tab.onClose();
|
91
112
|
}
|
113
|
+
pinTab(tab) {
|
114
|
+
if (tab.isPinned) {
|
115
|
+
return;
|
116
|
+
}
|
117
|
+
const tabIndex = this.tabs.findIndex((t) => t.match(tab));
|
118
|
+
this.tabs.splice(tabIndex, 1);
|
119
|
+
this.tabs.splice(this.tabs.filter((t) => t.isPinned).length, 0, tab);
|
120
|
+
tab.setPinned(true);
|
121
|
+
}
|
122
|
+
unpinTab(tab) {
|
123
|
+
if (!tab.isPinned) {
|
124
|
+
return;
|
125
|
+
}
|
126
|
+
const tabIndex = this.tabs.findIndex((t) => t.match(tab));
|
127
|
+
this.tabs.splice(tabIndex, 1);
|
128
|
+
this.tabs.splice(this.tabs.filter((t) => t.isPinned).length, 0, tab);
|
129
|
+
tab.setPinned(false);
|
130
|
+
}
|
92
131
|
}
|
93
132
|
//# sourceMappingURL=TabManagerState.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TabManagerState.js","sourceRoot":"","sources":["../../src/application/TabManagerState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,IAAI,GACL,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAE1D,MAAM,OAAgB,QAAQ;IACnB,IAAI,GAAG,IAAI,EAAE,CAAC;
|
1
|
+
{"version":3,"file":"TabManagerState.js","sourceRoot":"","sources":["../../src/application/TabManagerState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,SA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1
|
+
/** @license @finos/legend-lego v1.2.63
|
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";.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{
|
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{display:flex;align-items:center;justify-content:center;visibility:hidden;height:2rem;width:2rem;border-radius:.2rem;margin-right:.4rem}.tab-manager__tab__close-btn svg{color:var(--color-light-grey-200);font-size:1.2rem}.tab-manager__tab__close-btn:hover{background:var(--color-dark-grey-200)}.tab-manager__tab__pin-btn{display:flex;align-items:center;justify-content:center;height:2rem;width:2rem;border-radius:.2rem;margin-right:.4rem}.tab-manager__tab__pin-btn svg{color:var(--color-dark-grey-500);font-size:1.4rem}.tab-manager__tab__pin-btn:hover{background:var(--color-dark-grey-200)}.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: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}.activity-bar__item .activity-bar__item__experimental-badge{display:flex;align-items:center;justify-content:center;position:absolute;top:.6rem;right:.6rem;height:1.6rem;width:1.6rem;border-radius:50%;background:var(--color-mauve-50);border:.1rem solid var(--color-dark-grey-280)}.activity-bar__item .activity-bar__item__experimental-badge svg{font-size:1.2rem;color:var(--color-dark-grey-280)}.undo-redo{display:flex;align-items:center}.undo-redo__button{color:var(--color-light-blue-50);margin:0 .5rem}.undo-redo__button svg{font-size:1.1rem}.undo-redo__button__label{font-size:1.2rem;font-weight:700}.undo-redo__button[disabled]{color:var(--color-dark-grey-500)}.documentation-link{display:inline-flex;align-self:center;color:var(--color-dark-grey-500);cursor:pointer}.documentation-link--inline{margin-left:.5rem}.documentation-link:hover{color:var(--color-light-grey-400)}.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{height:100%;width:100%}.code-editor__content{height:100%;width:100%;position:relative;background:var(--color-dark-grey-50)}.code-editor__header{display:flex;align-items:center;justify-content:right;width:100%;height:2.8rem;background:var(--color-dark-grey-50);border-bottom:.1rem solid var(--color-dark-grey-80);border-radius:.2rem .2rem 0 0}.code-editor__header__action{display:flex;align-items:center;justify-content:center;color:var(--color-dark-grey-400);height:2.8rem;width:2.8rem}.code-editor__header__action:hover{color:var(--color-dark-grey-500)}.code-editor__header__action--active,.code-editor__header__action--active:hover{color:var(--color-light-grey-300)}.code-editor__header__action svg{font-size:1.6rem}.code-editor__body{height:100%;width:100%;position:absolute;top:0;left:0;overflow:hidden}.code-editor__content--padding{border-radius:.2rem}.code-editor__content--padding .code-editor__body{border-radius:.2rem}.code-editor__content--with__header{height:calc(100% - 2.8rem)}.code-editor__content--with__header .code-editor__body{border-radius:0 0 .2rem .2rem}.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/application/_fuzzy-search.scss","../../../node_modules/@finos/legend-art/scss/_mixins.scss","../style/application/_tab-manager.scss","../style/application/_activity-bar.scss","../style/application/_undo-redo-button.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,
|
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/_activity-bar.scss","../style/application/_undo-redo-button.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,6BDvCF,aACA,mBACA,uBCwCI,kBACA,YACA,WACA,oBACA,mBAEA,iCACE,kCACA,iBAGF,mCACE,sCAIJ,2BD1DF,aACA,mBACA,uBC2DI,YACA,WACA,oBACA,mBAEA,+BACE,iCACA,iBAGF,iCACE,sCAIJ,4GAEE,mBAEA,oHACE,kCAIJ,oCACE,gBACA,SACA,gBACA,sCAIJ,mBACE,gBACA,gBACA,YACA,UAEA,4BDnGF,aACA,mBACA,uBA2BA,YACA,cCyEI,kCACA,kDACA,YACA,aAGF,yBACE,8BAEA,gFAEE,sCAIJ,gCACE,gBACA,mBACA,iBACA,gBACA,uBAGF,oCD9HF,aACA,mBACA,uBA2BA,YACA,cCoGI,cACA,kBACA,mBAEA,wCACE,aACA,cC7IN,4DFKA,aACA,mBACA,uBEJE,kBACA,UACA,YACA,cACA,aACA,kBACA,iCACA,8CAEA,gEACE,iBACA,iCCfN,WHYE,aACA,mBGVA,mBACE,iCACA,eAEA,uBACE,iBAGF,0BACE,iBACA,gBAIJ,6BACE,iCClBJ,oBACE,oBACA,kBACA,iCACA,eAEA,4BACE,kBAIJ,0BACE,kCAGF,uBACE,aACA,qCACA,8CACA,oBAEA,6BACE,aACA,wBACA,kCACA,iBAGF,6BJXA,aACA,uBIaE,eACA,WClCJ,iBACE,iBAGF,6BACE,iBCJF,aACE,YACA,WAEA,sBACE,YACA,WACA,kBACA,qCAGF,qBNEA,aACA,yCMCE,WACA,cACA,qCACA,oDACA,8BAGF,6BNfA,aACA,mBACA,uBMgBE,iCACA,cACA,aAEA,mCACE,iCAGF,gFAEE,kCAGF,iCACE,iBAIJ,mBACE,YACA,WACA,kBACA,MACA,OACA,gBAGF,+BACE,oBAGF,kDACE,oBAGF,oCACE,2BAGF,uDACE,8BChEJ,kCPYE,aACA,mBOVA,uCPSA,aACA,mBOPE,iCACA,sCACA,+CACA,iBACA,oBACA,eACA,gBACA,cACA,gBAGF,wCPLA,aACA,mBOOE,cAIJ,wCACE,iCACA,cACA,mBACA,yBAEA,gDACE,+BAGF,mDACE,kCAGF,oDACE,mCAIJ,wCP/BE,aACA,mBOiCA,aAEA,6CPpCA,aACA,mBOsCE,iCACA,sCACA,iBACA,oBACA,eACA,gBACA,cACA,gBAGF,8CPjDA,aACA,mBOmDE","file":"index.css"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@finos/legend-lego",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.63",
|
4
4
|
"description": "Legend shared advanced application components and building blocks",
|
5
5
|
"keywords": [
|
6
6
|
"legend",
|
@@ -63,12 +63,12 @@
|
|
63
63
|
"@ag-grid-enterprise/server-side-row-model": "32.1.0",
|
64
64
|
"@ag-grid-enterprise/side-bar": "32.1.0",
|
65
65
|
"@ag-grid-enterprise/status-bar": "32.1.0",
|
66
|
-
"@finos/legend-application": "15.1.
|
67
|
-
"@finos/legend-art": "7.1.
|
68
|
-
"@finos/legend-graph": "31.10.
|
66
|
+
"@finos/legend-application": "15.1.26",
|
67
|
+
"@finos/legend-art": "7.1.53",
|
68
|
+
"@finos/legend-graph": "31.10.26",
|
69
69
|
"@finos/legend-shared": "10.0.53",
|
70
70
|
"@types/css-font-loading-module": "0.0.13",
|
71
|
-
"@types/react": "18.3.
|
71
|
+
"@types/react": "18.3.5",
|
72
72
|
"@types/react-dom": "18.3.0",
|
73
73
|
"mobx": "6.13.1",
|
74
74
|
"mobx-react-lite": "4.0.7",
|
@@ -25,6 +25,8 @@ import {
|
|
25
25
|
PanelEntryDropZonePlaceholder,
|
26
26
|
TimesIcon,
|
27
27
|
useDragPreviewLayer,
|
28
|
+
MenuContentDivider,
|
29
|
+
PushPinIcon,
|
28
30
|
} from '@finos/legend-art';
|
29
31
|
import { observer } from 'mobx-react-lite';
|
30
32
|
import { useRef, useCallback } from 'react';
|
@@ -65,6 +67,13 @@ const TabContextMenu = observer(
|
|
65
67
|
const close = (): void => managerTabState.closeTab(tabState);
|
66
68
|
const closeOthers = (): void => managerTabState.closeAllOtherTabs(tabState);
|
67
69
|
const closeAll = (): void => managerTabState.closeAllTabs();
|
70
|
+
const togglePin = () => {
|
71
|
+
if (tabState.isPinned) {
|
72
|
+
managerTabState.unpinTab(tabState);
|
73
|
+
} else {
|
74
|
+
managerTabState.pinTab(tabState);
|
75
|
+
}
|
76
|
+
};
|
68
77
|
|
69
78
|
return (
|
70
79
|
<MenuContent>
|
@@ -76,6 +85,10 @@ const TabContextMenu = observer(
|
|
76
85
|
Close Others
|
77
86
|
</MenuContentItem>
|
78
87
|
<MenuContentItem onClick={closeAll}>Close All</MenuContentItem>
|
88
|
+
<MenuContentDivider />
|
89
|
+
<MenuContentItem onClick={togglePin}>
|
90
|
+
{tabState.isPinned ? 'Unpin' : 'Pin'}
|
91
|
+
</MenuContentItem>
|
79
92
|
</MenuContent>
|
80
93
|
);
|
81
94
|
},
|
@@ -194,14 +207,26 @@ const Tab = observer(
|
|
194
207
|
>
|
195
208
|
{tabRenderer?.(tabState) ?? tabState.label}
|
196
209
|
</button>
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
210
|
+
{tabState.isPinned && (
|
211
|
+
<button
|
212
|
+
className="tab-manager__tab__pin-btn"
|
213
|
+
onClick={() => tabManagerState.unpinTab(tabState)}
|
214
|
+
tabIndex={-1}
|
215
|
+
title="Unpin"
|
216
|
+
>
|
217
|
+
<PushPinIcon />
|
218
|
+
</button>
|
219
|
+
)}
|
220
|
+
{!tabState.isPinned && (
|
221
|
+
<button
|
222
|
+
className="tab-manager__tab__close-btn"
|
223
|
+
onClick={() => tabManagerState.closeTab(tabState)}
|
224
|
+
tabIndex={-1}
|
225
|
+
title="Close"
|
226
|
+
>
|
227
|
+
<TimesIcon />
|
228
|
+
</button>
|
229
|
+
)}
|
205
230
|
</ContextMenu>
|
206
231
|
</PanelEntryDropZonePlaceholder>
|
207
232
|
</div>
|
@@ -24,6 +24,14 @@ import { action, makeObservable, observable } from 'mobx';
|
|
24
24
|
|
25
25
|
export abstract class TabState {
|
26
26
|
readonly uuid = uuid();
|
27
|
+
isPinned = false;
|
28
|
+
|
29
|
+
constructor() {
|
30
|
+
makeObservable(this, {
|
31
|
+
isPinned: observable,
|
32
|
+
setPinned: action,
|
33
|
+
});
|
34
|
+
}
|
27
35
|
|
28
36
|
abstract get label(): string;
|
29
37
|
|
@@ -31,6 +39,10 @@ export abstract class TabState {
|
|
31
39
|
return undefined;
|
32
40
|
}
|
33
41
|
|
42
|
+
setPinned(val: boolean): void {
|
43
|
+
this.isPinned = val;
|
44
|
+
}
|
45
|
+
|
34
46
|
match(tab: TabState): boolean {
|
35
47
|
return this === tab;
|
36
48
|
}
|
@@ -51,13 +63,16 @@ export abstract class TabManagerState {
|
|
51
63
|
constructor() {
|
52
64
|
makeObservable(this, {
|
53
65
|
currentTab: observable,
|
54
|
-
tabs: observable,
|
55
66
|
setCurrentTab: action,
|
67
|
+
|
68
|
+
tabs: observable,
|
56
69
|
closeTab: action,
|
57
70
|
closeAllTabs: action,
|
58
71
|
closeAllOtherTabs: action,
|
59
72
|
openTab: action,
|
60
73
|
swapTabs: action,
|
74
|
+
pinTab: action,
|
75
|
+
unpinTab: action,
|
61
76
|
});
|
62
77
|
}
|
63
78
|
|
@@ -71,15 +86,21 @@ export abstract class TabManagerState {
|
|
71
86
|
'Specified tab should be currently opened',
|
72
87
|
);
|
73
88
|
this.setCurrentTab(tab);
|
74
|
-
this.tabs =
|
89
|
+
this.tabs = this.tabs.filter((_tab) => _tab.isPinned || _tab === tab);
|
75
90
|
}
|
76
91
|
|
77
92
|
closeAllTabs(): void {
|
78
|
-
this.
|
79
|
-
this.tabs
|
93
|
+
this.tabs = this.tabs.filter((tab) => tab.isPinned);
|
94
|
+
if (!this.currentTab || !this.tabs.includes(this.currentTab)) {
|
95
|
+
this.setCurrentTab(this.tabs.length ? this.tabs[0] : undefined);
|
96
|
+
}
|
80
97
|
}
|
81
98
|
|
82
99
|
swapTabs(tab1: TabState, tab2: TabState): void {
|
100
|
+
if (tab1.isPinned !== tab2.isPinned) {
|
101
|
+
// cannot swap pinned tab with unpinned tab or vice versa
|
102
|
+
return;
|
103
|
+
}
|
83
104
|
swapEntry(this.tabs, tab1, tab2);
|
84
105
|
}
|
85
106
|
|
@@ -94,7 +115,11 @@ export abstract class TabManagerState {
|
|
94
115
|
if (!existingTab) {
|
95
116
|
if (this.currentTab) {
|
96
117
|
const currIndex = this.tabs.findIndex((e) => e === this.currentTab);
|
97
|
-
this.tabs.splice(
|
118
|
+
this.tabs.splice(
|
119
|
+
Math.max(currIndex + 1, this.tabs.filter((t) => t.isPinned).length),
|
120
|
+
0,
|
121
|
+
tab,
|
122
|
+
);
|
98
123
|
} else {
|
99
124
|
this.tabs.push(tab);
|
100
125
|
}
|
@@ -105,6 +130,9 @@ export abstract class TabManagerState {
|
|
105
130
|
}
|
106
131
|
|
107
132
|
closeTab(tab: TabState): void {
|
133
|
+
if (tab.isPinned) {
|
134
|
+
return;
|
135
|
+
}
|
108
136
|
const tabIndex = this.tabs.findIndex((t) => t.match(tab));
|
109
137
|
assertTrue(tabIndex !== -1, `Can't close a tab which is not opened`);
|
110
138
|
this.tabs.splice(tabIndex, 1);
|
@@ -121,4 +149,24 @@ export abstract class TabManagerState {
|
|
121
149
|
|
122
150
|
tab.onClose();
|
123
151
|
}
|
152
|
+
|
153
|
+
pinTab(tab: TabState): void {
|
154
|
+
if (tab.isPinned) {
|
155
|
+
return;
|
156
|
+
}
|
157
|
+
const tabIndex = this.tabs.findIndex((t) => t.match(tab));
|
158
|
+
this.tabs.splice(tabIndex, 1);
|
159
|
+
this.tabs.splice(this.tabs.filter((t) => t.isPinned).length, 0, tab);
|
160
|
+
tab.setPinned(true);
|
161
|
+
}
|
162
|
+
|
163
|
+
unpinTab(tab: TabState): void {
|
164
|
+
if (!tab.isPinned) {
|
165
|
+
return;
|
166
|
+
}
|
167
|
+
const tabIndex = this.tabs.findIndex((t) => t.match(tab));
|
168
|
+
this.tabs.splice(tabIndex, 1);
|
169
|
+
this.tabs.splice(this.tabs.filter((t) => t.isPinned).length, 0, tab);
|
170
|
+
tab.setPinned(false);
|
171
|
+
}
|
124
172
|
}
|