@ws-ui/store 0.1.4 → 0.1.6

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.
@@ -1,13 +1,16 @@
1
1
  import { PayloadAction } from '@reduxjs/toolkit';
2
2
  import { IWebFormStyleClass } from '@ws-ui/shared';
3
- import { ITab, ITabExtra, ITabFlags } from '@ws-ui/shared';
4
- import { IRootState, TActionAddDataSource, TActionRemoveDataSource, TActionSetDataSources } from './types';
3
+ import { ITab, ITabExtra, ITabFlags, WebformState } from '@ws-ui/shared';
4
+ import { IRootState, TActionAddDataSource, TActionAddWebformState, TActionEditWebformState, TActionRemoveDataSource, TActionRemoveWebformState, TActionSetDataSources } 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;
8
8
  }>): void;
9
- addDataSource(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: TActionAddDataSource): void;
10
9
  openSettingsTab(state: import("immer/dist/internal.js").WritableDraft<IRootState>): void;
10
+ addDataSource(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: TActionAddDataSource): void;
11
+ addWebformState(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: TActionAddWebformState): void;
12
+ removeWebformState(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: TActionRemoveWebformState): void;
13
+ editWebformState(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: TActionEditWebformState): void;
11
14
  removeDataSource(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: TActionRemoveDataSource): void;
12
15
  setDataSources(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: TActionSetDataSources): void;
13
16
  setTabs(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: PayloadAction<ITab[]>): void;
@@ -150,5 +153,14 @@ export declare const setTabs: import("@reduxjs/toolkit").ActionCreatorWithPayloa
150
153
  lastSelected?: string | undefined;
151
154
  }> & {
152
155
  path: string;
156
+ }, string>, addWebformState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
157
+ stateDef: WebformState;
158
+ path: string;
159
+ }, string>, editWebformState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
160
+ path: string;
161
+ state: WebformState;
162
+ }, string>, removeWebformState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
163
+ path: string;
164
+ id: string;
153
165
  }, string>;
154
166
  export default stateSlice;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="@ws-ui/shared/dist/declarations/datasources/datasource" />
2
2
  import { PayloadAction } from '@reduxjs/toolkit';
3
- import { ITab } from '@ws-ui/shared';
3
+ import { ITab, WebformState } from '@ws-ui/shared';
4
4
  export interface IRootState {
5
5
  tabs: ITab[];
6
6
  filesLoading: boolean;
@@ -11,6 +11,18 @@ export type TActionAddDataSource = PayloadAction<{
11
11
  datasourceDef: datasources.ICreateDataSource;
12
12
  path: string;
13
13
  }>;
14
+ export type TActionAddWebformState = PayloadAction<{
15
+ stateDef: WebformState;
16
+ path: string;
17
+ }>;
18
+ export type TActionRemoveWebformState = PayloadAction<{
19
+ path: string;
20
+ id: string;
21
+ }>;
22
+ export type TActionEditWebformState = PayloadAction<{
23
+ path: string;
24
+ state: WebformState;
25
+ }>;
14
26
  export type TActionEditDataSource = PayloadAction<{
15
27
  path: string;
16
28
  datasourceId: string;
@@ -10,3 +10,4 @@ export * from './settings';
10
10
  export * from './styles';
11
11
  export * from './tabs';
12
12
  export * from './webforms';
13
+ export * from './states';
@@ -0,0 +1,66 @@
1
+ /// <reference types="@ws-ui/shared/dist/declarations/datasources/datasource" />
2
+ import { WebformState } from '@ws-ui/shared';
3
+ export declare const ROOT_WEBFORM_STATE: {
4
+ label: string;
5
+ id: string;
6
+ };
7
+ /**
8
+ * Returns the list of declared states in the current tab.
9
+ * @param tabPath the current tab path.
10
+ * @returns states or an empty array if not found.
11
+ */
12
+ export declare const selectWebformStatesByPath: (tabPath: string) => ((state: import("redux").EmptyObject & {
13
+ root: import("immer/dist/internal.js").WritableDraft<import("..").IRootState>;
14
+ explorer: import("immer/dist/internal.js").WritableDraft<import("..").ITreeItem>[];
15
+ debugger: import("..").IDebuggerState;
16
+ settings: import("..").ISettingsState;
17
+ catalog: {
18
+ state: "loading";
19
+ } | {
20
+ state: "loaded";
21
+ model: datasources.IEnhancedCatalog;
22
+ } | {
23
+ state: "error";
24
+ error: string;
25
+ };
26
+ roles: {
27
+ flags: {
28
+ touched?: boolean | undefined;
29
+ removed?: boolean | undefined;
30
+ pinned?: boolean | undefined;
31
+ loading?: boolean | undefined;
32
+ old?: boolean | undefined;
33
+ enabled?: boolean | undefined;
34
+ confirmed?: boolean | undefined;
35
+ };
36
+ date?: string | undefined;
37
+ privileges: import("..").TById;
38
+ roles: import("..").TRolesDict;
39
+ forceLogin?: boolean | undefined;
40
+ selectedTab: "roles" | "privileges";
41
+ };
42
+ sharedDatasources: import("..").ISharedDatasourcesState;
43
+ webforms: import("..").IWebformEditorState;
44
+ modals: import("..").IModalsState;
45
+ sharedCSS: import("immer/dist/internal.js").WritableDraft<import("..").ISharedCSSState>;
46
+ model: import("..").IModelState;
47
+ }) => WebformState[]) & import("reselect").OutputSelectorFields<(args_0: import("immer/dist/internal.js").WritableDraft<import("@ws-ui/shared").ITab<any, Partial<{
48
+ initialLineInfo: {
49
+ line: number;
50
+ offset?: number | undefined;
51
+ lastModification: number;
52
+ };
53
+ initialSelectionInfo: {
54
+ selection: import("@ws-ui/shared").ITextEditorSelection;
55
+ lastModification: number;
56
+ };
57
+ diffContent: string;
58
+ attributes: import("@ws-ui/shared").IMethodAttributes;
59
+ source: import("@ws-ui/shared").ISource;
60
+ editor: import("@ws-ui/shared").IEditor;
61
+ ext: import("@ws-ui/shared").DebuggerFileExtension;
62
+ }>>> | undefined) => WebformState[], {
63
+ clearCache: () => void;
64
+ }> & {
65
+ clearCache: () => void;
66
+ };
package/dist/utils.d.ts CHANGED
@@ -14,3 +14,4 @@ export declare function getCachedState(): TCachedState;
14
14
  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
+ export declare function refactorWebform(content: ITab['content'], id: string): any;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ws-ui/store",
3
3
  "private": false,
4
- "version": "0.1.4",
4
+ "version": "0.1.6",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs.js",
7
7
  "module": "./dist/index.es.js",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@ws-ui/icons": "^0.0.7",
26
- "@ws-ui/shared": "^0.1.2",
26
+ "@ws-ui/shared": "^0.1.4",
27
27
  "lodash": "^4.17.21",
28
28
  "minimatch": "^5.1.0",
29
29
  "react": "^17.0.2",