@ws-ui/roles-editor 1.12.4 → 1.13.0-dev.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.
- package/dist/Sidebar/Roles/RolePrivileges.d.ts +2 -2
- package/dist/Standalone/index.d.ts +3 -2
- package/dist/Standalone/style.css +4 -1
- package/dist/Tabs/Privileges/Graph/graph.d.ts +1 -1
- package/dist/Tabs/Privileges/Includes.d.ts +1 -1
- package/dist/Tabs/Privileges/Sidebar.d.ts +1 -1
- package/dist/Tabs/Privileges/Table.d.ts +1 -1
- package/dist/Tabs/Privileges/helpers.d.ts +2 -2
- package/dist/Tabs/Roles/Card.d.ts +1 -1
- package/dist/Tabs/Roles/Row.d.ts +1 -1
- package/dist/Tabs/Roles/RowContainer.d.ts +1 -1
- package/dist/Tabs/Roles/utils.d.ts +1 -1
- package/dist/adapter/index.d.ts +8 -0
- package/dist/adapter/provider.d.ts +16 -0
- package/dist/adapter/reducer/adapter.d.ts +105 -0
- package/dist/adapter/reducer/use-modals.d.ts +18 -0
- package/dist/adapter/redux/adapter.d.ts +8 -0
- package/dist/adapter/types.d.ts +38 -0
- package/dist/common.cjs.js.map +1 -1
- package/dist/common.es.js.map +1 -1
- package/dist/index.cjs.js +76 -31
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +36191 -24638
- package/dist/index.es.js.map +1 -1
- package/dist/json-schema.json +181 -0
- package/dist/json-schema.json.d.ts +184 -0
- package/dist/roles-editor.css +1 -1
- package/package.json +12 -10
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { FC, ReactNode, Dispatch } from 'react';
|
|
2
|
+
import { ITabFlags, IModal, ModalCloseReason, TRolesDict, TById, TRawData, IRolesState } from '@ws-ui/shared';
|
|
3
|
+
import { IEditorStateAdapter } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Modal state interface
|
|
6
|
+
*/
|
|
7
|
+
interface IModalsState {
|
|
8
|
+
list: IModal[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Reducer state interface
|
|
12
|
+
* Extends IRolesState to include all necessary state
|
|
13
|
+
*/
|
|
14
|
+
interface IReducerState extends IRolesState {
|
|
15
|
+
modals: IModalsState;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Action types for the reducer
|
|
19
|
+
*/
|
|
20
|
+
type ReducerAction = {
|
|
21
|
+
type: 'UPDATE_ROLES';
|
|
22
|
+
payload: TRolesDict;
|
|
23
|
+
} | {
|
|
24
|
+
type: 'UPDATE_PRIVILEGES';
|
|
25
|
+
payload: TById;
|
|
26
|
+
} | {
|
|
27
|
+
type: 'SET_ROLES_CONTENT';
|
|
28
|
+
payload: {
|
|
29
|
+
content: TRawData;
|
|
30
|
+
date?: string;
|
|
31
|
+
flags?: ITabFlags;
|
|
32
|
+
};
|
|
33
|
+
} | {
|
|
34
|
+
type: 'TOGGLE_TAB';
|
|
35
|
+
payload: 'privileges' | 'roles';
|
|
36
|
+
} | {
|
|
37
|
+
type: 'TOGGLE_FORCE_LOGIN';
|
|
38
|
+
payload: boolean;
|
|
39
|
+
} | {
|
|
40
|
+
type: 'TOGGLE_RESTRICTED_BY_DEFAULT';
|
|
41
|
+
payload: boolean;
|
|
42
|
+
} | {
|
|
43
|
+
type: 'SET_FLAGS';
|
|
44
|
+
payload: ITabFlags;
|
|
45
|
+
} | {
|
|
46
|
+
type: 'CREATE_MODAL';
|
|
47
|
+
payload: IModal;
|
|
48
|
+
} | {
|
|
49
|
+
type: 'REMOVE_MODAL';
|
|
50
|
+
payload: string;
|
|
51
|
+
} | {
|
|
52
|
+
type: 'CLOSE_MODAL';
|
|
53
|
+
payload: {
|
|
54
|
+
id: string;
|
|
55
|
+
reason?: ModalCloseReason;
|
|
56
|
+
};
|
|
57
|
+
} | {
|
|
58
|
+
type: 'EDIT_MODAL';
|
|
59
|
+
payload: {
|
|
60
|
+
id: string;
|
|
61
|
+
} & Partial<Pick<IModal, 'views' | 'title'>>;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* External data interface
|
|
65
|
+
*/
|
|
66
|
+
interface IExternalData {
|
|
67
|
+
catalog?: datasources.IEnhancedCatalog | null;
|
|
68
|
+
qodly?: boolean;
|
|
69
|
+
onSetTabFlags?: (path: string, flags: ITabFlags) => void;
|
|
70
|
+
}
|
|
71
|
+
interface IReducerAdapterExternalProps {
|
|
72
|
+
catalog?: datasources.ICatalog | null;
|
|
73
|
+
qodly?: boolean;
|
|
74
|
+
onSetTabFlags?: (path: string, flags: ITabFlags) => void;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Reducer value interface
|
|
78
|
+
*/
|
|
79
|
+
interface IReducerValue {
|
|
80
|
+
state: IReducerState;
|
|
81
|
+
dispatch: Dispatch<ReducerAction>;
|
|
82
|
+
external: IExternalData;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* External data interface for props
|
|
86
|
+
*/
|
|
87
|
+
export interface IReducerAdapterProps extends IReducerAdapterExternalProps {
|
|
88
|
+
children: ReactNode;
|
|
89
|
+
initialState?: Partial<IReducerState>;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Context for editor state
|
|
93
|
+
*/
|
|
94
|
+
export declare const EditorStateContext: import('react').Context<IReducerValue | null>;
|
|
95
|
+
/**
|
|
96
|
+
* Provider component for the reducer adapter
|
|
97
|
+
*/
|
|
98
|
+
export declare const ReducerAdapterProvider: FC<IReducerAdapterProps>;
|
|
99
|
+
/**
|
|
100
|
+
* Hook to access the reducer adapter
|
|
101
|
+
*
|
|
102
|
+
* @throws Error if used outside of ReducerAdapterProvider
|
|
103
|
+
*/
|
|
104
|
+
export declare function useReducerAdapter(): IEditorStateAdapter;
|
|
105
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IModal, ModalCloseReason } from '@ws-ui/shared';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to access modal state and actions for rendering modals
|
|
4
|
+
*
|
|
5
|
+
* This hook provides access to the modals list and functions to close/edit modals.
|
|
6
|
+
* Use this in a Modals component to render and manage modals.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useModals(): {
|
|
9
|
+
modals: IModal[];
|
|
10
|
+
closeModal: (params: {
|
|
11
|
+
id: string;
|
|
12
|
+
reason?: ModalCloseReason;
|
|
13
|
+
}) => void;
|
|
14
|
+
editModal: (params: {
|
|
15
|
+
id: string;
|
|
16
|
+
} & Partial<Pick<IModal, "views" | "title">>) => void;
|
|
17
|
+
removeModal: (id: string) => void;
|
|
18
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IEditorStateAdapter } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook-based Redux adapter implementation
|
|
4
|
+
*
|
|
5
|
+
* This adapter uses React hooks to access Redux state and dispatch actions.
|
|
6
|
+
* It should be used within React components.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useReduxAdapter(): IEditorStateAdapter;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ITabFlags, TRolesDict, TSanitizedPrivilege, TById, TRawData, IOpenModalPayload, IOpenModalReturnValue, TEditorAdapter } from '@ws-ui/shared';
|
|
2
|
+
/**
|
|
3
|
+
* Editor State Adapter Interface
|
|
4
|
+
*
|
|
5
|
+
* This interface defines all operations that editors need to interact with state.
|
|
6
|
+
* Implementations can use Redux, local state, or any other state management solution.
|
|
7
|
+
*/
|
|
8
|
+
type TEditorStateGetters = {
|
|
9
|
+
getRoles(): TRolesDict;
|
|
10
|
+
getPrivileges(): TById;
|
|
11
|
+
getRolesFlags(): ITabFlags;
|
|
12
|
+
getRolesAndPrivileges(): TRawData;
|
|
13
|
+
getCatalog(): datasources.IEnhancedCatalog | null;
|
|
14
|
+
getQodly(): boolean;
|
|
15
|
+
getSelectedTab(): 'privileges' | 'roles';
|
|
16
|
+
getForceLogin(): boolean;
|
|
17
|
+
getRestrictedByDefault(): boolean;
|
|
18
|
+
getGuestPrivilege(): TSanitizedPrivilege | null;
|
|
19
|
+
getCatalogMethods(): catalog.IMethod[];
|
|
20
|
+
getDataclasses(): datasources.IDataClasses;
|
|
21
|
+
getSingletons(): datasources.ISingletons;
|
|
22
|
+
};
|
|
23
|
+
type TEditorStateActions = {
|
|
24
|
+
updateRoles(roles: TRolesDict): void;
|
|
25
|
+
updatePrivileges(privileges: TById): void;
|
|
26
|
+
setRolesContent(content: {
|
|
27
|
+
content: TRawData;
|
|
28
|
+
date?: string;
|
|
29
|
+
flags?: ITabFlags;
|
|
30
|
+
}): void;
|
|
31
|
+
toggleTab(tab: 'privileges' | 'roles'): void;
|
|
32
|
+
toggleForceLogin(value: boolean): void;
|
|
33
|
+
toggleRestrictedByDefault(value: boolean): void;
|
|
34
|
+
setTabFlags(path: string, flags: ITabFlags): void;
|
|
35
|
+
openModal(config: IOpenModalPayload): Promise<IOpenModalReturnValue>;
|
|
36
|
+
};
|
|
37
|
+
export type IEditorStateAdapter = TEditorAdapter<TEditorStateGetters, TEditorStateActions>;
|
|
38
|
+
export {};
|
package/dist/common.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.cjs.js","sources":["../src/common.ts"],"sourcesContent":["export const ROLES_EDITOR_SCOPE_CLASS = 'qodly-roles-editor';\n"],"names":["ROLES_EDITOR_SCOPE_CLASS"],"mappings":"gFAAO,MAAMA,EAA2B"}
|
|
1
|
+
{"version":3,"file":"common.cjs.js","sources":["../src/common.ts"],"sourcesContent":["export const ROLES_EDITOR_SCOPE_CLASS = 'qodly-roles-editor';\r\n"],"names":["ROLES_EDITOR_SCOPE_CLASS"],"mappings":"gFAAO,MAAMA,EAA2B"}
|
package/dist/common.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.es.js","sources":["../src/common.ts"],"sourcesContent":["export const ROLES_EDITOR_SCOPE_CLASS = 'qodly-roles-editor';\n"],"names":["ROLES_EDITOR_SCOPE_CLASS"],"mappings":"AAAO,MAAMA,IAA2B;"}
|
|
1
|
+
{"version":3,"file":"common.es.js","sources":["../src/common.ts"],"sourcesContent":["export const ROLES_EDITOR_SCOPE_CLASS = 'qodly-roles-editor';\r\n"],"names":["ROLES_EDITOR_SCOPE_CLASS"],"mappings":"AAAO,MAAMA,IAA2B;"}
|