@ws-ui/store 0.1.27 → 0.1.28-feat.2737

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.
@@ -2,6 +2,8 @@ import { PayloadAction } from '@reduxjs/toolkit';
2
2
  import { ITreeItem } from './types';
3
3
  export declare const findNodeByPath: (tree: ITreeItem[], path: string) => ITreeItem | null;
4
4
  declare const stateSlice: import("@reduxjs/toolkit").Slice<import("immer/dist/internal.js").WritableDraft<ITreeItem>[], {
5
+ removeClassesFolder: (state: import("immer/dist/internal.js").WritableDraft<ITreeItem>[], action: PayloadAction<string[]>) => import("immer/dist/internal.js").WritableDraft<ITreeItem>[];
6
+ addClassesFolder: (state: import("immer/dist/internal.js").WritableDraft<ITreeItem>[], action: PayloadAction<ITreeItem[]>) => import("immer/dist/internal.js").WritableDraft<ITreeItem>[];
5
7
  toggleExpandFolder: (state: import("immer/dist/internal.js").WritableDraft<ITreeItem>[], action: PayloadAction<ITreeItem>) => import("immer/dist/internal.js").WritableDraft<ITreeItem>[];
6
8
  expandFolder: (state: import("immer/dist/internal.js").WritableDraft<ITreeItem>[], action: PayloadAction<ITreeItem>) => import("immer/dist/internal.js").WritableDraft<ITreeItem>[];
7
9
  openAddFileInput: (state: import("immer/dist/internal.js").WritableDraft<ITreeItem>[], action: PayloadAction<ITreeItem>) => ITreeItem[];
@@ -34,5 +36,5 @@ export declare const toggleExpandFolder: import("@reduxjs/toolkit").ActionCreato
34
36
  }, string>, setFolderChildren: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
35
37
  parentPath: string;
36
38
  children: ITreeItem[];
37
- }, string>;
39
+ }, string>, addClassesFolder: import("@reduxjs/toolkit").ActionCreatorWithPayload<ITreeItem[], string>, removeClassesFolder: import("@reduxjs/toolkit").ActionCreatorWithPayload<string[], string>;
38
40
  export default stateSlice;
@@ -1,12 +1,11 @@
1
1
  /// <reference types="@ws-ui/shared/dist/declarations/datasources/interfaces/catalog" />
2
2
  /// <reference types="@ws-ui/shared/dist/declarations/datasources/interfaces/dataclass-attribute" />
3
- import { Action, ThunkDispatch } from '@reduxjs/toolkit';
4
3
  import { FileFolderType, IFileInfo, ISaveFileResponse, ISetFileContentResponse, ITextEditorSelection } from '@ws-ui/shared';
5
4
  import { ITab } from '@ws-ui/shared';
6
5
  import { ClassFileTypes } from '../../modules/root/types';
7
6
  import { AppState } from '..';
8
7
  import { ISettingsState } from '../settings';
9
- import { ITreeItem } from './types';
8
+ import { IOpenFilePayload, ITreeItem } from './types';
10
9
  interface ICreateNewFilePayload {
11
10
  fileName: string;
12
11
  type: FileFolderType;
@@ -65,17 +64,20 @@ export declare const tryEditMethod: import("@reduxjs/toolkit").AsyncThunk<ITab<a
65
64
  }, {
66
65
  state: AppState;
67
66
  }>;
