@legalplace/wizardx-core 4.42.10-nightly.20251126144127 → 4.42.10-nightly.20251126153634
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/PluginLoader.js
CHANGED
|
@@ -124,13 +124,44 @@ export function loadPlugins(plugins) {
|
|
|
124
124
|
pluginsStoreReducers = Object.assign(Object.assign({}, pluginsStoreReducers), { [key]: plugin.redux.reducer });
|
|
125
125
|
pluginsSagas = [...pluginsSagas, ...plugin.redux.sagas];
|
|
126
126
|
}
|
|
127
|
+
if (plugin.reduxStore) {
|
|
128
|
+
pluginsStoreReducers = Object.assign(Object.assign({}, pluginsStoreReducers), { [key]: plugin.reduxStore.reducer });
|
|
129
|
+
if (plugin.reduxStore.sagas) {
|
|
130
|
+
pluginsSagas = [...pluginsSagas, ...plugin.reduxStore.sagas];
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (plugin.replace) {
|
|
134
|
+
Object.keys(plugin.replace).forEach((componentName) => {
|
|
135
|
+
if (plugin.replace) {
|
|
136
|
+
registerReplacer(componentName, plugin.replace[componentName]);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
const configs = [];
|
|
127
141
|
if (plugin.config && Array.isArray(plugin.config)) {
|
|
142
|
+
configs.push(...plugin.config);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
Object.keys(plugin).forEach((prop) => {
|
|
146
|
+
if (["redux", "reduxStore", "replace", "config", "appstates", "actionOverride", "additionalRoutes", "paginationAfterNext"].includes(prop)) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const value = plugin[prop];
|
|
150
|
+
if (value && (typeof value === "function" || (typeof value === "object" && (value.$$typeof || value._payload)))) {
|
|
151
|
+
configs.push({
|
|
152
|
+
anchor: [prop],
|
|
153
|
+
component: value,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
if (configs.length > 0) {
|
|
128
159
|
const currentState = store.getState().pluginsStore;
|
|
129
160
|
const existingConfig = currentState.config || [];
|
|
130
161
|
store.dispatch({
|
|
131
162
|
type: "@@PLUGIN/ADD_CONFIG",
|
|
132
163
|
payload: {
|
|
133
|
-
config: [...existingConfig, ...
|
|
164
|
+
config: [...existingConfig, ...configs],
|
|
134
165
|
},
|
|
135
166
|
});
|
|
136
167
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { LoadableComponent } from "@loadable/component";
|
|
2
|
+
import type React from "react";
|
|
2
3
|
import type { Reducer } from "redux";
|
|
3
4
|
import type { ActionsLibraryType } from "./getActions.type";
|
|
4
5
|
import type { StateType } from "./State.type";
|
|
@@ -18,6 +19,23 @@ export type IPluginConfigReduxWithState<T extends Record<string, any> = {}, K ex
|
|
|
18
19
|
stateKey: K;
|
|
19
20
|
};
|
|
20
21
|
export interface IPlugin {
|
|
21
|
-
config
|
|
22
|
+
config?: IPluginConfig[];
|
|
22
23
|
redux?: IPluginConfigRedux;
|
|
24
|
+
reduxStore?: {
|
|
25
|
+
reducer: IPluginConfigReduxReducer;
|
|
26
|
+
sagas?: IPluginConfigReduxSaga[];
|
|
27
|
+
};
|
|
28
|
+
replace?: Record<string, React.ComponentType<any> | React.LazyExoticComponent<React.ComponentType<any>>>;
|
|
29
|
+
appstates?: {
|
|
30
|
+
register?: (currentAppStates: string[]) => string[];
|
|
31
|
+
pageAppState?: Record<string, string>;
|
|
32
|
+
components?: Record<string, React.ComponentType<any> | React.LazyExoticComponent<React.ComponentType<any>>>;
|
|
33
|
+
};
|
|
34
|
+
actionOverride?: Record<string, (action: any) => any>;
|
|
35
|
+
additionalRoutes?: Array<{
|
|
36
|
+
path: string;
|
|
37
|
+
component: React.ComponentType<any> | React.LazyExoticComponent<React.ComponentType<any>>;
|
|
38
|
+
}>;
|
|
39
|
+
paginationAfterNext?: React.ComponentType<any> | React.LazyExoticComponent<React.ComponentType<any>>;
|
|
40
|
+
[key: string]: any;
|
|
23
41
|
}
|