@finos/legend-lego 1.2.9 → 1.2.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,22 @@
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
+ /// <reference types="react" resolution-mode="require"/>
17
+ export declare const RedoButton: React.FC<{
18
+ parent: React.RefObject<HTMLDivElement>;
19
+ canRedo: boolean;
20
+ redo: () => void;
21
+ }>;
22
+ //# sourceMappingURL=RedoButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RedoButton.d.ts","sourceRoot":"","sources":["../../src/application/RedoButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;AAKH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC;IAChC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB,CAyCA,CAAC"}
@@ -0,0 +1,44 @@
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 { RedoIcon } from '@finos/legend-art';
18
+ import { useEffect } from 'react';
19
+ export const RedoButton = (props) => {
20
+ const { parent, canRedo, redo } = props;
21
+ useEffect(() => {
22
+ const onCtrlY = (event) => {
23
+ const target = event.target;
24
+ if (event.ctrlKey &&
25
+ event.key === 'y' &&
26
+ target !== null &&
27
+ parent.current !== null &&
28
+ // This is for making sure undo/redo is contextual so that it won't modify the underlying query when a new modal is open
29
+ // The reason why not to do this via registerCommands() is that it's hard to compose contextual condtion without introducing an explicit
30
+ // dependency on parameters/constants/watermark/other modals. If we are going to introduce more modals,
31
+ // we have to update the condition correspondingly but developers might forget to update the condition.
32
+ (parent.current.contains(target) || target.contains(parent.current))) {
33
+ event.preventDefault();
34
+ redo();
35
+ }
36
+ };
37
+ document.addEventListener('keydown', onCtrlY);
38
+ return () => {
39
+ document.removeEventListener('keydown', onCtrlY);
40
+ };
41
+ }, [parent, redo]);
42
+ return (_jsx("div", { className: "undo-redo", children: _jsxs("button", { className: "undo-redo__button", onClick: redo, tabIndex: -1, title: 'Redo(ctrl + y)', disabled: !canRedo, children: [_jsx(RedoIcon, {}), _jsx("div", { className: "undo-redo__button__label", children: "Redo" })] }) }));
43
+ };
44
+ //# sourceMappingURL=RedoButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RedoButton.js","sourceRoot":"","sources":["../../src/application/RedoButton.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,CAAC,MAAM,UAAU,GAIlB,CAAC,KAAK,EAAE,EAAE;IACb,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAExC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,CAAC,KAAoB,EAAQ,EAAE;YAC7C,MAAM,MAAM,GAAG,KAAK,CAAC,MAAqB,CAAC;YAC3C,IACE,KAAK,CAAC,OAAO;gBACb,KAAK,CAAC,GAAG,KAAK,GAAG;gBACjB,MAAM,KAAK,IAAI;gBACf,MAAM,CAAC,OAAO,KAAK,IAAI;gBACvB,wHAAwH;gBACxH,wIAAwI;gBACxI,uGAAuG;gBACvG,uGAAuG;gBACvG,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EACpE;gBACA,KAAK,CAAC,cAAc,EAAE,CAAC;gBACvB,IAAI,EAAE,CAAC;aACR;QACH,CAAC,CAAC;QACF,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC9C,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACnD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAEnB,OAAO,CACL,cAAK,SAAS,EAAC,WAAW,YACxB,kBACE,SAAS,EAAC,mBAAmB,EAC7B,OAAO,EAAE,IAAI,EACb,QAAQ,EAAE,CAAC,CAAC,EACZ,KAAK,EAAE,gBAAgB,EACvB,QAAQ,EAAE,CAAC,OAAO,aAElB,KAAC,QAAQ,KAAG,EACZ,cAAK,SAAS,EAAC,0BAA0B,qBAAW,IAC7C,GACL,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,22 @@
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
+ /// <reference types="react" resolution-mode="require"/>
17
+ export declare const UndoButton: React.FC<{
18
+ parent: React.RefObject<HTMLDivElement>;
19
+ canUndo: boolean;
20
+ undo: () => void;
21
+ }>;
22
+ //# sourceMappingURL=UndoButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UndoButton.d.ts","sourceRoot":"","sources":["../../src/application/UndoButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;AAKH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC;IAChC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB,CAyCA,CAAC"}
@@ -0,0 +1,44 @@
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 { UndoIcon } from '@finos/legend-art';
18
+ import { useEffect } from 'react';
19
+ export const UndoButton = (props) => {
20
+ const { parent, canUndo, undo } = props;
21
+ useEffect(() => {
22
+ const onCtrlZ = (event) => {
23
+ const target = event.target;
24
+ if (event.ctrlKey &&
25
+ event.key === 'z' &&
26
+ target !== null &&
27
+ parent.current !== null &&
28
+ // This is for making sure undo/redo is contextual so that it won't modify the underlying query when a new modal is open
29
+ // The reason why not to do this via registerCommands() is that it's hard to compose contextual condtion without introducing an explicit
30
+ // dependency on parameters/constants/watermark/other modals. If we are going to introduce more modals,
31
+ // we have to update the condition correspondingly but developers might forget to update the condition.
32
+ (parent.current.contains(target) || target.contains(parent.current))) {
33
+ event.preventDefault();
34
+ undo();
35
+ }
36
+ };
37
+ document.addEventListener('keydown', onCtrlZ);
38
+ return () => {
39
+ document.removeEventListener('keydown', onCtrlZ);
40
+ };
41
+ }, [parent, undo]);
42
+ return (_jsx("div", { className: "undo-redo", children: _jsxs("button", { className: "undo-redo__button", onClick: undo, tabIndex: -1, title: 'Undo(ctrl + z)', disabled: !canUndo, children: [_jsx(UndoIcon, {}), _jsx("div", { className: "undo-redo__button__label", children: "Undo" })] }) }));
43
+ };
44
+ //# sourceMappingURL=UndoButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UndoButton.js","sourceRoot":"","sources":["../../src/application/UndoButton.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,CAAC,MAAM,UAAU,GAIlB,CAAC,KAAK,EAAE,EAAE;IACb,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAExC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,CAAC,KAAoB,EAAQ,EAAE;YAC7C,MAAM,MAAM,GAAG,KAAK,CAAC,MAAqB,CAAC;YAC3C,IACE,KAAK,CAAC,OAAO;gBACb,KAAK,CAAC,GAAG,KAAK,GAAG;gBACjB,MAAM,KAAK,IAAI;gBACf,MAAM,CAAC,OAAO,KAAK,IAAI;gBACvB,wHAAwH;gBACxH,wIAAwI;gBACxI,uGAAuG;gBACvG,uGAAuG;gBACvG,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EACpE;gBACA,KAAK,CAAC,cAAc,EAAE,CAAC;gBACvB,IAAI,EAAE,CAAC;aACR;QACH,CAAC,CAAC;QACF,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC9C,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACnD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAEnB,OAAO,CACL,cAAK,SAAS,EAAC,WAAW,YACxB,kBACE,SAAS,EAAC,mBAAmB,EAC7B,OAAO,EAAE,IAAI,EACb,QAAQ,EAAE,CAAC,CAAC,EACZ,KAAK,EAAE,gBAAgB,EACvB,QAAQ,EAAE,CAAC,OAAO,aAElB,KAAC,QAAQ,KAAG,EACZ,cAAK,SAAS,EAAC,0BAA0B,qBAAW,IAC7C,GACL,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -17,5 +17,7 @@ export * from './DocumentationLink.js';
17
17
  export * from './ActivityBar.js';
