@ws-ui/roles-editor 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/Container.d.ts +2 -0
  2. package/dist/Dialogs/RemoveDialog.d.ts +7 -0
  3. package/dist/Dialogs/index.d.ts +2 -0
  4. package/dist/NavBar.d.ts +12 -0
  5. package/dist/Sidebar/Roles/RolePrivileges.d.ts +4 -0
  6. package/dist/Sidebar/Roles/index.d.ts +2 -0
  7. package/dist/Sidebar/Roles/rolesContext.d.ts +9 -0
  8. package/dist/Sidebar/index.d.ts +2 -0
  9. package/dist/Sidebar/withPortal.d.ts +3 -0
  10. package/dist/Sidebar/withResizableSidebar.d.ts +3 -0
  11. package/dist/Standalone/Modals.d.ts +2 -0
  12. package/dist/Standalone/index.d.ts +2 -0
  13. package/dist/Tabs/NoneSelected.d.ts +6 -0
  14. package/dist/Tabs/Privileges/Graph/ConnectionLine.d.ts +3 -0
  15. package/dist/Tabs/Privileges/Graph/Edge.d.ts +3 -0
  16. package/dist/Tabs/Privileges/Graph/graph.d.ts +8 -0
  17. package/dist/Tabs/Privileges/Graph/utils.d.ts +30 -0
  18. package/dist/Tabs/Privileges/Includes.d.ts +11 -0
  19. package/dist/Tabs/Privileges/NoneSelected.d.ts +3 -0
  20. package/dist/Tabs/Privileges/Sidebar.d.ts +9 -0
  21. package/dist/Tabs/Privileges/Table.d.ts +14 -0
  22. package/dist/Tabs/Privileges/Tree.d.ts +3 -0
  23. package/dist/Tabs/Privileges/helpers.d.ts +45 -0
  24. package/dist/Tabs/Privileges/index.d.ts +2 -0
  25. package/dist/Tabs/Roles/Card.d.ts +6 -0
  26. package/dist/Tabs/Roles/NoResults.d.ts +1 -0
  27. package/dist/Tabs/Roles/Row.d.ts +18 -0
  28. package/dist/Tabs/Roles/RowContainer.d.ts +13 -0
  29. package/dist/Tabs/Roles/Table.d.ts +5 -0
  30. package/dist/Tabs/Roles/index.d.ts +2 -0
  31. package/dist/Tabs/Roles/utils.d.ts +16 -0
  32. package/dist/Tabs/index.d.ts +3 -0
  33. package/dist/hooks/index.d.ts +1 -0
  34. package/dist/hooks/useRolesFlagsSync.d.ts +1 -0
  35. package/dist/index.cjs.js +72 -0
  36. package/dist/index.cjs.js.map +1 -0
  37. package/dist/index.d.ts +4 -0
  38. package/dist/index.es.js +27348 -0
  39. package/dist/index.es.js.map +1 -0
  40. package/dist/main.d.ts +1 -0
  41. package/dist/roles-editor.css +1 -0
  42. package/dist/types.d.ts +3 -0
  43. package/dist/vite.svg +1 -0
  44. package/package.json +58 -0