68
- export declare const createModelFiles: import("@reduxjs/toolkit").AsyncThunk<void, {
67
+ export type TCreateModelFilesPayload = {
69
68
  type: 'dataclass';
70
69
  className: string;
71
70
  collectionName: string;
72
- toCreate?: ClassFileTypes | undefined;
71
+ toCreate?: ClassFileTypes;
73
72
  } | {
74
73
  type: 'model';
75
- }, {
74
+ };
75
+ export declare const createModelFiles: import("@reduxjs/toolkit").AsyncThunk<void, TCreateModelFilesPayload, {
76
+ state: AppState;
77
+ }>;
78
+ export declare const fetchFolderContent: import("@reduxjs/toolkit").AsyncThunk<ITreeItem[], string, {
76
79
  state: AppState;
77
80
  }>;
78
- export declare const fetchFolderContent: import("@reduxjs/toolkit").AsyncThunk<ITreeItem[], string, {}>;
79
81
  export declare const fetchFolderContentWithoutExpanding: import("@reduxjs/toolkit").AsyncThunk<ITreeItem[], string, {}>;
80
82
  export declare const uploadFileAndGetResponse: import("@reduxjs/toolkit").AsyncThunk<{
81
83
  status: number;
@@ -88,7 +90,9 @@ export declare const uploadFile: import("@reduxjs/toolkit").AsyncThunk<{
88
90
  file: File;
89
91
  path: string;
90
92
  parentNode: ITreeItem;
91
- }, {}>;
93
+ }, {
94
+ state: AppState;
95
+ }>;
92
96
  export declare const createNewFile: import("@reduxjs/toolkit").AsyncThunk<{
93
97
  qodly: boolean;
94
98
  file: ISetFileContentResponse;
@@ -111,7 +115,7 @@ export declare function getFilePath(file: ISaveFileResponse, options?: Partial<{
111
115
  qodly: boolean;
112
116
  }>): string;
113
117
  export declare const createNewFileAndOpen: import("@reduxjs/toolkit").AsyncThunk<void, ICreateNewFilePayload, {
114
- dispatch: ThunkDispatch<any, void, Action>;
118
+ state: AppState;
115
119
  }>;
116
120
  export declare const createNewNode: import("@reduxjs/toolkit").AsyncThunk<{
117
121
  file: import("@ws-ui/shared").IAddFolderResponse;
@@ -137,20 +141,7 @@ export declare const openFile: import("@reduxjs/toolkit").AsyncThunk<ITab<any, P
137
141
  source: import("@ws-ui/shared").ISource;
138
142
  editor: import("@ws-ui/shared").IEditor;
139
143
  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
- }, {
144
+ }>> | null, IOpenFilePayload, {
154
145
  state: AppState;
155
146
  }>;
156
147
  export declare const openFileAtLine: import("@reduxjs/toolkit").AsyncThunk<ITab<any, Partial<{
@@ -1,4 +1,4 @@
1
- import { FileFolderType, IEditor } from '@ws-ui/shared';
1
+ import { FileFolderType, IEditor, IFileInfo, ITabFlags } from '@ws-ui/shared';
2
2
  export interface ITreeItem {
3
3
  name: string;
4
4
  path: string;
@@ -19,6 +19,9 @@ export interface ITreeItem {
19
19
  supportedEditors?: IEditor[];
20
20
  };
21
21
  isRoot?: boolean;
22
+ info?: {
23
+ [key: string]: any;
24
+ };
22
25
  }
23
26
  export interface INodePermissions {
24
27
  canRemove: boolean;
@@ -49,6 +52,15 @@ export interface IEditors {
49
52
  editor: IEditor;
50
53
  supportedEditors?: IEditor[];
51
54
  }
55
+ export interface IOpenFilePayload {
56
+ file: IFileInfo;
57
+ inactive?: boolean;
58
+ isNew?: boolean;
59
+ flags?: Pick<ITabFlags, 'enabled' | 'loading' | 'pinned' | 'confirmed'>;
60
+ info?: {
61
+ [key: string]: string;
62
+ };
63
+ }
52
64
  export declare const editors: IEditors[];
53
65
  export declare const extensions: {
54
66
  pattern: string;
@@ -2,3 +2,26 @@ import { IEditors } from './types';
2
2
  export declare function getNodeRelativePath(nodePath: string): string;
3
3
  export declare function getEditors(path: string): IEditors;
4
4
  export declare function getExtension(path: string): "json" | "text";
5
+ type TgetContent = {
6
+ name: string;
7
+ qodly: boolean;
8
+ };
9
+ export declare const getContent: () => {
10
+ dataclass: ({ name, qodly }: TgetContent) => {
11
+ name: string;
12
+ content: string;
13
+ };
14
+ collection: ({ name, qodly }: TgetContent) => {
15
+ name: string;
16
+ content: string;
17
+ };
18
+ entity: ({ name, qodly }: TgetContent) => {
19
+ name: string;
20
+ content: string;
21
+ };
22
+ model: ({ name, qodly }: TgetContent) => {
23
+ name: string;
24
+ content: string;
25
+ };
26
+ };
27
+ export {};
@@ -32,7 +32,9 @@ export declare enum EPermissionType {
32
32
  DATACLASS = "dataclass",
33
33
  METHOD = "method",
34
34
  ATTRIBUTE = "attribute",
35
- DATASTORE = "datastore"
35
+ DATASTORE = "datastore",
36
+ SINGLTON = "singleton",
37
+ SINGLTON_METHOD = "singletonMethod"
36
38
  }
37
39
  export interface IPermission {
38
40
  applyTo: string;
@@ -1,7 +1,7 @@
1
1
  import { PayloadAction } from '@reduxjs/toolkit';
2
2
  import { IWebFormStyleClass } from '@ws-ui/shared';
3
3
  import { ITab, ITabExtra, ITabFlags, WebformState } from '@ws-ui/shared';
4
- import { IRootState, TActionAddDataSource, TActionAddWebformState, TActionEditWebformState, TActionRemoveDataSource, TActionRemoveWebformState, TActionSetDataSources, TActionSetDefaultWebformStates, TResetComponentState } from './types';
4
+ import { IRootState, TActionAddDataSource, TActionAddDefaultWebformState, TActionAddWebformState, TActionEditWebformState, TActionRemoveDataSource, TActionRemoveDefaultWebformState, TActionRemoveWebformState, TActionSetDataSources, TActionSetDefaultWebformStates, TResetComponentState } from './types';
5
5
  export declare const stateSlice: import("@reduxjs/toolkit").Slice<import("immer/dist/internal.js").WritableDraft<IRootState>, {
6
6
  setPanelState(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: PayloadAction<Partial<ITab['view']['panel']> & {
7
7
  path: string;
@@ -13,6 +13,8 @@ export declare const stateSlice: import("@reduxjs/toolkit").Slice<import("immer/
13
13
  editWebformState(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: TActionEditWebformState): void;
14
14
  resetComponentState(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: TResetComponentState): void;
15
15
  setDefaultWebformStates(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: TActionSetDefaultWebformStates): void;
16
+ addDefaultWebformState(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: TActionAddDefaultWebformState): void;
17
+ removeDefaultWebformState(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: TActionRemoveDefaultWebformState): void;
16
18
  removeDataSource(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: TActionRemoveDataSource): void;
17
19
  setDataSources(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: TActionSetDataSources): void;
18
20
  setTabs(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: PayloadAction<ITab[]>): void;
@@ -172,6 +174,12 @@ export declare const setTabs: import("@reduxjs/toolkit").ActionCreatorWithPayloa
172
174
  path: string;
173
175
  id: string;
174
176
  state: WebformState;
177
+ }, string>, addDefaultWebformState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
178
+ path: string;
179
+ state: WebformState;
180
+ }, string>, removeDefaultWebformState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
181
+ path: string;
182
+ state: WebformState;
175
183
  }, string>, setDefaultWebformStates: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
176
184
  path: string;
177
185
  states: WebformState[];
@@ -32,6 +32,14 @@ export type TActionSetDefaultWebformStates = PayloadAction<{
32
32
  path: string;
33
33
  states: WebformState[];
34
34
  }>;
35
+ export type TActionAddDefaultWebformState = PayloadAction<{
36
+ path: string;
37
+ state: WebformState;
38
+ }>;
39
+ export type TActionRemoveDefaultWebformState = PayloadAction<{
40
+ path: string;
41
+ state: WebformState;
42
+ }>;
35
43
  export type TActionEditDataSource = PayloadAction<{
36
44
  path: string;
37
45
  datasourceId: string;
@@ -195,6 +195,47 @@ export declare const selectDataclasses: ((state: import("redux").EmptyObject & {
195
195
  }> & {
196
196
  clearCache: () => void;
197
197
  };
198
+ export declare const selectSingletons: ((state: import("redux").EmptyObject & {
199
+ root: import("immer/dist/internal.js").WritableDraft<import('../modules').IRootState>;
200
+ explorer: import("immer/dist/internal.js").WritableDraft<import('../modules').ITreeItem>[];
201
+ debugger: import('../modules').IDebuggerState;
202
+ settings: import('../modules').ISettingsState;
203
+ catalog: {
204
+ state: "loading";
205
+ } | {
206
+ state: "loaded";
207
+ model: datasources.IEnhancedCatalog;
208
+ } | {
209
+ state: "error";
210
+ error: string;
211
+ };
212
+ roles: {
213
+ flags: {
214
+ touched?: boolean | undefined;
215
+ removed?: boolean | undefined;
216
+ pinned?: boolean | undefined;
217
+ loading?: boolean | undefined;
218
+ old?: boolean | undefined;
219
+ enabled?: boolean | undefined;
220
+ confirmed?: boolean | undefined;
221
+ };
222
+ date?: string | undefined;
223
+ privileges: import('../modules').TById;
224
+ roles: import('../modules').TRolesDict;
225
+ forceLogin?: boolean | undefined;
226
+ selectedTab: "roles" | "privileges";
227
+ };
228
+ sharedDatasources: import('../modules').ISharedDatasourcesState;
229
+ savedConditions: import("immer/dist/internal.js").WritableDraft<import('../modules').ISavedConditionsState>;
230
+ webforms: import('../modules').IWebformEditorState;
231
+ modals: import('../modules').IModalsState;
232
+ sharedCSS: import("immer/dist/internal.js").WritableDraft<import('../modules').ISharedCSSState>;
233
+ model: import('../modules').IModelState;
234
+ }) => never[] | datasources.ISingletons) & import("reselect").OutputSelectorFields<(args_0: datasources.IEnhancedCatalog | null) => never[] | datasources.ISingletons, {
235
+ clearCache: () => void;
236
+ }> & {
237
+ clearCache: () => void;
238
+ };
198
239
  export declare const selectVirtualDataClasses: ((state: import("redux").EmptyObject & {
199
240
  root: import("immer/dist/internal.js").WritableDraft<import('../modules').IRootState>;
200
241
  explorer: import("immer/dist/internal.js").WritableDraft<import('../modules').ITreeItem>[];
@@ -7,9 +7,10 @@ export declare const ROOT_WEBFORM_STATE: {
7
7
  /**
8
8
  * Returns the list of declared states in the current tab.
9
9
  * @param tabPath the current tab path.
10
+ * @param exclude states to exclude (by id)
10
11
  * @returns states or an empty array if not found.
11
12
  */
12
- export declare const selectWebformStatesByPath: (tabPath: string) => ((state: import("redux").EmptyObject & {
13
+ export declare const selectWebformStatesByPath: (tabPath: string, exclude?: string[]) => ((state: import("redux").EmptyObject & {
13
14
  root: import("immer/dist/internal.js").WritableDraft<import('../modules').IRootState>;
14
15
  explorer: import("immer/dist/internal.js").WritableDraft<import('../modules').ITreeItem>[];
15
16
  debugger: import('../modules').IDebuggerState;
@@ -65,6 +66,53 @@ export declare const selectWebformStatesByPath: (tabPath: string) => ((state: im
65
66
  }> & {
66
67
  clearCache: () => void;
67
68
  };
69
+ /**
70
+ * Returns the list of states labels in the current tab.
71
+ * @param tabPath the current tab path.
72
+ * @param exclude states to exclude (by id)
73
+ * @returns states labels or an empty array if not found.
74
+ */
75
+ export declare const selectWebformStatesLabelsByPath: (tabPath: string, exclude?: string[]) => ((state: import("redux").EmptyObject & {
76
+ root: import("immer/dist/internal.js").WritableDraft<import('../modules').IRootState>;
77
+ explorer: import("immer/dist/internal.js").WritableDraft<import('../modules').ITreeItem>[];
78
+ debugger: import('../modules').IDebuggerState;
79
+ settings: import('../modules').ISettingsState;
80
+ catalog: {
81
+ state: "loading";
82
+ } | {
83
+ state: "loaded";
84
+ model: datasources.IEnhancedCatalog;
85
+ } | {
86
+ state: "error";
87
+ error: string;
88
+ };
89
+ roles: {
90
+ flags: {
91
+ touched?: boolean | undefined;
92
+ removed?: boolean | undefined;
93
+ pinned?: boolean | undefined;
94
+ loading?: boolean | undefined;
95
+ old?: boolean | undefined;
96
+ enabled?: boolean | undefined;
97
+ confirmed?: boolean | undefined;
98
+ };
99
+ date?: string | undefined;
100
+ privileges: import('../modules').TById;
101
+ roles: import('../modules').TRolesDict;
102
+ forceLogin?: boolean | undefined;
103
+ selectedTab: "roles" | "privileges";
104
+ };
105
+ sharedDatasources: import('../modules').ISharedDatasourcesState;
106
+ savedConditions: import("immer/dist/internal.js").WritableDraft<import('../modules').ISavedConditionsState>;
107
+ webforms: import('../modules').IWebformEditorState;
108
+ modals: import('../modules').IModalsState;
109
+ sharedCSS: import("immer/dist/internal.js").WritableDraft<import('../modules').ISharedCSSState>;
110
+ model: import('../modules').IModelState;
111
+ }) => string[]) & import("reselect").OutputSelectorFields<(args_0: WebformState[]) => string[], {
112
+ clearCache: () => void;
113
+ }> & {
114
+ clearCache: () => void;
115
+ };
68
116
  /**
69
117
  * Returns the list of default states in the current tab.
70
118
  * @param tabPath the current tab path.
package/dist/utils.d.ts CHANGED
@@ -15,3 +15,4 @@ export declare function getModalTitle(tab: ITab): string;
15
15
  export declare const deserializeModel: (data: ServerModel | undefined) => ModelNode[];
16
16
  export declare function isJSON(extension?: string): boolean;
17
17
  export declare function refactorWebform(content: ITab['content'], id: string): any;
18
+ export declare const selectorEqualityFn: (left: unknown, right: unknown) => boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ws-ui/store",
3
3
  "private": false,
4
- "version": "0.1.27",
4
+ "version": "0.1.28-feat.2737",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs.js",
7
7
  "module": "./dist/index.es.js",
@@ -24,11 +24,11 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@reduxjs/toolkit": "^1.7.1",
27
+ "@ws-ui/shared": "^0.1.23",
27
28
  "react-redux": "^7.2.6"
28
29
  },
29
30
  "peerDependencies": {
30
- "@ws-ui/icons": "^0.0.16",
31
- "@ws-ui/shared": "^0.1.21",
31
+ "@ws-ui/icons": "^0.0.17",
32
32
  "lodash": "^4.17.21",
33
33
  "minimatch": "^5.1.0",
34
34
  "react": "^17.0.2",