@ws-ui/store 0.1.0 → 0.1.2

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 (89) hide show
  1. package/README.md +3 -1
  2. package/dist/hooks/index.d.ts +1 -0
  3. package/dist/hooks/store.d.ts +94 -0
  4. package/dist/index.cjs.js +157 -0
  5. package/dist/index.cjs.js.map +1 -0
  6. package/dist/index.d.ts +6 -86
  7. package/dist/index.es.js +15729 -0
  8. package/dist/index.es.js.map +1 -0
  9. package/dist/modules/catalog/index.d.ts +13 -0
  10. package/dist/modules/catalog/reducer.d.ts +20 -0
  11. package/dist/modules/catalog/thunks.d.ts +4 -0
  12. package/dist/modules/catalog/types.d.ts +1 -0
  13. package/dist/modules/debugger/index.d.ts +6 -0
  14. package/dist/modules/debugger/reducer.d.ts +121 -0
  15. package/dist/modules/debugger/thunks.d.ts +11 -0
  16. package/dist/modules/debugger/types.d.ts +226 -0
  17. package/dist/modules/debugger/utils.d.ts +3 -0
  18. package/dist/modules/explorer/index.d.ts +6 -0
  19. package/dist/modules/explorer/reducer.d.ts +38 -0
  20. package/dist/modules/explorer/thunks.d.ts +263 -0
  21. package/dist/modules/explorer/types.d.ts +56 -0
  22. package/dist/modules/explorer/utils.d.ts +4 -0
  23. package/dist/modules/index.d.ts +52 -0
  24. package/dist/modules/modals/index.d.ts +5 -0
  25. package/dist/modules/modals/reducer.d.ts +17 -0
  26. package/dist/modules/modals/thunks.d.ts +12 -0
  27. package/dist/modules/modals/types.d.ts +69 -0
  28. package/dist/modules/model/helpers.d.ts +12 -0
  29. package/dist/modules/model/index.d.ts +8 -0
  30. package/dist/modules/model/reducer.d.ts +33 -0
  31. package/dist/modules/model/selectors.d.ts +12 -0
  32. package/dist/modules/model/subjects.d.ts +6 -0
  33. package/dist/modules/model/thunks.d.ts +55 -0
  34. package/dist/modules/model/types.d.ts +97 -0
  35. package/dist/modules/roles/__tests__/adapter.test.d.ts +1 -0
  36. package/dist/modules/roles/adapter.d.ts +179 -0
  37. package/dist/modules/roles/index.d.ts +21 -0
  38. package/dist/modules/roles/reducer.d.ts +64 -0
  39. package/dist/modules/roles/thunks.d.ts +24 -0
  40. package/dist/modules/roles/types.d.ts +86 -0
  41. package/dist/modules/root/index.d.ts +5 -0
  42. package/dist/modules/root/reducer.d.ts +153 -0
  43. package/dist/modules/root/thunks.d.ts +117 -0
  44. package/dist/modules/root/types.d.ts +59 -0
  45. package/dist/modules/settings/index.d.ts +5 -0
  46. package/dist/modules/settings/reducer.d.ts +45 -0
  47. package/dist/modules/settings/thunks.d.ts +7 -0
  48. package/dist/modules/settings/types.d.ts +7 -0
  49. package/dist/modules/settings/utils.d.ts +2 -0
  50. package/dist/modules/shared-css/index.d.ts +5 -0
  51. package/dist/modules/shared-css/reducer.d.ts +21 -0
  52. package/dist/modules/shared-css/thunks.d.ts +6 -0
  53. package/dist/modules/shared-css/types.d.ts +1 -0
  54. package/dist/modules/shared-datasources/index.d.ts +5 -0
  55. package/dist/modules/shared-datasources/reducer.d.ts +18 -0
  56. package/dist/modules/shared-datasources/thunks.d.ts +32 -0
  57. package/dist/modules/shared-datasources/types.d.ts +1 -0
  58. package/dist/modules/tabs/index.d.ts +5 -0
  59. package/dist/modules/tabs/reducer.d.ts +4 -0
  60. package/dist/modules/tabs/selectors.d.ts +64 -0
  61. package/dist/modules/tabs/types.d.ts +1 -0
  62. package/dist/modules/webforms/datasources.adapter.d.ts +40 -0
  63. package/dist/modules/webforms/index.d.ts +6 -0
  64. package/dist/modules/webforms/private.d.ts +3 -0
  65. package/dist/modules/webforms/reducer.d.ts +53 -0
  66. package/dist/modules/webforms/thunks.d.ts +58 -0
  67. package/dist/modules/webforms/types.d.ts +71 -0
  68. package/dist/provider.d.ts +5 -0
  69. package/dist/selectors/catalog.d.ts +234 -0
  70. package/dist/selectors/common.d.ts +146 -0
  71. package/dist/selectors/components.d.ts +70 -0
  72. package/dist/selectors/datasources.d.ts +262 -0
  73. package/dist/selectors/debugger.d.ts +922 -0
  74. package/dist/selectors/explorer.d.ts +1352 -0
  75. package/dist/selectors/index.d.ts +12 -0
  76. package/dist/selectors/modals.d.ts +41 -0
  77. package/dist/selectors/roles.d.ts +471 -0
  78. package/dist/selectors/settings.d.ts +337 -0
  79. package/dist/selectors/styles.d.ts +234 -0
  80. package/dist/selectors/tabs.d.ts +72 -0
  81. package/dist/selectors/webforms.d.ts +450 -0
  82. package/dist/store.d.ts +10 -0
  83. package/dist/utils.d.ts +16 -0
  84. package/package.json +46 -20
  85. package/dist/index.d.ts.map +0 -1
  86. package/dist/index.js +0 -168
  87. package/dist/index.js.map +0 -1
  88. package/dist/index.module.js +0 -167
  89. package/dist/index.module.js.map +0 -1
