@apia/dashboard-controller 2.0.9 → 2.0.10
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/actions/basicAction.d.ts +15 -0
- package/dist/actions/basicAction.d.ts.map +1 -0
- package/dist/actions/basicAction.js +40 -0
- package/dist/actions/basicAction.js.map +1 -0
- package/dist/actions/externalFirePanelAction.d.ts +6 -0
- package/dist/actions/externalFirePanelAction.d.ts.map +1 -0
- package/dist/actions/externalFirePanelAction.js +12 -0
- package/dist/actions/externalFirePanelAction.js.map +1 -0
- package/dist/actions/firePanelAction.d.ts +6 -0
- package/dist/actions/firePanelAction.d.ts.map +1 -0
- package/dist/actions/firePanelAction.js +75 -0
- package/dist/actions/firePanelAction.js.map +1 -0
- package/dist/actions/usePanelActions.d.ts +63 -0
- package/dist/actions/usePanelActions.d.ts.map +1 -0
- package/dist/actions/usePanelActions.js +55 -0
- package/dist/actions/usePanelActions.js.map +1 -0
- package/dist/actions/usePanelIsLoading.d.ts +4 -0
- package/dist/actions/usePanelIsLoading.d.ts.map +1 -0
- package/dist/actions/usePanelIsLoading.js +14 -0
- package/dist/actions/usePanelIsLoading.js.map +1 -0
- package/dist/actions/usePanelNetworkState.d.ts +8 -0
- package/dist/actions/usePanelNetworkState.d.ts.map +1 -0
- package/dist/actions/usePanelNetworkState.js +21 -0
- package/dist/actions/usePanelNetworkState.js.map +1 -0
- package/dist/common/usePanelIdentity.d.ts +10 -0
- package/dist/common/usePanelIdentity.d.ts.map +1 -0
- package/dist/common/usePanelIdentity.js +12 -0
- package/dist/common/usePanelIdentity.js.map +1 -0
- package/dist/config/parametersStore.d.ts +15 -0
- package/dist/config/parametersStore.d.ts.map +1 -0
- package/dist/config/parametersStore.js +25 -0
- package/dist/config/parametersStore.js.map +1 -0
- package/dist/config/saveParameters.d.ts +11 -0
- package/dist/config/saveParameters.d.ts.map +1 -0
- package/dist/config/saveParameters.js +16 -0
- package/dist/config/saveParameters.js.map +1 -0
- package/dist/config/usePanelConfig.js +22 -0
- package/dist/config/usePanelConfig.js.map +1 -0
- package/dist/config/usePanelParametersSelector.d.ts +25 -0
- package/dist/config/usePanelParametersSelector.d.ts.map +1 -0
- package/dist/config/usePanelParametersSelector.js +17 -0
- package/dist/config/usePanelParametersSelector.js.map +1 -0
- package/dist/dashboard/DashboardContext.d.ts +6 -0
- package/dist/dashboard/DashboardContext.d.ts.map +1 -0
- package/dist/dashboard/DashboardContext.js +12 -0
- package/dist/dashboard/DashboardContext.js.map +1 -0
- package/dist/dashboard/DashboardPanel.d.ts +45 -0
- package/dist/dashboard/DashboardPanel.d.ts.map +1 -0
- package/dist/dashboard/DashboardPanel.js +236 -0
- package/dist/dashboard/DashboardPanel.js.map +1 -0
- package/dist/dashboard/DashboardPanelContext.d.ts +6 -0
- package/dist/dashboard/DashboardPanelContext.d.ts.map +1 -0
- package/dist/dashboard/DashboardPanelContext.js +12 -0
- package/dist/dashboard/DashboardPanelContext.js.map +1 -0
- package/dist/dashboard/DashboardPanelsBootstraper.d.ts +33 -0
- package/dist/dashboard/DashboardPanelsBootstraper.d.ts.map +1 -0
- package/dist/dashboard/DashboardPanelsBootstraper.js +135 -0
- package/dist/dashboard/DashboardPanelsBootstraper.js.map +1 -0
- package/dist/dashboard/DashboardRouter.d.ts +30 -0
- package/dist/dashboard/DashboardRouter.d.ts.map +1 -0
- package/dist/dashboard/DashboardRouter.js +74 -0
- package/dist/dashboard/DashboardRouter.js.map +1 -0
- package/dist/dashboard/PanelNotFound.js +14 -0
- package/dist/dashboard/PanelNotFound.js.map +1 -0
- package/dist/dashboard/dashboard.d.ts +26 -0
- package/dist/dashboard/dashboard.d.ts.map +1 -0
- package/dist/dashboard/dashboard.js +167 -0
- package/dist/dashboard/dashboard.js.map +1 -0
- package/dist/eventsController/eventsController.d.ts +11 -0
- package/dist/eventsController/eventsController.d.ts.map +1 -0
- package/dist/eventsController/eventsController.js +57 -0
- package/dist/eventsController/eventsController.js.map +1 -0
- package/dist/eventsController/types.d.ts +21 -0
- package/dist/eventsController/types.d.ts.map +1 -0
- package/dist/eventsController/usePanelFireEvent.d.ts +13 -0
- package/dist/eventsController/usePanelFireEvent.d.ts.map +1 -0
- package/dist/eventsController/usePanelFireEvent.js +21 -0
- package/dist/eventsController/usePanelFireEvent.js.map +1 -0
- package/dist/eventsController/usePanelOnEvent.d.ts +12 -0
- package/dist/eventsController/usePanelOnEvent.d.ts.map +1 -0
- package/dist/eventsController/usePanelOnEvent.js +14 -0
- package/dist/eventsController/usePanelOnEvent.js.map +1 -0
- package/dist/index.d.ts +23 -409
- package/dist/index.js +22 -2201
- package/dist/index.js.map +1 -1
- package/dist/panelsStore/createPanelStore.d.ts +16 -0
- package/dist/panelsStore/createPanelStore.d.ts.map +1 -0
- package/dist/panelsStore/createPanelStore.js +58 -0
- package/dist/panelsStore/createPanelStore.js.map +1 -0
- package/dist/panelsStore/panelsStore.js +59 -0
- package/dist/panelsStore/panelsStore.js.map +1 -0
- package/dist/panelsStore/usePanelSelector.js +32 -0
- package/dist/panelsStore/usePanelSelector.js.map +1 -0
- package/dist/panelsUtil/usePanelChangeTitle.d.ts +5 -0
- package/dist/panelsUtil/usePanelChangeTitle.d.ts.map +1 -0
- package/dist/panelsUtil/usePanelChangeTitle.js +23 -0
- package/dist/panelsUtil/usePanelChangeTitle.js.map +1 -0
- package/dist/panelsUtil/usePanelTitleAction.js +34 -0
- package/dist/panelsUtil/usePanelTitleAction.js.map +1 -0
- package/dist/position/usePanelPosition.d.ts +13 -0
- package/dist/position/usePanelPosition.d.ts.map +1 -0
- package/dist/position/usePanelPosition.js +40 -0
- package/dist/position/usePanelPosition.js.map +1 -0
- package/dist/splash/events/Dragleave.js +15 -0
- package/dist/splash/events/Dragleave.js.map +1 -0
- package/dist/splash/events/Dragover.js +120 -0
- package/dist/splash/events/Dragover.js.map +1 -0
- package/dist/splash/events/Dragstart.js +65 -0
- package/dist/splash/events/Dragstart.js.map +1 -0
- package/dist/splash/events/Drop.js +60 -0
- package/dist/splash/events/Drop.js.map +1 -0
- package/dist/splash/panels/DefaultPanelWrapper/NetworkState.js +28 -0
- package/dist/splash/panels/DefaultPanelWrapper/NetworkState.js.map +1 -0
- package/dist/splash/panels/DefaultPanelWrapper/PanelButtons.js +16 -0
- package/dist/splash/panels/DefaultPanelWrapper/PanelButtons.js.map +1 -0
- package/dist/splash/panels/DefaultPanelWrapper/RefreshButton.js +35 -0
- package/dist/splash/panels/DefaultPanelWrapper/RefreshButton.js.map +1 -0
- package/dist/splash/panels/DefaultPanelWrapper/SettingsButton.js +45 -0
- package/dist/splash/panels/DefaultPanelWrapper/SettingsButton.js.map +1 -0
- package/dist/splash/panels/DefaultPanelWrapper/defaultPanelWrapperStyles.js +103 -0
- package/dist/splash/panels/DefaultPanelWrapper/defaultPanelWrapperStyles.js.map +1 -0
- package/dist/splash/panels/DefaultPanelWrapper/index.js +57 -0
- package/dist/splash/panels/DefaultPanelWrapper/index.js.map +1 -0
- package/dist/splash/panels/LandingPagePanelWrapper.d.ts +6 -0
- package/dist/splash/panels/LandingPagePanelWrapper.d.ts.map +1 -0
- package/dist/splash/panels/LandingPagePanelWrapper.js +52 -0
- package/dist/splash/panels/LandingPagePanelWrapper.js.map +1 -0
- package/dist/splash/panels/PanelContext/PanelFooter.js +70 -0
- package/dist/splash/panels/PanelContext/PanelFooter.js.map +1 -0
- package/dist/splash/panels/PanelContext/index.d.ts +26 -0
- package/dist/splash/panels/PanelContext/index.d.ts.map +1 -0
- package/dist/splash/panels/PanelContext/index.js +73 -0
- package/dist/splash/panels/PanelContext/index.js.map +1 -0
- package/dist/splash/panels/PanelContext/usePanelContextLayout.d.ts +6 -0
- package/dist/splash/panels/PanelContext/usePanelContextLayout.d.ts.map +1 -0
- package/dist/splash/panels/PanelContext/usePanelContextLayout.js +38 -0
- package/dist/splash/panels/PanelContext/usePanelContextLayout.js.map +1 -0
- package/dist/splash/panels/PanelContext/usePanelFooter.js +38 -0
- package/dist/splash/panels/PanelContext/usePanelFooter.js.map +1 -0
- package/dist/splash/panels/PanelContext/useYieldPanelIsReady.d.ts +45 -0
- package/dist/splash/panels/PanelContext/useYieldPanelIsReady.d.ts.map +1 -0
- package/dist/splash/panels/PanelContext/useYieldPanelIsReady.js +12 -0
- package/dist/splash/panels/PanelContext/useYieldPanelIsReady.js.map +1 -0
- package/dist/splash/panels/PanelErrorBoundary.js +53 -0
- package/dist/splash/panels/PanelErrorBoundary.js.map +1 -0
- package/dist/splash/panels/PanelIdentifier.d.ts +16 -0
- package/dist/splash/panels/PanelIdentifier.d.ts.map +1 -0
- package/dist/splash/panels/PanelIdentifier.js +19 -0
- package/dist/splash/panels/PanelIdentifier.js.map +1 -0
- package/dist/splash/util/DragAndDrop.js +243 -0
- package/dist/splash/util/DragAndDrop.js.map +1 -0
- package/dist/splash/util/getColumnAreas.js +19 -0
- package/dist/splash/util/getColumnAreas.js.map +1 -0
- package/dist/splash/util/isCursorInArea.js +13 -0
- package/dist/splash/util/isCursorInArea.js.map +1 -0
- package/dist/types.d.ts +27 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/util.d.ts +8 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +30 -0
- package/dist/util.js.map +1 -0
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,410 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
id: string;
|
|
25
|
-
initialData: {
|
|
26
|
-
initialData: unknown;
|
|
27
|
-
};
|
|
28
|
-
isConfigurable: boolean;
|
|
29
|
-
isRefreshable: boolean;
|
|
30
|
-
name: string;
|
|
31
|
-
refreshOnStart: boolean;
|
|
32
|
-
refreshOnHome: boolean;
|
|
33
|
-
showTitle: boolean;
|
|
34
|
-
title: string;
|
|
35
|
-
type: string;
|
|
36
|
-
}
|
|
37
|
-
type TLoadedPanelProps = Omit<TPanelProps$1, 'children'>;
|
|
38
|
-
type TPanelId = TPanelProps$1['id'];
|
|
39
|
-
type TPanelName = TPanelProps$1['name'];
|
|
40
|
-
type TPanelType = TPanelProps$1['type'];
|
|
41
|
-
type PanelContainer = FC<TPanelProps$1>;
|
|
42
|
-
|
|
43
|
-
declare const LandingPagePanelWrapper: PanelContainer;
|
|
44
|
-
|
|
45
|
-
interface TPanelIdentifier {
|
|
46
|
-
panelId: TPanelId;
|
|
47
|
-
panelName: TPanelName;
|
|
48
|
-
panelTitle: string;
|
|
49
|
-
panelType: TPanelType;
|
|
50
|
-
}
|
|
51
|
-
type TPanelEventIdentifier = TPanelIdentifier & {
|
|
52
|
-
eventType: string;
|
|
53
|
-
};
|
|
54
|
-
type TPanelEvent<PayloadEvent = unknown> = TPanelEventIdentifier & {
|
|
55
|
-
payload: PayloadEvent;
|
|
56
|
-
};
|
|
57
|
-
type TPanelEventCallback<PayloadEvent> = (event: TPanelEvent<PayloadEvent>) => unknown;
|
|
58
|
-
type TPanelEventRegister<PayloadEvent> = {
|
|
59
|
-
callback: TPanelEventCallback<PayloadEvent>;
|
|
60
|
-
} & Partial<TPanelEventIdentifier>;
|
|
61
|
-
|
|
62
|
-
declare const PanelIdentifierContext: react.Context<TPanelIdentifier | undefined>;
|
|
63
|
-
interface TPanelIdentifierProps {
|
|
64
|
-
children: ReactNode;
|
|
65
|
-
id: string;
|
|
66
|
-
name: string;
|
|
67
|
-
title: string;
|
|
68
|
-
type: string;
|
|
69
|
-
}
|
|
70
|
-
declare const PanelIdentifier: ({ children, name, id, title, type, }: TPanelIdentifierProps) => react.JSX.Element;
|
|
71
|
-
|
|
72
|
-
type TActionBehavior = 'DO_NOTHING' | 'NAVIGATE_URL' | 'CALL_AJAX_URL' | 'RUN_ACTION' | 'OPEN_TAB';
|
|
73
|
-
type TActionSource = 'CLICK' | 'DOUBLE_CLICK';
|
|
74
|
-
type TBasicAction = {
|
|
75
|
-
action: string;
|
|
76
|
-
actionBehavior: TActionBehavior;
|
|
77
|
-
actionSource: TActionSource;
|
|
78
|
-
actionNewTabTitle: string;
|
|
79
|
-
text: string;
|
|
80
|
-
};
|
|
81
|
-
declare function handleAction(panelId: string, event: KeyboardEvent | MouseEvent, action: TBasicAction): void;
|
|
82
|
-
|
|
83
|
-
type TOnSucceed = (hasSucceed: boolean, data: TActionResult) => unknown;
|
|
84
|
-
|
|
85
|
-
type TFooter = TBasicAction;
|
|
86
|
-
type TCommonActionResult = {
|
|
87
|
-
title: string;
|
|
88
|
-
footer: TFooter;
|
|
89
|
-
};
|
|
90
|
-
type TActionResult<T = any> = null | NonNullable<Awaited<TApiaApiResult<T extends Record<string, unknown> ? T & TCommonActionResult : T>>>;
|
|
91
|
-
type TActionDispatcherOptions = {
|
|
92
|
-
onComplete?: TOnSucceed;
|
|
93
|
-
requestConfig?: IApiaApiRequestConfig<object>;
|
|
94
|
-
};
|
|
95
|
-
type TExternalActionDispatcher = (panelId: string, { action, ...parameters }: {
|
|
96
|
-
action: string;
|
|
97
|
-
} & Record<string, unknown>, options?: TActionDispatcherOptions) => void;
|
|
98
|
-
type TActionDispatcher = ({ action, ...parameters }: {
|
|
99
|
-
action: string;
|
|
100
|
-
} & Record<string, unknown>, options?: TActionDispatcherOptions) => Promise<TActionResult>;
|
|
101
|
-
type TActionHandler = (result: TActionResult) => unknown;
|
|
102
|
-
/**
|
|
103
|
-
* El hook usePanelActions es el método principal de comunicación entre el
|
|
104
|
-
* módulo cliente y el módulo server de un panel.
|
|
105
|
-
*
|
|
106
|
-
* Acepta un actionsHandler y devuelve un actionDispatcher.
|
|
107
|
-
*
|
|
108
|
-
* **Existe la acción refresh** que será llamada automáticamente cada vez que
|
|
109
|
-
* se guarde la configuración del panel o se haga click en el botón refrescar
|
|
110
|
-
* del mismo.
|
|
111
|
-
*
|
|
112
|
-
* @param actionsHandler Es un objeto de tipo clave-valor en donde cada clave debe corresponderse con una acción que puede ser ejecutada en el panel. El valor debe ser una función que recibe la respuesta del servidor a la ejecución de la acción.
|
|
113
|
-
*
|
|
114
|
-
* @returns Un método actionDispatcher que permite ejecutar acciones para ser procesadas por la contraparte del panel en el servidor. Al ser llamado acepta un objeto que debe tener como mínimo la propiedad action: string, que indica qué acción será ejecutada. Acepta opcionalmente cualquier cantidad adicional de propiedades en el objeto.
|
|
115
|
-
*
|
|
116
|
-
* @example
|
|
117
|
-
*
|
|
118
|
-
const dispatch = usePanelActions({
|
|
119
|
-
refresh() {
|
|
120
|
-
console.log('Refresh');
|
|
121
|
-
},
|
|
122
|
-
revert(response: TActionResult<TApiaLoadText>) {
|
|
123
|
-
if (response?.data?.text.label !== undefined)
|
|
124
|
-
setLabel(response?.data?.text.label);
|
|
125
|
-
},
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
return <Button
|
|
129
|
-
onClick={() => {
|
|
130
|
-
dispatch({
|
|
131
|
-
action: 'revert',
|
|
132
|
-
text: (document.getElementById('Text') as
|
|
133
|
-
HTMLInputElement).value,
|
|
134
|
-
});
|
|
135
|
-
}}
|
|
136
|
-
>
|
|
137
|
-
Revert
|
|
138
|
-
</Button>
|
|
139
|
-
*/
|
|
140
|
-
declare function usePanelActions(actionsHandler?: Record<string, TActionHandler>): TActionDispatcher;
|
|
141
|
-
|
|
142
|
-
declare const externalFirePanelAction: TExternalActionDispatcher;
|
|
143
|
-
|
|
144
|
-
declare function usePanelIsLoading(): boolean;
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Permite saber en todo momento si el panel actual tuvo un error en su
|
|
148
|
-
* conexión de red
|
|
149
|
-
*/
|
|
150
|
-
declare const usePanelNetworkState: () => boolean;
|
|
151
|
-
|
|
152
|
-
type TPanelLayout = TSpacingLayout;
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* **Favor de leer con cuidado el siguiente contenido, es muy importante para
|
|
156
|
-
* la performance**
|
|
157
|
-
*
|
|
158
|
-
* El hook useYieldPanelIsReady es una parte muy importante del flujo de
|
|
159
|
-
* trabajo de los dashboards. **El no reportar la carga de un panel tiene
|
|
160
|
-
* penalizaciones graves en el tiempo de renderizado inicial**, esto es porque
|
|
161
|
-
* el dashboard espera que todos los paneles hayan terminado la carga
|
|
162
|
-
* estructural básica antes de empezar con los refresh iniciales, y esto termina
|
|
163
|
-
* impactando en el tiempo que demora en bajar la cortina.
|
|
164
|
-
*
|
|
165
|
-
* **Aclaración:** Actualmente se espera las cargas estructurales para lanzar
|
|
166
|
-
* los refresh iniciales por motivos de arquitectura. Esa restricción será
|
|
167
|
-
* eliminada probablemente en el corto plazo, pero eso no cambia la necesidad de
|
|
168
|
-
* reportar las estructuras ya que esta información es igualmente utilizada para
|
|
169
|
-
* el bajado de la cortina de Skeletons.
|
|
170
|
-
*
|
|
171
|
-
* Por ejemplo, si todos los paneles están optimizados para lograr cargas
|
|
172
|
-
* iniciales rápidas pero el logo de la aplicación no reporta que su estructura
|
|
173
|
-
* está pronta, el dashboard va a bajar su cortina solamente luego de que expire
|
|
174
|
-
* el timeout **DASH_COURTAIN_TRESHOLD**, que por defecto viene establecido en 5
|
|
175
|
-
* segundos.
|
|
176
|
-
*
|
|
177
|
-
* Esto significa que aún cuando la cortina se hubiera podido bajar quizás a
|
|
178
|
-
* los pocos ms de cargado el html inicial, no lo hará porque supone que el
|
|
179
|
-
* panel Logo aún no terminó su carga estructural.
|
|
180
|
-
*
|
|
181
|
-
* Siempre que un panel esté presente en un dashboard, deberá reportar cuando
|
|
182
|
-
* la carga estructural esté pronta. Esto puede ser hecho de dos formas:
|
|
183
|
-
*
|
|
184
|
-
* - Usando { setRef } = usePanelContext(): En el elemento crucial de HTML del
|
|
185
|
-
* elemento hacer ref={setRef}. Esta es la forma más óptima ya que nos garantiza
|
|
186
|
-
* que el panel se reporte cuando su estructura HTML ya esté disponible,
|
|
187
|
-
* evitando ninguna demora.
|
|
188
|
-
*
|
|
189
|
-
* - Usando useYieldPanelIsReady(): Este hook es una alternativa disponible
|
|
190
|
-
* para las situaciones en las que no tenemos ningún elemento HTML de
|
|
191
|
-
* importancia o cuando ese elemento no está disponible hasta después de la
|
|
192
|
-
* carga inicial. Al usar este hook el panel se reportará automáticamente una
|
|
193
|
-
* vez que haya hecho el renderizado inicial.
|
|
194
|
-
*/
|
|
195
|
-
declare function useYieldPanelIsReady(): void;
|
|
196
|
-
|
|
197
|
-
type TPanelContext = {
|
|
198
|
-
/**
|
|
199
|
-
* setLayout es una función que permite decidir en qué formato se muestran
|
|
200
|
-
* los contenidos del panel.
|
|
201
|
-
*
|
|
202
|
-
* dense: No hay paddings
|
|
203
|
-
* clever: Hay paddings grandes
|
|
204
|
-
*/
|
|
205
|
-
setLayout: (newLayout: TPanelLayout) => void;
|
|
206
|
-
setTitle: (newTitle: string) => void;
|
|
207
|
-
panelProps: Omit<TPanelProps$1, 'children'>;
|
|
208
|
-
/**
|
|
209
|
-
* Cuando un panel renderiza sus hijos en pantalla, debe setear el ref de
|
|
210
|
-
* modo que se pueda continuar con el flujo normal del panel. Este ref puede
|
|
211
|
-
* estar en cualquier nivel, cuando sea instanciado, se llamará al refresh
|
|
212
|
-
* inicial.
|
|
213
|
-
*/
|
|
214
|
-
setRef: (el: HTMLElement | null) => void;
|
|
215
|
-
};
|
|
216
|
-
declare function usePanelContext(): TPanelContext;
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Permite acceder a la identidad del panel actual.
|
|
220
|
-
*/
|
|
221
|
-
declare function usePanelIdentity(): TPanelIdentifier;
|
|
222
|
-
|
|
223
|
-
type TPanelParameter = string | number | boolean;
|
|
224
|
-
type TParamsStore = Record<string, TPanelParameter>;
|
|
225
|
-
type TParamsSlice = Record<string, TParamsStore>;
|
|
226
|
-
declare const store: _reduxjs_toolkit_dist_configureStore.ToolkitStore<{
|
|
227
|
-
panelParameters: TParamsSlice;
|
|
228
|
-
}, redux.AnyAction, [redux_thunk.ThunkMiddleware<{
|
|
229
|
-
panelParameters: TParamsSlice;
|
|
230
|
-
}>]>;
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Actualiza los parámetros de un panel a nivel de cliente. Este método se
|
|
234
|
-
* expone con el único fin de ser llamado por la acción saveParams del api.
|
|
235
|
-
*/
|
|
236
|
-
declare function saveParameters(panelId: TPanelId, parameters: TParamsStore, refresh?: boolean): void;
|
|
237
|
-
|
|
238
|
-
type TParametersSelector<Selected> = (parameters: Record<string, TPanelParameter>) => Selected;
|
|
239
|
-
/**
|
|
240
|
-
// eslint-disable-next-line comment-length/limit-multi-line-comments
|
|
241
|
-
* Este hook permite seleccionar parámetros de un panel. Cada vez que los
|
|
242
|
-
* parámetros del panel sean actualizados, se llamará a la función selector y en
|
|
243
|
-
* caso de que la selección actual de parámetros difiera de la anterior, se
|
|
244
|
-
* provocará un renderizado en el componente que lo utiliza.
|
|
245
|
-
*
|
|
246
|
-
* Si se quiere obtener los parámetros del panel en el que se está trabajando,
|
|
247
|
-
* el segundo parámetro es innecesario. En caso de querer obtener los
|
|
248
|
-
* parámetros de otro panel, se puede pasar su nombre como segundo parámetro y
|
|
249
|
-
* la selección se hará de acuerdo a los parámetros de éste.
|
|
250
|
-
*
|
|
251
|
-
* Es importante ver que es imposible prever qué parámetros tendrá cada panel,
|
|
252
|
-
* por ello el tipo entregado al selector es Record, que puede entenderse como
|
|
253
|
-
* un mapa de entradas con clave string y valor TPanelParameter = string |
|
|
254
|
-
* boolean | number.
|
|
255
|
-
*/
|
|
256
|
-
declare function usePanelParametersSelector<Selected>(selector: TParametersSelector<Selected>, panelName?: TPanelName): Selected;
|
|
257
|
-
|
|
258
|
-
declare global {
|
|
259
|
-
interface Window {
|
|
260
|
-
DASH_COURTAIN_TRESHOLD?: number;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
declare class DashboardPanelsBootstraper {
|
|
264
|
-
#private;
|
|
265
|
-
dashboard: Dashboard;
|
|
266
|
-
constructor(dashboard: Dashboard);
|
|
267
|
-
/**
|
|
268
|
-
* El bootstraper se basa en dos elementos: setHasLoadedInitialData y
|
|
269
|
-
* SuspendPanelUntilDashboardReady.
|
|
270
|
-
*
|
|
271
|
-
* El funcionamiento es muy elemental: Cada panel utiliza el Suspend como
|
|
272
|
-
* wrapper y éste registra el id del panel en un array de paneles pendientes
|
|
273
|
-
* por cargar.
|
|
274
|
-
*
|
|
275
|
-
* Una vez que todos los paneles cargaron, el suspense retoma su tarea y
|
|
276
|
-
* renderiza el panel normalmente.
|
|
277
|
-
*/
|
|
278
|
-
setPanelHasLoaded: (panelId: string) => void;
|
|
279
|
-
SuspendPanelUntilDashbordReady: ({ children, panelId, }: {
|
|
280
|
-
children: ReactNode;
|
|
281
|
-
panelId: string;
|
|
282
|
-
}) => react.JSX.Element;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
declare function importPanel(path: string): ComponentType<{
|
|
286
|
-
initialData: unknown;
|
|
287
|
-
}>;
|
|
288
|
-
|
|
289
|
-
type TPanelProps = Omit<TLoadedPanelProps, 'initialData'>;
|
|
290
|
-
declare class DashboardPanel extends EventEmitter<{
|
|
291
|
-
hasLoaded: boolean;
|
|
292
|
-
isVisible: boolean;
|
|
293
|
-
}> {
|
|
294
|
-
#private;
|
|
295
|
-
dashboard: Dashboard;
|
|
296
|
-
hasInited: boolean;
|
|
297
|
-
hasLoaded: boolean;
|
|
298
|
-
id: string;
|
|
299
|
-
initialData: Promise<unknown> | null;
|
|
300
|
-
isVisible: boolean;
|
|
301
|
-
portal: ReactPortal;
|
|
302
|
-
props: TPanelProps;
|
|
303
|
-
constructor({ id, dashboard, PanelContainer, }: {
|
|
304
|
-
id: string;
|
|
305
|
-
dashboard: Dashboard;
|
|
306
|
-
PanelContainer: PanelContainer;
|
|
307
|
-
});
|
|
308
|
-
fireAction: ({ action, ...parameters }: {
|
|
309
|
-
action: string;
|
|
310
|
-
} & Record<string, unknown>, options?: TActionDispatcherOptions) => Promise<TActionResult>;
|
|
311
|
-
getContainer(): HTMLElement;
|
|
312
|
-
getParameters(): TParamsStore;
|
|
313
|
-
hide(): void;
|
|
314
|
-
refresh(): Promise<TActionResult>;
|
|
315
|
-
setHasLoaded(): void;
|
|
316
|
-
show(): void;
|
|
317
|
-
PanelElement: ({ ActualPanelContainer, Element, }: {
|
|
318
|
-
ActualPanelContainer: PanelContainer;
|
|
319
|
-
Element: ReturnType<typeof importPanel>;
|
|
320
|
-
}) => react.JSX.Element | null;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
type TSwitchRoute = {
|
|
324
|
-
/**
|
|
325
|
-
* El callback será llamado si la ruta coincide.
|
|
326
|
-
*/
|
|
327
|
-
callback: (result: RegExpMatchArray) => unknown;
|
|
328
|
-
route: RegExp;
|
|
329
|
-
};
|
|
330
|
-
type TUseSwitch = TSwitchRoute[];
|
|
331
|
-
declare class Router extends EventEmitter<{
|
|
332
|
-
newRoute: string;
|
|
333
|
-
}> {
|
|
334
|
-
#private;
|
|
335
|
-
constructor();
|
|
336
|
-
/**
|
|
337
|
-
* Se evaluarán las rutas en orden y la primera en coincidir será tomada como
|
|
338
|
-
* resultado del cambio de ruta.
|
|
339
|
-
*
|
|
340
|
-
* Las rutas provistas deberán matchear contra el path actual. El path actual
|
|
341
|
-
* es la porción de la ruta luego del dominio y el contexto. Ejemplo:
|
|
342
|
-
*
|
|
343
|
-
* http://localhost/apia => path='/'
|
|
344
|
-
* http://localhost/apia/spa/categories/comidas/1 => path='/spa/categories/comidas/1'
|
|
345
|
-
*/
|
|
346
|
-
useSwitch: (routes: TUseSwitch) => void;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
declare class Dashboard extends EventEmitter<{
|
|
350
|
-
changeScene: string;
|
|
351
|
-
}> {
|
|
352
|
-
#private;
|
|
353
|
-
urlContext: string;
|
|
354
|
-
bootstrapper: DashboardPanelsBootstraper;
|
|
355
|
-
panels: Record<string, DashboardPanel> | null;
|
|
356
|
-
router: Router;
|
|
357
|
-
scenes: Record<string, string[]>;
|
|
358
|
-
getPanel: (id: string) => DashboardPanel;
|
|
359
|
-
getPanelByName: (name: string) => DashboardPanel | undefined;
|
|
360
|
-
constructor(panelsContainer: PanelContainer | undefined, urlContext: string);
|
|
361
|
-
loadScene: (scene?: string) => ReactPortal[];
|
|
362
|
-
Component: () => react.JSX.Element;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
declare function useDashboardContext(): Dashboard;
|
|
366
|
-
|
|
367
|
-
declare function useDashboardPanel(): DashboardPanel;
|
|
368
|
-
|
|
369
|
-
declare const eventsController: {
|
|
370
|
-
callbacks: TPanelEventRegister<any>[];
|
|
371
|
-
broadcast(eventType: string, payload: any): void;
|
|
372
|
-
fireEvent(origin: TPanelIdentifier, eventType: string, payload: any): void;
|
|
373
|
-
onEvent<PayloadEvent>(distinction: Partial<TPanelEventIdentifier>, callback: TPanelEventCallback<PayloadEvent>): () => void;
|
|
374
|
-
};
|
|
375
|
-
|
|
376
|
-
/**
|
|
377
|
-
* Este hook devuelve un método que puede ser llamado para emitir un evento en
|
|
378
|
-
* el panel desde el cual es llamado. Los eventos de panel son emitidos con id
|
|
379
|
-
* de panel, tipo de panel, nombre de panel y tipo de evento y las suscripciones
|
|
380
|
-
* pueden ser realizadas a un conjunto arbitrario de estos identificadores.
|
|
381
|
-
*
|
|
382
|
-
* El segundo parámetro del método fireEvent devuelto es el payload, que puede
|
|
383
|
-
* ser de cualquier tipo.
|
|
384
|
-
*/
|
|
385
|
-
declare function usePanelFireEvent(): (eventType: string, payload: any) => void;
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* Este hook permite realizar suscripciones a eventos de paneles. Deberá ser
|
|
389
|
-
* llamado una vez por cada suscripción que desee hacerse dentro de un panel y
|
|
390
|
-
* no se deberán ejecutar acciones para romper las suscripciones hechas, ya que
|
|
391
|
-
* este hook maneja esa lógica de forma automática.
|
|
392
|
-
*/
|
|
393
|
-
declare function usePanelOnEvent<PayloadEvent>(distinction: Partial<TPanelEventIdentifier>, callback: TPanelEventCallback<PayloadEvent>): void;
|
|
394
|
-
|
|
395
|
-
declare function changePanelTitle(panelId: string, newTitle: string): void;
|
|
396
|
-
declare function usePanelChangeTitle(): (newTitle: string) => void;
|
|
397
|
-
|
|
398
|
-
declare type ActionCreatorForCaseReducer<CR> = CR extends (state: any, action: infer Action) => any ? Action extends {
|
|
399
|
-
payload: infer P;
|
|
400
|
-
} ? (payload: P, panelName?: string) => unknown : () => unknown : () => unknown;
|
|
401
|
-
type CaseReducerActions<CaseReducers extends SliceCaseReducers<any>> = {
|
|
402
|
-
[Type in keyof CaseReducers]: ActionCreatorForCaseReducer<CaseReducers[Type]>;
|
|
403
|
-
};
|
|
404
|
-
declare function createPanelStore<PanelState = any, Reducers extends SliceCaseReducers<PanelState> = SliceCaseReducers<PanelState>>(panelType: TPanelType, initialState: PanelState, reducers: Reducers): [
|
|
405
|
-
() => CaseReducerActions<Reducers>,
|
|
406
|
-
<Selected>(panelName: TPanelName, selector: (state: PanelState) => Selected, comparator?: (a: Selected, b: Selected) => boolean) => Selected
|
|
407
|
-
];
|
|
408
|
-
|
|
409
|
-
export { Dashboard, LandingPagePanelWrapper, PanelIdentifier, PanelIdentifierContext, type TActionBehavior, type TActionDispatcher, type TActionResult, type TActionSource, type TBasicAction, type TFooter, type TPanelContext, type TPanelEvent, type TPanelEventCallback, type TPanelEventIdentifier, type TPanelEventRegister, type TPanelIdentifier, type TParamsStore, changePanelTitle, createPanelStore, eventsController, externalFirePanelAction, handleAction, store as parametersStore, saveParameters, useDashboardContext, useDashboardPanel, usePanelActions, usePanelChangeTitle, usePanelContext, usePanelFireEvent, usePanelIdentity, usePanelIsLoading, usePanelNetworkState, usePanelOnEvent, usePanelParametersSelector, usePanelPosition, useYieldPanelIsReady };
|
|
1
|
+
export { usePanelPosition } from './position/usePanelPosition.js';
|
|
2
|
+
export { LandingPagePanelWrapper } from './splash/panels/LandingPagePanelWrapper.js';
|
|
3
|
+
export { PanelIdentifier, PanelIdentifierContext } from './splash/panels/PanelIdentifier.js';
|
|
4
|
+
export { TPanelContext, usePanelContext } from './splash/panels/PanelContext/index.js';
|
|
5
|
+
export { TActionBehavior, TActionSource, TBasicAction, handleAction } from './actions/basicAction.js';
|
|
6
|
+
export { externalFirePanelAction } from './actions/externalFirePanelAction.js';
|
|
7
|
+
export { TActionDispatcher, TActionResult, TFooter, usePanelActions } from './actions/usePanelActions.js';
|
|
8
|
+
export { usePanelIsLoading } from './actions/usePanelIsLoading.js';
|
|
9
|
+
export { usePanelNetworkState } from './actions/usePanelNetworkState.js';
|
|
10
|
+
export { usePanelIdentity } from './common/usePanelIdentity.js';
|
|
11
|
+
export { saveParameters } from './config/saveParameters.js';
|
|
12
|
+
export { usePanelParametersSelector } from './config/usePanelParametersSelector.js';
|
|
13
|
+
export { TParamsStore, parametersStore } from './config/parametersStore.js';
|
|
14
|
+
export { useDashboardContext } from './dashboard/DashboardContext.js';
|
|
15
|
+
export { useDashboardPanel } from './dashboard/DashboardPanelContext.js';
|
|
16
|
+
export { Dashboard } from './dashboard/dashboard.js';
|
|
17
|
+
export { eventsController } from './eventsController/eventsController.js';
|
|
18
|
+
export { usePanelFireEvent } from './eventsController/usePanelFireEvent.js';
|
|
19
|
+
export { usePanelOnEvent } from './eventsController/usePanelOnEvent.js';
|
|
20
|
+
export { TPanelEvent, TPanelEventCallback, TPanelEventIdentifier, TPanelEventRegister, TPanelIdentifier } from './eventsController/types.js';
|
|
21
|
+
export { changePanelTitle, usePanelChangeTitle } from './panelsUtil/usePanelChangeTitle.js';
|
|
22
|
+
export { createPanelStore } from './panelsStore/createPanelStore.js';
|
|
23
|
+
export { useYieldPanelIsReady } from './splash/panels/PanelContext/useYieldPanelIsReady.js';
|
|
410
24
|
//# sourceMappingURL=index.d.ts.map
|