@@ -0,0 +1,2 @@
1
+ declare const Container: () => import("react/jsx-runtime").JSX.Element;
2
+ export default Container;
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+ interface IRemoveDialogDialog {
3
+ message: string;
4
+ onConfirm?: () => void;
5
+ }
6
+ declare const RemoveDialog: FC<IRemoveDialogDialog>;
7
+ export default RemoveDialog;
@@ -0,0 +1,2 @@
1
+ import { default as RemoveDialog } from './RemoveDialog';
2
+ export { RemoveDialog };
@@ -0,0 +1,12 @@
1
+ import { TabType } from './types';
2
+ interface INavbarProps {
3
+ qodly: boolean;
4
+ activeTab: TabType;
5
+ forceLogin?: boolean;
6
+ restrictedByDefault?: boolean;
7
+ onTabChange: (value: TabType) => void;
8
+ onRestrictedByDefaultChange: (value: boolean) => void;
9
+ onForceLoginChange: (value: boolean) => void;
10
+ }
11
+ export default function Navbar({ qodly, activeTab, forceLogin, onTabChange, restrictedByDefault, onRestrictedByDefaultChange, onForceLoginChange, }: INavbarProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,4 @@
1
+ import { TRolesDict } from '@ws-ui/store';
2
+ export declare const getRoleById: (id: string | null, roles: TRolesDict) => Required<import('@ws-ui/store').IRole> | null;
3
+ declare const RolePrivileges: React.FC;
4
+ export default RolePrivileges;
@@ -0,0 +1,2 @@
1
+ declare const _default: (props: {}) => import("react/jsx-runtime").JSX.Element;
2
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import { default as React, FC } from 'react';
2
+ interface ISelectedRole {
3
+ selectedRole: string | null;
4
+ selectRole: (role: string | null) => void;
5
+ }
6
+ export declare const SelectedRoleContext: React.Context<ISelectedRole | undefined>;
7
+ declare const SelectedRoleProvider: FC;
8
+ declare function useSelectedRole(): ISelectedRole;
9
+ export { SelectedRoleProvider, useSelectedRole };
@@ -0,0 +1,2 @@
1
+ import { default as RolesSidebar } from './Roles';
2
+ export { RolesSidebar };
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ declare const withPortal: (node: React.ReactNode, container?: Element | null) => React.ReactNode;
3
+ export default withPortal;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ declare function withResizableSidebar<T extends JSX.IntrinsicAttributes>(Component: React.ComponentType<T>, initialWidth?: number, maxWidth?: number, resizeDirection?: 'left' | 'right'): (props: T) => import("react/jsx-runtime").JSX.Element;
3
+ export default withResizableSidebar;
@@ -0,0 +1,2 @@
1
+ declare const Modals: () => import("react/jsx-runtime").JSX.Element;
2
+ export default Modals;
@@ -0,0 +1,2 @@
1
+ import { FC } from 'react';
2
+ export declare const Standalone: FC;
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ interface INoneSelectedProps {
3
+ tab: string;
4
+ }
5
+ declare const NoneSelected: React.FC<INoneSelectedProps>;
6
+ export default NoneSelected;
@@ -0,0 +1,3 @@
1
+ import { ConnectionLineComponent } from 'react-flow-renderer';
2
+ declare const ConnectionLine: ConnectionLineComponent;
3
+ export default ConnectionLine;
@@ -0,0 +1,3 @@
1
+ import { Edge } from 'react-flow-renderer';
2
+ declare const EdgeComponent: ({ id, source, target, markerEnd, style }: Edge) => import("react/jsx-runtime").JSX.Element | null;
3
+ export default EdgeComponent;
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ import { TById, IGraphData } from '@ws-ui/store';
3
+ declare const GraphComponent: FC<{
4
+ data: IGraphData;
5
+ dict: TById;
6
+ onSelect?: (selected: string) => void;
7
+ }>;
8
+ export default GraphComponent;
@@ -0,0 +1,30 @@
1
+ import { Position, MarkerType, Node } from 'react-flow-renderer';
2
+ export declare function getEdgeParams(source: Node, target: any): {
3
+ sx: any;
4
+ sy: any;
5
+ tx: any;
6
+ ty: any;
7
+ sourcePos: Position;
8
+ targetPos: Position;
9
+ };
10
+ export declare function createNodesAndEdges(): {
11
+ nodes: {
12
+ id: string;
13
+ data: {
14
+ label: string;
15
+ };
16
+ position: {
17
+ x: number;
18
+ y: number;
19
+ };
20
+ }[];
21
+ edges: {
22
+ id: string;
23
+ target: string;
24
+ source: string;
25
+ type: string;
26
+ markerEnd: {
27
+ type: MarkerType;
28
+ };
29
+ }[];
30
+ };
@@ -0,0 +1,11 @@
1
+ import { default as React } from 'react';
2
+ import { TById, TSanitizedPrivilege } from '@ws-ui/store';
3
+ interface IIncludesProps {
4
+ privileges: TById;
5
+ selectedPrivilege: TSanitizedPrivilege;
6
+ onSelect: (selected: string) => void;
7
+ setShowIncluded: (show: boolean) => void;
8
+ showIncluded: boolean;
9
+ }
10
+ declare const Includes: React.FC<IIncludesProps>;
11
+ export default Includes;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ declare const NoneSelected: React.FC;
3
+ export default NoneSelected;
@@ -0,0 +1,9 @@
1
+ import { TById, TSanitizedPrivilege } from '@ws-ui/store';
2
+ import { default as React } from 'react';
3
+ interface ISidebarProps {
4
+ privileges: TById;
5
+ selectPrivilege: (priv: TSanitizedPrivilege | null) => void;
6
+ selectedPrivilege: TSanitizedPrivilege | null;
7
+ }
8
+ declare const Sidebar: React.FC<ISidebarProps>;
9
+ export default Sidebar;
@@ -0,0 +1,14 @@
1
+ import { EPermissionType, IResource, TSanitizedPrivilege, TById } from '@ws-ui/store';
2
+ import { default as React } from 'react';
3
+ export interface IGroupedResource {
4
+ prefix: string;
5
+ type: EPermissionType;
6
+ resources: IResource[];
7
+ }
8
+ declare const Table: React.FC<{
9
+ selectedPrivilege: TSanitizedPrivilege;
10
+ onSelect: (selected: string) => void;
11
+ showIncluded?: boolean;
12
+ privileges: TById;
13
+ }>;
14
+ export default Table;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ declare const Tree: React.FC<any>;
3
+ export default Tree;
@@ -0,0 +1,45 @@
1
+ import { EPermissionType, ESubPermissionType, TById, TPermissionOption } from '@ws-ui/store';
2
+ export type PermissionType = EPermissionType;
3
+ export interface IPermission {
4
+ type: PermissionType;
5
+ applyTo: string;
6
+ }
7
+ export type TDataClassPermission = {
8
+ applyTo: string;
9
+ type: EPermissionType.DATACLASS;
10
+ methods: TPermissionOption[];
11
+ attributes: TPermissionOption[];
12
+ };
13
+ export type TSingletonPermission = {
14
+ applyTo: string;
15
+ type: EPermissionType.SINGLETON;
16
+ methods: TPermissionOption[];
17
+ attributes: TPermissionOption[];
18
+ };
19
+ export type TGroupedPermissions = {
20
+ [key: string]: {
21
+ applyTo: string;
22
+ type: EPermissionType.DATASTORE;
23
+ methods: TPermissionOption[];
24
+ dataClasses: TDataClassPermission[];
25
+ singletons: TSingletonPermission[];
26
+ };
27
+ };
28
+ export declare function search(keyword: string, methods?: any[], dataClasses?: any[], singletons?: any[]): TPermissionOption[];
29
+ export declare const groupPermissions: (methods?: any[], dataClasses?: any[], singletons?: any[]) => TGroupedPermissions;
30
+ export declare const checkMethodType: (privs: TById, dataClasses?: any[]) => TById;
31
+ export declare const checkPermissionsExist: (privileges: TById, catalog: datasources.IEnhancedCatalog) => {
32
+ [x: string]: {
33
+ resources: {
34
+ exists: boolean;
35
+ resource: string;
36
+ type: EPermissionType | ESubPermissionType;
37
+ subType?: ESubPermissionType;
38
+ permissions: import('@ws-ui/store').IResourcePermission[];
39
+ }[];
40
+ id: string;
41
+ privilege: string;
42
+ includes: string[];
43
+ parents: string[];
44
+ };
45
+ };
@@ -0,0 +1,2 @@
1
+ declare const PrivilegesTab: () => import("react/jsx-runtime").JSX.Element;
2
+ export default PrivilegesTab;
@@ -0,0 +1,6 @@
1
+ import { TRole } from '@ws-ui/store';
2
+ interface ICardProps {
3
+ role: TRole;
4
+ }
5
+ declare const Card: ({ role: initialRole }: ICardProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default Card;
@@ -0,0 +1 @@
1
+ export declare const NoResults: React.FC;
@@ -0,0 +1,18 @@
1
+ import { TById, TPermissionOption } from '@ws-ui/store';
2
+ export declare const Row: React.FC<{
3
+ privileges: {
4
+ rolePrivs: TById;
5
+ otherPrivs: TById;
6
+ };
7
+ permission: TPermissionOption;
8
+ hasChild?: boolean;
9
+ isChild?: boolean;
10
+ depth: number;
11
+ className?: string;
12
+ inSearch?: boolean;
13
+ toggleCollapse?: () => void;
14
+ collapsed?: boolean;
15
+ toastMessageCallback: () => void;
16
+ isRestrictedByDefault?: boolean;
17
+ allPrivileges?: any;
18
+ }>;
@@ -0,0 +1,13 @@
1
+ import { TById } from '@ws-ui/store';
2
+ import { TDataClassPermission, TSingletonPermission } from '../Privileges/helpers';
3
+ export declare const RowContainer: React.FC<{
4
+ depth: number;
5
+ permission: TDataClassPermission | TSingletonPermission;
6
+ privileges: {
7
+ rolePrivs: TById;
8
+ otherPrivs: TById;
9
+ };
10
+ childCollapsed?: boolean;
11
+ didChildCollapsed?: (status: boolean) => void;
12
+ toastMessageCallback: () => void;
13
+ }>;
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ declare const Table: React.FC<{
3
+ selectedRole: string;
4
+ }>;
5
+ export default Table;
@@ -0,0 +1,2 @@
1
+ declare const Roles: () => import("react/jsx-runtime").JSX.Element;
2
+ export default Roles;
@@ -0,0 +1,16 @@
1
+ import { TById, TPermissionOption } from '@ws-ui/store';
2
+ type PermissionResult = {
3
+ value: boolean;
4
+ inherited: boolean;
5
+ from: string[];
6
+ explicitly: boolean;
7
+ };
8
+ export declare const getPermissionsOfPrivs: (permission: TPermissionOption, otherPrivs: TById, rolePrivs: TById, isRestricted?: boolean) => {
9
+ read: PermissionResult;
10
+ create: PermissionResult;
11
+ update: PermissionResult;
12
+ drop: PermissionResult;
13
+ execute: PermissionResult;
14
+ promote: PermissionResult;
15
+ };
16
+ export {};
@@ -0,0 +1,3 @@
1
+ import { default as PrivilegesTab } from './Privileges';
2
+ import { default as RolesTab } from './Roles';
3
+ export { PrivilegesTab, RolesTab };
@@ -0,0 +1 @@
1
+ export * from './useRolesFlagsSync';
@@ -0,0 +1 @@
1
+ export declare function useRolesFlagsSync(): void;