ketcher-react 2.10.0-rc.4 → 2.11.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/index.css.map +1 -1
  3. package/dist/index.js +2291 -2013
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.modern.js +2292 -2013
  6. package/dist/index.modern.js.map +1 -1
  7. package/dist/script/editor/Editor.d.ts +2 -0
  8. package/dist/script/editor/tool/helper/dropAndMerge.d.ts +1 -7
  9. package/dist/script/editor/tool/rotate-controller.d.ts +46 -0
  10. package/dist/script/editor/tool/rotate-controller.test.d.ts +1 -0
  11. package/dist/script/editor/tool/rotate.d.ts +10 -2
  12. package/dist/script/editor/tool/select.d.ts +1 -1
  13. package/dist/script/editor/utils/functionalGroupsTooltip.d.ts +6 -2
  14. package/dist/script/ui/component/form/Input/Input.test.d.ts +1 -0
  15. package/dist/script/ui/component/view/SaveButton.test.d.ts +16 -0
  16. package/dist/script/ui/component/view/savebutton.d.ts +1 -0
  17. package/dist/script/ui/state/saltsAndSolvents/index.d.ts +1 -1
  18. package/dist/script/ui/views/Editor.d.ts +1 -1
  19. package/dist/script/ui/views/components/ContextMenu/contextMenu.types.d.ts +23 -1
  20. package/dist/script/ui/views/components/ContextMenu/menuItems/AtomMenuItems.d.ts +3 -2
  21. package/dist/script/ui/views/components/ContextMenu/menuItems/BondMenuItems.d.ts +3 -2
  22. package/dist/script/ui/views/components/ContextMenu/menuItems/FunctionalGroupMenuItems.d.ts +3 -2
  23. package/dist/script/ui/views/components/ContextMenu/menuItems/SelectionMenuItems.d.ts +3 -2
  24. package/dist/script/ui/views/components/ContextMenu/utils.d.ts +1 -1
  25. package/dist/script/ui/views/components/ContextMenu/utils.test.d.ts +1 -0
  26. package/dist/setupTests.d.ts +1 -0
  27. package/package.json +1 -1
  28. /package/dist/script/ui/component/form/{input.d.ts → Input/Input.d.ts} +0 -0
@@ -18,6 +18,7 @@ import { PipelineSubscription, Subscription } from 'subscription';
18
18
  import { Highlighter } from './highlighter';
19
19
  import { contextMenuInfo } from '../ui/views/components/ContextMenu/contextMenu.types';
20
20
  import { HoverIcon } from './HoverIcon';