18
18
  export * from './TabManager.js';
19
19
  export * from './TabManagerState.js';
20
+ export * from './UndoButton.js';
21
+ export * from './RedoButton.js';
20
22
  export * from './FuzzySearchAdvancedConfigMenu.js';
21
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/application/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,wBAAwB,CAAC;AAEvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AAErC,cAAc,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/application/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,wBAAwB,CAAC;AAEvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAEhC,cAAc,oCAAoC,CAAC"}
@@ -17,5 +17,7 @@ export * from './DocumentationLink.js';
17
17
  export * from './ActivityBar.js';
18
18
  export * from './TabManager.js';
19
19
  export * from './TabManagerState.js';
20
+ export * from './UndoButton.js';
21
+ export * from './RedoButton.js';
20
22
  export * from './FuzzySearchAdvancedConfigMenu.js';
21
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/application/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,wBAAwB,CAAC;AAEvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AAErC,cAAc,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/application/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,wBAAwB,CAAC;AAEvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAEhC,cAAc,oCAAoC,CAAC"}
package/lib/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /** @license @finos/legend-lego v1.2.9
1
+ /** @license @finos/legend-lego v1.2.11
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{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: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)}.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 */
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: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-left:1rem;margin-right:1rem}.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/_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,sCAIJ,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,cCpHN,4DFKA,aACA,mBACA,uBEJE,kBACA,UACA,YACA,cACA,aACA,kBACA,iCACA,8CAEA,gEACE,iBACA,iCCfN,oBACE,oBACA,kBACA,iCACA,eAEA,4BACE,kBAIJ,0BACE,kCAGF,uBACE,aACA,qCACA,8CACA,oBAEA,6BACE,aACA,wBACA,kCACA,iBAGF,6BHXA,aACA,uBGaE,eACA,WClCJ,iBACE,iBAGF,6BACE,iBCJF,aACE,YACA,WAEA,sBACE,YACA,WACA,kBACA,qCAGF,qBLEA,aACA,yCKCE,WACA,cACA,qCACA,oDACA,8BAGF,6BLfA,aACA,mBACA,uBKgBE,iCACA,cACA,aAEA,mCACE,iCAGF,gFAEE,kCAGF,iCACE,iBAIJ,mBACE,YACA,WACA,kBACA,MACA,OACA,gBAGF,+BACE,oBAGF,kDACE,oBAGF,oCACE,2BAGF,uDACE,8BChEJ,kCNYE,aACA,mBMVA,uCNSA,aACA,mBMPE,iCACA,sCACA,+CACA,iBACA,oBACA,eACA,gBACA,cACA,gBAGF,wCNLA,aACA,mBMOE,cAIJ,wCACE,iCACA,cACA,mBACA,yBAEA,gDACE,+BAGF,mDACE,kCAGF,oDACE,mCAIJ,wCN/BE,aACA,mBMiCA,aAEA,6CNpCA,aACA,mBMsCE,iCACA,sCACA,iBACA,oBACA,eACA,gBACA,cACA,gBAGF,8CNjDA,aACA,mBMmDE","file":"index.css"}
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,6BACE,kBDlCJ,aACA,mBCqCI,iCACE,kCACA,iBACA,kBAIJ,4GAEE,mBAEA,oHACE,kCAIJ,oCACE,gBACA,SACA,gBACA,sCAIJ,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,cCpHN,4DFKA,aACA,mBACA,uBEJE,kBACA,UACA,YACA,cACA,aACA,kBACA,iCACA,8CAEA,gEACE,iBACA,iCCfN,WHYE,aACA,mBGVA,mBACE,iCACA,iBACA,kBAEA,uBACE,iBAGF,0BACE,iBACA,gBAIJ,6BACE,iCCnBJ,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.9",
3
+ "version": "1.2.11",
4
4
  "description": "Legend shared advanced application components and building blocks",