@@ -0,0 +1,263 @@
1
+ /// <reference types="@ws-ui/shared/dist/declarations/datasources/interfaces/catalog" />
2
+ /// <reference types="@ws-ui/shared/dist/declarations/datasources/interfaces/dataclass-attribute" />
3
+ import { Action, ThunkDispatch } from '@reduxjs/toolkit';
4
+ import { FileFolderType, IFileInfo, ISaveFileResponse, ISetFileContentResponse, ITextEditorSelection } from '@ws-ui/shared';
5
+ import { ITab } from '@ws-ui/shared';
6
+ import { ClassFileTypes } from '../../modules/root/types';
7
+ import { AppState } from '..';
8
+ import { ISettingsState } from '../settings';
9
+ import { ITreeItem } from './types';
10
+ interface ICreateNewFilePayload {
11
+ fileName: string;
12
+ type: FileFolderType;
13
+ path: string;
14
+ parentNode: ITreeItem;
15
+ content?: string;
16
+ qodly: boolean;
17
+ }
18
+ export declare function getDefaultContent(root: FileFolderType, projectSettings: ISettingsState['project']): "" | {
19
+ metadata: {
20
+ v: string;
21
+ datasources: never[];
22
+ styles: never[];
23
+ };
24
+ components: {
25
+ ROOT: {
26
+ parent: string;
27
+ type: {
28
+ resolvedName: string;
29
+ };
30
+ isCanvas: boolean;
31
+ props: {
32
+ airyMode: boolean;
33
+ className: string;
34
+ classNames: never[];
35
+ events: never[];
36
+ };
37
+ displayName: string;
38
+ custom: {};
39
+ hidden: boolean;
40
+ nodes: never[];
41
+ linkedNodes: {};
42
+ };
43
+ };
44
+ } | "//%attributes = {}\n";
45
+ export declare function getFilenameFromType(fileName: string, type: FileFolderType, qodly?: boolean): string;
46
+ export declare function castToFileFolder(type: string): FileFolderType;
47
+ export declare function getFileType(root: FileFolderType): FileFolderType;
48
+ export declare const tryEditMethod: import("@reduxjs/toolkit").AsyncThunk<ITab<any, Partial<{
49
+ initialLineInfo: {
50
+ line: number;
51
+ offset?: number | undefined;
52
+ lastModification: number;
53
+ };
54
+ initialSelectionInfo: {
55
+ selection: ITextEditorSelection;
56
+ lastModification: number;
57
+ };
58
+ diffContent: string;
59
+ attributes: import("@ws-ui/shared").IMethodAttributes;
60
+ source: import("@ws-ui/shared").ISource;
61
+ editor: import("@ws-ui/shared").IEditor;
62
+ ext: import("@ws-ui/shared").DebuggerFileExtension;
63
+ }>>, {
64
+ method: catalog.IMethod;
65
+ }, {
66
+ state: AppState;
67
+ }>;
68
+ export declare const createModelFiles: import("@reduxjs/toolkit").AsyncThunk<void, {
69
+ type: 'dataclass';
70
+ className: string;
71
+ collectionName: string;
72
+ toCreate?: ClassFileTypes | undefined;
73
+ } | {
74
+ type: 'model';
75
+ }, {
76
+ state: AppState;
77
+ }>;
78
+ export declare const fetchFolderContent: import("@reduxjs/toolkit").AsyncThunk<ITreeItem[], string, {}>;
79
+ export declare const fetchFolderContentWithoutExpanding: import("@reduxjs/toolkit").AsyncThunk<ITreeItem[], string, {}>;
80
+ export declare const uploadFileAndGetResponse: import("@reduxjs/toolkit").AsyncThunk<{
81
+ status: number;
82
+ data: any;
83
+ }, File, {}>;
84
+ export declare const uploadFile: import("@reduxjs/toolkit").AsyncThunk<{
85
+ status: number;
86
+ fileName: string;
87
+ }, {
88
+ file: File;
89
+ path: string;
90
+ parentNode: ITreeItem;
91
+ }, {}>;
92
+ export declare const createNewFile: import("@reduxjs/toolkit").AsyncThunk<{
93
+ qodly: boolean;
94
+ file: ISetFileContentResponse;
95
+ parentNode: ITreeItem;
96
+ }, ICreateNewFilePayload, {
97
+ state: AppState;
98
+ rejectValue: string;
99
+ }>;
100
+ /**
101
+ * Returns the file path of the given file object based on its type.
102
+ *
103
+ * @param {ISaveFileResponse} file - The file object to get the path for.
104
+ * @param {Partial<{ withExtension: boolean; qodly: boolean }>} [options] - Optional parameters object.
105
+ * @param {boolean} [options.withExtension=true] - Whether to include the file extension in the path.
106
+ * @param {boolean} [options.qodly=true] - Whether to use the qodly file extension instead of the standard one.
107
+ * @return {string} The file path with or without extension, based on the options.
108
+ */
109
+ export declare function getFilePath(file: ISaveFileResponse, options?: Partial<{
110
+ withExtension: boolean;
111
+ qodly: boolean;
112
+ }>): string;
113
+ export declare const createNewFileAndOpen: import("@reduxjs/toolkit").AsyncThunk<void, ICreateNewFilePayload, {
114
+ dispatch: ThunkDispatch<any, void, Action>;
115
+ }>;
116
+ export declare const createNewNode: import("@reduxjs/toolkit").AsyncThunk<{
117
+ file: import("@ws-ui/shared").IAddFolderResponse;
118
+ parentNode: ITreeItem;
119
+ }, {
120
+ fileName: string;
121
+ type: FileFolderType;
122
+ path: string;
123
+ parentNode: ITreeItem;
124
+ }, {}>;
125
+ export declare const openFile: import("@reduxjs/toolkit").AsyncThunk<ITab<any, Partial<{
126
+ initialLineInfo: {
127
+ line: number;
128
+ offset?: number | undefined;
129
+ lastModification: number;
130
+ };
131
+ initialSelectionInfo: {
132
+ selection: ITextEditorSelection;
133
+ lastModification: number;
134
+ };
135
+ diffContent: string;
136
+ attributes: import("@ws-ui/shared").IMethodAttributes;
137
+ source: import("@ws-ui/shared").ISource;
138
+ editor: import("@ws-ui/shared").IEditor;
139
+ ext: import("@ws-ui/shared").DebuggerFileExtension;
140
+ }>> | null, {
141
+ file: IFileInfo;
142
+ inactive?: boolean | undefined;
143
+ isNew?: boolean | undefined;
144
+ flags?: Pick<Partial<{
145
+ touched: boolean;
146
+ removed: boolean;
147
+ pinned: boolean;
148
+ loading: boolean;
149
+ old: boolean;
150
+ enabled: boolean;
151
+ confirmed: boolean;
152
+ }>, "pinned" | "loading" | "enabled" | "confirmed"> | undefined;
153
+ }, {
154
+ state: AppState;
155
+ }>;
156
+ export declare const openFileAtLine: import("@reduxjs/toolkit").AsyncThunk<ITab<any, Partial<{
157
+ initialLineInfo: {
158
+ line: number;
159
+ offset?: number | undefined;
160
+ lastModification: number;
161
+ };
162
+ initialSelectionInfo: {
163
+ selection: ITextEditorSelection;
164
+ lastModification: number;
165
+ };
166
+ diffContent: string;
167
+ attributes: import("@ws-ui/shared").IMethodAttributes;
168
+ source: import("@ws-ui/shared").ISource;
169
+ editor: import("@ws-ui/shared").IEditor;
170
+ ext: import("@ws-ui/shared").DebuggerFileExtension;
171
+ }>>, {
172
+ file: IFileInfo;
173
+ line: number;
174
+ offset?: number | undefined;
175
+ }, {
176
+ state: AppState;
177
+ }>;
178
+ export declare const injectContentAtLine: import("@reduxjs/toolkit").AsyncThunk<{
179
+ path: string;
180
+ content: string;
181
+ line: number;
182
+ }, {
183
+ path: string;
184
+ content: string;
185
+ line: number;
186
+ }, {}>;
187
+ export interface IOpenFileAtSelectionPayload {
188
+ file: IFileInfo;
189
+ selection: ITextEditorSelection;
190
+ }
191
+ export declare const openFileAtSelection: import("@reduxjs/toolkit").AsyncThunk<ITab<any, Partial<{
192
+ initialLineInfo: {
193
+ line: number;
194
+ offset?: number | undefined;
195
+ lastModification: number;
196
+ };
197
+ initialSelectionInfo: {
198
+ selection: ITextEditorSelection;
199
+ lastModification: number;
200
+ };
201
+ diffContent: string;
202
+ attributes: import("@ws-ui/shared").IMethodAttributes;
203
+ source: import("@ws-ui/shared").ISource;
204
+ editor: import("@ws-ui/shared").IEditor;
205
+ ext: import("@ws-ui/shared").DebuggerFileExtension;
206
+ }>>, IOpenFileAtSelectionPayload, {
207
+ state: AppState;
208
+ }>;
209
+ export declare const deleteFile: import("@reduxjs/toolkit").AsyncThunk<{
210
+ deleted: boolean;
211
+ node: ITreeItem;
212
+ }, ITreeItem, {
213
+ state: AppState;
214
+ }>;
215
+ export declare const deleteFolder: import("@reduxjs/toolkit").AsyncThunk<{
216
+ deleted: boolean;
217
+ node: ITreeItem;
218
+ }, ITreeItem, {
219
+ state: AppState;
220
+ }>;
221
+ export declare const removeFileNode: import("@reduxjs/toolkit").AsyncThunk<{
222
+ deleted: boolean;
223
+ node: ITreeItem;
224
+ }, ITreeItem, {
225
+ state: AppState;
226
+ }>;
227
+ export declare const renameFile: import("@reduxjs/toolkit").AsyncThunk<{
228
+ old: ITreeItem;
229
+ new: ITreeItem;
230
+ }, {
231
+ file: ITreeItem;
232
+ newname: string;
233
+ }, {
234
+ state: AppState;
235
+ }>;
236
+ export declare const relocateNode: import("@reduxjs/toolkit").AsyncThunk<void, {
237
+ draggedNode: ITreeItem;
238
+ newLocation: ITreeItem;
239
+ }, {
240
+ state: AppState;
241
+ }>;
242
+ export declare const duplicateNode: import("@reduxjs/toolkit").AsyncThunk<any, any, {
243
+ state: AppState;
244
+ }>;
245
+ export declare const executeMethod: import("@reduxjs/toolkit").AsyncThunk<void | {
246
+ [refName: string]: datasources.IComponentAction;
247
+ }, {
248
+ methodName: string;
249
+ namespace?: string | undefined;
250
+ params?: {
251
+ name: string;
252
+ namespace?: string | undefined;
253
+ isHardCoded?: boolean | undefined;
254
+ type?: 'string' | 'number' | 'object' | 'date' | 'array' | 'bool' | undefined;
255
+ }[] | undefined;
256
+ resultingDataSource?: {
257
+ id?: string | undefined;
258
+ namespace?: string | undefined;
259
+ } | undefined;
260
+ }, {
261
+ state: AppState;
262
+ }>;
263
+ export {};
@@ -0,0 +1,56 @@
1
+ import { FileFolderType, IEditor } from '@ws-ui/shared';
2
+ export interface ITreeItem {
3
+ name: string;
4
+ path: string;
5
+ children?: ITreeItem[];
6
+ type: FileFolderType;
7
+ date?: string;
8
+ size?: number;
9
+ ext?: string;
10
+ error: null | {
11
+ message: string;
12
+ };
13
+ flags: {
14
+ [key: string]: boolean;
15
+ };
16
+ tipKey?: string;
17
+ config: {
18
+ editor?: IEditor;
19
+ supportedEditors?: IEditor[];
20
+ };
21
+ isRoot?: boolean;
22
+ }
23
+ export interface INodePermissions {
24
+ canRemove: boolean;
25
+ canAdd: boolean;
26
+ canMove: boolean;
27
+ canRename: boolean;
28
+ canDownload: boolean;
29
+ canUpload: boolean;
30
+ canReload: boolean;
31
+ canAddFolder: boolean;
32
+ canDuplicate: boolean;
33
+ canDrag: boolean;
34
+ canDragIn: boolean;
35
+ canTerminate: boolean;
36
+ canRender: boolean;
37
+ canExecute: boolean;
38
+ }
39
+ export interface INodeFlags {
40
+ hidden: boolean;
41
+ disabled: boolean;
42
+ }
43
+ export interface INodeAttributes {
44
+ flags: Partial<INodeFlags>;
45
+ permissions: Partial<INodePermissions>;
46
+ }
47
+ export interface IEditors {
48
+ pattern: string;
49
+ editor: IEditor;
50
+ supportedEditors?: IEditor[];
51
+ }
52
+ export declare const editors: IEditors[];
53
+ export declare const extensions: {
54
+ pattern: string;
55
+ type: 'json' | 'text';
56
+ }[];
@@ -0,0 +1,4 @@
1
+ import { IEditors } from './types';
2
+ export declare function getNodeRelativePath(nodePath: string): string;
3
+ export declare function getEditors(path: string): IEditors;
4
+ export declare function getExtension(path: string): "json" | "text";
@@ -0,0 +1,52 @@
1
+ /// <reference types="@ws-ui/shared/dist/declarations/datasources/datasource" />
2
+ import rootReducer from './root';
3
+ export declare const stateReducer: import("redux").Reducer<import("redux").CombinedState<{
4
+ root: import("immer/dist/internal.js").WritableDraft<import("./root").IRootState>;
5
+ explorer: import("immer/dist/internal.js").WritableDraft<import("./explorer").ITreeItem>[];
6
+ debugger: import("./debugger").IDebuggerState;
7
+ settings: import("./settings").ISettingsState;
8
+ catalog: {
9
+ state: "loading";
10
+ } | {
11
+ state: "loaded";
12
+ model: datasources.IEnhancedCatalog;
13
+ } | {
14
+ state: "error";
15
+ error: string;
16
+ };
17
+ roles: {
18
+ flags: {
19
+ touched?: boolean | undefined;
20
+ removed?: boolean | undefined;
21
+ pinned?: boolean | undefined;
22
+ loading?: boolean | undefined;
23
+ old?: boolean | undefined;
24
+ enabled?: boolean | undefined;
25
+ confirmed?: boolean | undefined;
26
+ };
27
+ date?: string | undefined;
28
+ privileges: import("./roles").TById;
29
+ roles: import("./roles").TRolesDict;
30
+ forceLogin?: boolean | undefined;
31
+ selectedTab: "roles" | "privileges";
32
+ };
33
+ sharedDatasources: import("./shared-datasources").ISharedDatasourcesState;
34
+ webforms: import("./webforms").IWebformEditorState;
35
+ modals: import("./modals").IModalsState;
36
+ sharedCSS: import("immer/dist/internal.js").WritableDraft<import("./shared-css").ISharedCSSState>;
37
+ model: import("./model").IModelState;
38
+ }>, import("redux").AnyAction>;
39
+ export { rootReducer };
40
+ export type AppState = ReturnType<typeof stateReducer>;
41
+ export * from './catalog';
42
+ export * from './debugger';
43
+ export * from './explorer';
44
+ export * from './modals';
45
+ export * from './model';
46
+ export * from './roles';
47
+ export * from './root';
48
+ export * from './settings';
49
+ export * from './shared-css';
50
+ export * from './shared-datasources';
51
+ export * from './tabs';
52
+ export * from './webforms';
@@ -0,0 +1,5 @@
1
+ declare const _default: import("redux").Reducer<import("./reducer").IModalsState>;
2
+ export default _default;
3
+ export * from './reducer';
4
+ export * from './thunks';
5
+ export * from './types';
@@ -0,0 +1,17 @@
1
+ import { ICloseModalAction, ICreateModalAction, IEditModalAction, IModal, IRemoveModalAction } from './types';
2
+ export interface IModalsState {
3
+ list: IModal[];
4
+ }
5
+ declare const stateSlice: import("@reduxjs/toolkit").Slice<IModalsState, {
6
+ createModal: (state: import("immer/dist/internal.js").WritableDraft<IModalsState>, action: ICreateModalAction) => void;
7
+ editModal: (state: import("immer/dist/internal.js").WritableDraft<IModalsState>, action: IEditModalAction) => void;
8
+ removeModal: (state: import("immer/dist/internal.js").WritableDraft<IModalsState>, action: IRemoveModalAction) => void;
9
+ closeModal: (state: import("immer/dist/internal.js").WritableDraft<IModalsState>, action: ICloseModalAction) => void;
10
+ }, "modals">;
11
+ export declare const createModal: import("@reduxjs/toolkit").ActionCreatorWithPayload<IModal, string>, removeModal: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, closeModal: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
12
+ id: string;
13
+ reason?: import("./types").ModalCloseReason | undefined;
14
+ }, string>, editModal: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
15
+ id: string;
16
+ } & Partial<Pick<IModal, "views" | "title">>, string>;
17
+ export default stateSlice;
@@ -0,0 +1,12 @@
1
+ import { Store } from '../../store';
2
+ import { IModal, ModalType } from './types';
3
+ interface IOpenModalPayload extends Omit<IModal, 'id' | 'isOpen' | 'type'> {
4
+ type?: ModalType;
5
+ store?: Store;
6
+ }
7
+ interface IOpenModalReturnValue {
8
+ confirmed?: boolean;
9
+ options?: Record<string, boolean>;
10
+ }
11
+ export declare const openModal: import("@reduxjs/toolkit").AsyncThunk<IOpenModalReturnValue, IOpenModalPayload, {}>;
12
+ export {};
@@ -0,0 +1,69 @@
1
+ /// <reference types="react" />
2
+ import { PayloadAction } from '@reduxjs/toolkit';
3
+ export declare const ModalIcons: {
4
+ FdSave: (props: import("react").SVGProps<SVGSVGElement>) => JSX.Element;
5
+ FdWarningDanger: (props: import("react").SVGProps<SVGSVGElement>) => JSX.Element;
6
+ FdInfoCircle: (props: import("react").SVGProps<SVGSVGElement>) => JSX.Element;
7
+ FdInfoBold: (props: import("react").SVGProps<SVGSVGElement>) => JSX.Element;
8
+ };
9
+ export type ModalIcon = keyof typeof ModalIcons;
10
+ export declare enum ModalType {
11
+ ALERT = "alert",
12
+ CONFIRM = "confirm"
13
+ }
14
+ export declare enum ModalColor {
15
+ PRIMARY = "primary",
16
+ WARNING = "warning",
17
+ DANGER = "danger"
18
+ }
19
+ export declare enum ModalCloseReason {
20
+ CONFIRMED = "confirmed",
21
+ CANCELED = "canceled"
22
+ }
23
+ export interface IModal {
24
+ /**
25
+ * Id of the modal
26
+ */
27
+ id: string;
28
+ type: ModalType;
29
+ color?: ModalColor;
30
+ /**
31
+ * title displayed at the header of the modal
32
+ */
33
+ title?: string;
34
+ /**
35
+ * The message to be displayed at the center of the modal.
36
+ */
37
+ message: string;
38
+ views?: {
39
+ /**
40
+ * additional warnings to be displayed in a list view under the message.
41
+ */
42
+ tips?: {
43
+ type: 'warning' | 'error' | 'info';
44
+ message: string;
45
+ }[];
46
+ toggles?: Record<string, {
47
+ key: string;
48
+ value: boolean;
49
+ title: string;
50
+ warnings?: {
51
+ type: 'warning' | 'error' | 'info';
52
+ message: string;
53
+ }[];
54
+ }>;
55
+ };
56
+ icon?: ModalIcon;
57
+ zIndex?: number;
58
+ isOpen: boolean;
59
+ closeReason?: ModalCloseReason;
60
+ }
61
+ export type ICreateModalAction = PayloadAction<IModal>;
62
+ export type IEditModalAction = PayloadAction<{
63
+ id: string;
64
+ } & Partial<Pick<IModal, 'views' | 'title'>>>;
65
+ export type IRemoveModalAction = PayloadAction<string>;
66
+ export type ICloseModalAction = PayloadAction<{
67
+ id: string;
68
+ reason?: ModalCloseReason;
69
+ }>;
@@ -0,0 +1,12 @@
1
+ import { ServerModel, ModelNode } from '../../modules/model/types';
2
+ export declare const serializeModel: (nodes: ModelNode[], modelProps: Partial<{
3
+ version: string;
4
+ backgroundColor: string;
5
+ backgroundImage: string;
6
+ backgroundVariant: 'dotted' | 'grid' | 'none';
7
+ zoom: number;
8
+ }>) => ServerModel;
9
+ export declare function getDefaultName(prefix: string, _propertyKey: string, items: Record<string, any>): string;
10
+ export declare const isRelatedEntityAttr: (attribute: catalog.IAttribute) => boolean;
11
+ export declare const isRelatedEntitiesAttr: (attribute: catalog.IAttribute) => boolean;
12
+ export declare const isRelatedAttr: (attribute: catalog.IAttribute) => boolean;
@@ -0,0 +1,8 @@
1
+ declare const _default: import("redux").Reducer<import("./reducer").IModelState>;
2
+ export default _default;
3
+ export * from './reducer';
4
+ export * from './thunks';
5
+ export * from './types';
6
+ export * from './subjects';
7
+ export * from './helpers';
8
+ export * from './selectors';
@@ -0,0 +1,33 @@
1
+ /// <reference types="@ws-ui/shared/dist/declarations/datasources/interfaces/catalog" />
2
+ import { PayloadAction } from '@reduxjs/toolkit';
3
+ export type IModelState = {
4
+ model: {
5
+ dataClasses: Record<string, catalog.IDataClass>;
6
+ collections: Record<string, catalog.IDataClass>;
7
+ extraProperties: Record<string, any>;
8
+ };
9
+ draft: {
10
+ dataClasses: Record<string, catalog.IDataClass>;
11
+ collections: Record<string, catalog.IDataClass>;
12
+ extraProperties: Record<string, any>;
13
+ };
14
+ flags: {
15
+ [key: string]: any;
16
+ };
17
+ };
18
+ export declare const FLAGS_KEYS: {
19
+ DATACLASS_DELETE: string;
20
+ DATACLASS_DRAGGABLE: string;
21
+ };
22
+ declare const stateSlice: import("@reduxjs/toolkit").Slice<IModelState, {
23
+ setModelFlag(state: IModelState, action: {
24
+ payload: {
25
+ [key: string]: any;
26
+ };
27
+ type: string;
28
+ }): void;
29
+ }, "Models">;
30
+ export declare const setModelFlag: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
31
+ [key: string]: any;
32
+ }, string>;
33
+ export default stateSlice;
@@ -0,0 +1,12 @@
1
+ export declare const useDataclasses: () => Record<string, catalog.IDataClass>;
2
+ export declare const useCollections: () => Record<string, catalog.IDataClass>;
3
+ export declare const useDataclass: (dataclassId: string) => catalog.IDataClass;
4
+ export declare const useAttribute: (dataclassId: string, attributeId: string) => catalog.IAttribute | undefined;
5
+ export declare const useModelProperties: () => Record<string, any>;
6
+ export declare const useModelFlags: () => {
7
+ deleteDataclass: any;
8
+ draggableDataclass: any;
9
+ flags: {
10
+ [key: string]: any;
11
+ };
12
+ };
@@ -0,0 +1,6 @@
1
+ import { Subject } from 'rxjs';
2
+ import { ServerModel } from './types';
3
+ export declare const modelSubject: Subject<{
4
+ action: 'reload';
5
+ payload: ServerModel;
6
+ }>;
@@ -0,0 +1,55 @@
1
+ import { ITab } from '@ws-ui/shared';
2
+ import { ServerModel } from '../../modules/model/types';
3
+ import { AppState } from '..';
4
+ type AppThunkOpts<T = string> = {
5
+ state: AppState;
6
+ rejectValue: T;
7
+ };
8
+ export declare const fetchModel: import("@reduxjs/toolkit").AsyncThunk<ServerModel, void, AppThunkOpts<string>>;
9
+ export declare const saveModel: import("@reduxjs/toolkit").AsyncThunk<{
10
+ date: string;
11
+ ext: string;
12
+ name: string;
13
+ size: number;
14
+ type: string;
15
+ path: string;
16
+ } & {
17
+ content: ServerModel;
18
+ }, ITab<ServerModel, Partial<{
19
+ initialLineInfo: {
20
+ line: number;
21
+ offset?: number | undefined;
22
+ lastModification: number;
23
+ };
24
+ initialSelectionInfo: {
25
+ selection: import("@ws-ui/shared").ITextEditorSelection;
26
+ lastModification: number;
27
+ };
28
+ diffContent: string;
29
+ attributes: import("@ws-ui/shared").IMethodAttributes;
30
+ source: import("@ws-ui/shared").ISource;
31
+ editor: import("@ws-ui/shared").IEditor;
32
+ ext: import("@ws-ui/shared").DebuggerFileExtension;
33
+ }>>, AppThunkOpts<string>>;
34
+ export declare const openModel: import("@reduxjs/toolkit").AsyncThunk<void | ITab<any, Partial<{
35
+ initialLineInfo: {
36
+ line: number;
37
+ offset?: number | undefined;
38
+ lastModification: number;
39
+ };
40
+ initialSelectionInfo: {
41
+ selection: import("@ws-ui/shared").ITextEditorSelection;
42
+ lastModification: number;
43
+ };
44
+ diffContent: string;
45
+ attributes: import("@ws-ui/shared").IMethodAttributes;
46
+ source: import("@ws-ui/shared").ISource;
47
+ editor: import("@ws-ui/shared").IEditor;
48
+ ext: import("@ws-ui/shared").DebuggerFileExtension;
49
+ }>>, {}, AppThunkOpts<string>>;
50
+ export declare const tryRenameDataclass: import("@reduxjs/toolkit").AsyncThunk<void, {
51
+ dataclassId: string;
52
+ selectionId: string;
53
+ name: string;
54
+ }, {}>;
55
+ export {};