21
+ import RotateController from './tool/rotate-controller';
21
22
  export interface Selection {
22
23
  atoms?: Array<number>;
23
24
  bonds?: Array<number>;
@@ -40,6 +41,7 @@ declare class Editor implements KetcherEditor {
40
41
  y: number;
41
42
  };
42
43
  contextMenu: contextMenuInfo;
44
+ rotateController: RotateController;
43
45
  event: {
44
46
  message: Subscription;
45
47
  elementEdit: PipelineSubscription;
@@ -1,9 +1,3 @@
1
1
  import { Action } from 'ketcher-core';
2
2
  import Editor from '../../Editor';
3
- declare type MergeItems = {
4
- atoms: Map<number, number>;
5
- bonds: Map<number, number>;
6
- atomToFunctionalGroup?: Map<number, number>;
7
- };
8
- export declare function dropAndMerge(editor: Editor, mergeItems: MergeItems, action?: Action, resizeCanvas?: boolean): Action;
9
- export {};
3
+ export declare function dropAndMerge(editor: Editor, mergeItems: any, action?: Action, resizeCanvas?: boolean): Action;
@@ -0,0 +1,46 @@
1
+ import Editor from '../Editor';
2
+ declare class RotateController {
3
+ private editor;
4
+ private rotateTool;
5
+ private originalCenter;
6
+ private normalizedCenterInitialHandleVec;
7
+ private handleCenter;
8
+ private initialRadius;
9
+ private isRotating;
10
+ private isMovingCenter;
11
+ private handle?;
12
+ private boundingRect?;
13
+ private cross?;
14
+ private link?;
15
+ private protractor?;
16
+ private rotateArc?;
17
+ constructor(editor: Editor);
18
+ private init;
19
+ private get render();
20
+ private get paper();
21
+ private get center();
22
+ rerender(): void;
23
+ clean(): void;
24
+ private isPartOfFragmentSelected;
25
+ private show;
26
+ private drawCross;
27
+ private drawBoundingRect;
28
+ private drawHandle;
29
+ private drawLink;
30
+ private drawProtractor;
31
+ private drawRotateArc;
32
+ private hoverIn;
33
+ private hoverOut;
34
+ private getProtractorBaseInfo;
35
+ private dragStart;
36
+ private dragMove;
37
+ private dragEnd;
38
+ private hoverCrossIn;
39
+ private hoverCrossOut;
40
+ private dragCrossStart;
41
+ private dragCrossMove;
42
+ private dragCrossEnd;
43
+ private dragCrossEndOUtOfBounding;
44
+ }
45
+ export default RotateController;
46
+ export declare const getDifference: (currentDegree: number, structRotateDegree: number) => number;
@@ -13,13 +13,21 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
+ import { Vec2 } from 'ketcher-core';
16
17
  import Editor from '../Editor';
17
18
  declare class RotateTool {
18
19
  editor: Editor;
19
20
  dragCtx: any;
20
21
  isNotActiveTool: boolean | undefined;
21
- constructor(editor: any, dir: any);
22
- mousedown(event: any): boolean;
22
+ constructor(editor: any, dir: any, isNotActiveTool?: boolean);
23
+ mousedown(event: any, handleCenter?: Vec2, center?: Vec2): boolean;
24
+ /**
25
+ * @returns `[center, visibleAtoms]`,
26
+ * `visibleAtoms` = selected atoms
27
+ * - atoms in contracted functional groups
28
+ * + functional groups's attachment atoms
29
+ */
30
+ getCenter(editor: Editor, event?: any): readonly [Vec2, number[]];
23
31
  mousemove(event: any): boolean;
24
32
  mouseup(): boolean;
25
33
  cancel(): void;
@@ -25,7 +25,7 @@ declare class SelectTool {
25
25
  mousemove(event: any): boolean;
26
26
  mouseup(event: any): void;
27
27
  dblclick(event: any): true | undefined;
28
- mouseleave(_: any): void;
28
+ mouseleave(): void;
29
29
  selectElementsOnCanvas(elements: {
30
30
  atoms: number[];
31
31
  bonds: number[];
@@ -1,3 +1,7 @@
1
+ import Editor from '../Editor';
1
2
  export declare const TOOLTIP_DELAY = 300;
2
- export declare function showTooltip(editor: any, infoPanelData: any): void;
3
- export declare function showFunctionalGroupsTooltip(editor: any): void;
3
+ export declare function setFunctionalGroupsTooltip({ editor, event, isShow }: {
4
+ editor: Editor;
5
+ event?: PointerEvent;
6
+ isShow: boolean;
7
+ }): void;
@@ -0,0 +1,16 @@
1
+ /****************************************************************************
2
+ * Copyright 2021 EPAM Systems
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 {};
@@ -26,6 +26,7 @@ declare type Props = {
26
26
  onError?: (err: any) => void;
27
27
  className?: string;
28
28
  title?: string;
29
+ disabled?: boolean;
29
30
  };
30
31
  declare type SaveButtonProps = PropsWithChildren<Props>;
31
32
  declare const SaveButton: (props: SaveButtonProps) => JSX.Element;
@@ -19,5 +19,5 @@ interface SaltsAndSolventsState {
19
19
  mode: string;
20
20
  }
21
21
  declare const saltsAndSolventsReducer: (state: SaltsAndSolventsState | undefined, { type, payload }: AnyAction) => any;
22
- export declare function initSaltsAndSolventsTemplates(): (dispatch: any, getState: any) => Promise<void>;
22
+ export declare function initSaltsAndSolventsTemplates(): (dispatch: any) => Promise<void>;
23
23
  export default saltsAndSolventsReducer;
@@ -1,3 +1,3 @@
1
1
  export default Editor;
2
- declare const Editor: import("react-redux").ConnectedComponent<typeof StructEditor, import("react-redux").Omit<any, "type" | "indigoVerification" | "options">>;
2
+ declare const Editor: import("react-redux").ConnectedComponent<typeof StructEditor, import("react-redux").Omit<any, "options" | "type" | "indigoVerification">>;
3
3
  import { StructEditor } from "./components";
@@ -1,5 +1,6 @@
1
1
  import { FunctionalGroup } from 'ketcher-core';
2
- import type { PredicateParams } from 'react-contexify';
2
+ import type { TriggerEvent, PredicateParams } from 'react-contexify';
3
+ import { Selection } from '../../../../editor/Editor';
3
4
  export declare enum CONTEXT_MENU_ID {
4
5
  FOR_BONDS = "context-menu-for-bonds",
5
6
  FOR_ATOMS = "context-menu-for-atoms",
@@ -12,8 +13,29 @@ export declare type ContextMenuShowProps = {
12
13
  functionalGroups?: FunctionalGroup[];
13
14
  bondIds?: number[];
14
15
  atomIds?: number[];
16
+ extraItemsSelected?: boolean;
15
17
  } | null;
18
+ export interface MenuItemsProps {
19
+ triggerEvent?: TriggerEvent;
20
+ propsFromTrigger?: ContextMenuShowProps;
21
+ }
16
22
  export declare type ItemEventParams = PredicateParams<ContextMenuShowProps, ItemData>;
17
23
  export declare type contextMenuInfo = {
18
24
  [id in CONTEXT_MENU_ID]?: boolean;
19
25
  };
26
+ export declare enum ContextMenuTriggerType {
27
+ None = "none",
28
+ Selection = "selection",
29
+ ClosestItem = "closestItem"
30
+ }
31
+ export interface ClosestItem {
32
+ id: number;
33
+ dist: number;
34
+ map: string;
35
+ }
36
+ export interface GetIsItemInSelectionArgs {
37
+ item: ClosestItem | null;
38
+ selection: Selection | null;
39
+ selectedFunctionalGroups: Map<number, FunctionalGroup>;
40
+ selectedSGroupsIds: Set<number>;
41
+ }
@@ -1,3 +1,4 @@
1
- /// <reference types="react" />
2
- declare const AtomMenuItems: React.FC;
1
+ import { FC } from 'react';
2
+ import { MenuItemsProps } from '../contextMenu.types';
3
+ declare const AtomMenuItems: FC<MenuItemsProps>;
3
4
  export default AtomMenuItems;
@@ -1,3 +1,4 @@
1
- /// <reference types="react" />
2
- declare const BondMenuItems: React.FC;
1
+ import { FC } from 'react';
2
+ import { MenuItemsProps } from '../contextMenu.types';
3
+ declare const BondMenuItems: FC<MenuItemsProps>;
3
4
  export default BondMenuItems;
@@ -1,3 +1,4 @@
1
- /// <reference types="react" />
2
- declare const FunctionalGroupMenuItems: React.FC;
1
+ import { FC } from 'react';
2
+ import { MenuItemsProps } from '../contextMenu.types';
3
+ declare const FunctionalGroupMenuItems: FC<MenuItemsProps>;
3
4
  export default FunctionalGroupMenuItems;
@@ -1,3 +1,4 @@
1
- /// <reference types="react" />
2
- declare const SelectionMenuItems: React.FC;
1
+ import { FC } from 'react';
2
+ import { MenuItemsProps } from '../contextMenu.types';
3
+ declare const SelectionMenuItems: FC<MenuItemsProps>;
3
4
  export default SelectionMenuItems;
@@ -22,4 +22,4 @@ export declare const queryBondNames: string[];
22
22
  */
23
23
  export declare const getNonQueryBondNames: (tools: any) => string[];
24
24
  export declare const noOperation: () => null;
25
- export declare function onlyHasProperty<T extends object>(checkedObject: T, key: keyof T): boolean;
25
+ export declare function onlyHasProperty<T extends object>(checkedObject: T, key: keyof T, ignoredProps?: string[]): boolean;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ketcher-react",
3
- "version": "2.10.0-rc.4",
3
+ "version": "2.11.0-rc.1",
4
4
  "description": "Web-based molecule sketcher",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "http://lifescience.opensource.epam.com/ketcher",