5
5
  "keywords": [
6
6
  "legend",
@@ -63,9 +63,9 @@
63
63
  "@ag-grid-enterprise/server-side-row-model": "30.2.0",
64
64
  "@ag-grid-enterprise/side-bar": "30.2.0",
65
65
  "@ag-grid-enterprise/status-bar": "30.2.0",
66
- "@finos/legend-application": "15.0.68",
67
- "@finos/legend-art": "7.1.20",
68
- "@finos/legend-graph": "31.8.4",
66
+ "@finos/legend-application": "15.0.70",
67
+ "@finos/legend-art": "7.1.22",
68
+ "@finos/legend-graph": "31.8.6",
69
69
  "@finos/legend-shared": "10.0.32",
70
70
  "@types/css-font-loading-module": "0.0.10",
71
71
  "@types/react": "18.2.31",
@@ -0,0 +1,65 @@
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 { RedoIcon } from '@finos/legend-art';
18
+ import { useEffect } from 'react';
19
+
20
+ export const RedoButton: React.FC<{
21
+ parent: React.RefObject<HTMLDivElement>;
22
+ canRedo: boolean;
23
+ redo: () => void;
24
+ }> = (props) => {
25
+ const { parent, canRedo, redo } = props;
26
+
27
+ useEffect(() => {
28
+ const onCtrlY = (event: KeyboardEvent): void => {
29
+ const target = event.target as Node | null;
30
+ if (
31
+ event.ctrlKey &&
32
+ event.key === 'y' &&
33
+ target !== null &&
34
+ parent.current !== null &&
35
+ // This is for making sure undo/redo is contextual so that it won't modify the underlying query when a new modal is open
36
+ // The reason why not to do this via registerCommands() is that it's hard to compose contextual condtion without introducing an explicit
37
+ // dependency on parameters/constants/watermark/other modals. If we are going to introduce more modals,
38
+ // we have to update the condition correspondingly but developers might forget to update the condition.
39
+ (parent.current.contains(target) || target.contains(parent.current))
40
+ ) {
41
+ event.preventDefault();
42
+ redo();
43
+ }
44
+ };
45
+ document.addEventListener('keydown', onCtrlY);
46
+ return () => {
47
+ document.removeEventListener('keydown', onCtrlY);
48
+ };
49
+ }, [parent, redo]);
50
+
51
+ return (
52
+ <div className="undo-redo">
53
+ <button
54
+ className="undo-redo__button"
55
+ onClick={redo}
56
+ tabIndex={-1}
57
+ title={'Redo(ctrl + y)'}
58
+ disabled={!canRedo}
59
+ >
60
+ <RedoIcon />
61
+ <div className="undo-redo__button__label">Redo</div>
62
+ </button>
63
+ </div>
64
+ );
65
+ };
@@ -0,0 +1,65 @@
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 { UndoIcon } from '@finos/legend-art';
18
+ import { useEffect } from 'react';
19
+
20
+ export const UndoButton: React.FC<{
21
+ parent: React.RefObject<HTMLDivElement>;
22
+ canUndo: boolean;
23
+ undo: () => void;
24
+ }> = (props) => {
25
+ const { parent, canUndo, undo } = props;
26
+
27
+ useEffect(() => {
28
+ const onCtrlZ = (event: KeyboardEvent): void => {
29
+ const target = event.target as Node | null;
30
+ if (
31
+ event.ctrlKey &&
32
+ event.key === 'z' &&
33
+ target !== null &&
34
+ parent.current !== null &&
35
+ // This is for making sure undo/redo is contextual so that it won't modify the underlying query when a new modal is open
36
+ // The reason why not to do this via registerCommands() is that it's hard to compose contextual condtion without introducing an explicit
37
+ // dependency on parameters/constants/watermark/other modals. If we are going to introduce more modals,
38
+ // we have to update the condition correspondingly but developers might forget to update the condition.
39
+ (parent.current.contains(target) || target.contains(parent.current))
40
+ ) {
41
+ event.preventDefault();
42
+ undo();
43
+ }
44
+ };
45
+ document.addEventListener('keydown', onCtrlZ);
46
+ return () => {
47
+ document.removeEventListener('keydown', onCtrlZ);
48
+ };
49
+ }, [parent, undo]);
50
+
51
+ return (
52
+ <div className="undo-redo">
53
+ <button
54
+ className="undo-redo__button"
55
+ onClick={undo}
56
+ tabIndex={-1}
57
+ title={'Undo(ctrl + z)'}
58
+ disabled={!canUndo}
59
+ >
60
+ <UndoIcon />
61
+ <div className="undo-redo__button__label">Undo</div>
62
+ </button>
63
+ </div>
64
+ );
65
+ };
@@ -19,5 +19,7 @@ export * from './DocumentationLink.js';
19
19
  export * from './ActivityBar.js';
20
20
  export * from './TabManager.js';
21
21
  export * from './TabManagerState.js';
22
+ export * from './UndoButton.js';
23
+ export * from './RedoButton.js';
22
24
 
23
25
  export * from './FuzzySearchAdvancedConfigMenu.js';
package/tsconfig.json CHANGED
@@ -43,7 +43,9 @@
43
43
  "./src/application/ActivityBar.tsx",
44
44
  "./src/application/DocumentationLink.tsx",
45
45
  "./src/application/FuzzySearchAdvancedConfigMenu.tsx",
46
+ "./src/application/RedoButton.tsx",
46
47
  "./src/application/TabManager.tsx",
48
+ "./src/application/UndoButton.tsx",
47
49
  "./src/code-editor/CodeDiffView.tsx",
48
50
  "./src/code-editor/CodeEditor.tsx",
49
51
  "./src/code-editor/__test-utils__/MonacoEditorMockUtils.tsx",