@apia/dashboard-controller 3.0.8 → 3.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/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
+ import * as _apia_util from '@apia/util';
1
2
  import { TId, EventEmitter } from '@apia/util';
2
3
  import * as react from 'react';
3
- import { ReactNode, FC, KeyboardEvent, MouseEvent, ComponentType, ReactPortal } from 'react';
4
+ import { FC, ReactNode, KeyboardEvent, MouseEvent as MouseEvent$1, ComponentType, ReactPortal } from 'react';
4
5
  import { TSpacingLayout } from '@apia/theme';
5
6
  import { TApiaApiResult, IApiaApiRequestConfig } from '@apia/api';
6
7
  import * as _reduxjs_toolkit_dist_configureStore from '@reduxjs/toolkit/dist/configureStore';
@@ -70,16 +71,42 @@ interface TPanelIdentifierProps {
70
71
  }
71
72
  declare const PanelIdentifier: ({ children, name, id, title, type, }: TPanelIdentifierProps) => react.JSX.Element;
72
73
 
73
- type TActionBehavior = 'DO_NOTHING' | 'NAVIGATE_URL' | 'CALL_AJAX_URL' | 'RUN_ACTION' | 'OPEN_TAB';
74
+ declare const eventsController: {
75
+ callbacks: TPanelEventRegister<any>[];
76
+ broadcast(eventType: string, payload: any): void;
77
+ fireEvent(origin: TPanelIdentifier, eventType: string, payload: any): void;
78
+ onEvent<PayloadEvent>(distinction: Partial<TPanelEventIdentifier>, callback: TPanelEventCallback<PayloadEvent>): () => void;
79
+ };
80
+
81
+ /**
82
+ * Este hook devuelve un método que puede ser llamado para emitir un evento en
83
+ * el panel desde el cual es llamado. Los eventos de panel son emitidos con id
84
+ * de panel, tipo de panel, nombre de panel y tipo de evento y las suscripciones
85
+ * pueden ser realizadas a un conjunto arbitrario de estos identificadores.
86
+ *
87
+ * El segundo parámetro del método fireEvent devuelto es el payload, que puede
88
+ * ser de cualquier tipo.
89
+ */
90
+ declare function usePanelFireEvent(): (eventType: string, payload: any) => void;
91
+
92
+ /**
93
+ * Este hook permite realizar suscripciones a eventos de paneles. Deberá ser
94
+ * llamado una vez por cada suscripción que desee hacerse dentro de un panel y
95
+ * no se deberán ejecutar acciones para romper las suscripciones hechas, ya que
96
+ * este hook maneja esa lógica de forma automática.
97
+ */
98
+ declare function usePanelOnEvent<PayloadEvent>(distinction: Partial<TPanelEventIdentifier>, callback: TPanelEventCallback<PayloadEvent>): void;
99
+
100
+ type TActionBehavior = 'DO_NOTHING' | 'NAVIGATE_URL' | 'CALL_AJAX_URL' | 'RUN_ACTION' | 'OPEN_TAB' | 'FIRE_EVENT' | 'DOWNLOAD';
74
101
  type TActionSource = 'CLICK' | 'DOUBLE_CLICK';
75
102
  type TBasicAction = {
76
103
  action: string;
77
104
  actionBehavior: TActionBehavior;
78
105
  actionSource: TActionSource;
79
- actionNewTabTitle: string;
106
+ additionalData: string;
80
107
  text: string;
81
108
  };
82
- declare function handleAction(panelId: string, event: KeyboardEvent | MouseEvent, action: TBasicAction): void;
109
+ declare function handleAction(panelIdentifier: TPanelIdentifier, event: KeyboardEvent | MouseEvent$1, action: TBasicAction): void;
83
110
 
84
111
  type TOnSucceed = (hasSucceed: boolean, data: TActionResult) => unknown;
85
112
 
@@ -150,6 +177,12 @@ declare function usePanelIsLoading(): boolean;
150
177
  */
151
178
  declare const usePanelNetworkState: () => boolean;
152
179
 
180
+ declare const useActionEventHandlers: () => {
181
+ onClick: (ev: React.MouseEvent<HTMLElement, MouseEvent>) => (action: TBasicAction) => void;
182
+ onDoubleClick: (ev: React.MouseEvent<HTMLElement, MouseEvent>) => (action: TBasicAction) => void;
183
+ onKeyDown: (ev: React.KeyboardEvent<HTMLElement>) => (action: TBasicAction) => void;
184
+ };
185
+
153
186
  type TPanelLayout = TSpacingLayout;
154
187
 
155
188
  /**
@@ -219,6 +252,26 @@ type TPanelContext = {
219
252
  setRef: (el: HTMLElement | null) => void;
220
253
  };
221
254
  declare function usePanelContext(): TPanelContext;
255
+ declare const PanelContextProvider: ({ children, value, }: {
256
+ children: ReactNode;
257
+ value: TPanelContext;
258
+ }) => react.JSX.Element;
259
+ declare function useMakePanelContext(panelProps: Omit<TPanelProps$1, 'children'>): {
260
+ footerContent: ReactNode;
261
+ title: string;
262
+ footer: TBasicAction | null;
263
+ handleFooterClick: (ev: react.MouseEvent<Element, MouseEvent> | react.KeyboardEvent<Element>) => void;
264
+ contextValue: TPanelContext;
265
+ ref: (el: HTMLDivElement) => void;
266
+ };
267
+
268
+ declare const EmptyPanelWrapper: PanelContainer;
269
+
270
+ type TUsePanelFooter = {
271
+ footerContent?: ReactNode;
272
+ footer: TFooter | null;
273
+ handleFooterClick: (ev: MouseEvent$1 | KeyboardEvent) => void;
274
+ };
222
275
 
223
276
  /**
224
277
  * Permite acceder a la identidad del panel actual.
@@ -371,33 +424,7 @@ declare function useDashboardContext(): Dashboard;
371
424
 
372
425
  declare function useDashboardPanel(): DashboardPanel;
373
426
 
374
- declare const eventsController: {
375
- callbacks: TPanelEventRegister<any>[];
376
- broadcast(eventType: string, payload: any): void;
377
- fireEvent(origin: TPanelIdentifier, eventType: string, payload: any): void;
378
- onEvent<PayloadEvent>(distinction: Partial<TPanelEventIdentifier>, callback: TPanelEventCallback<PayloadEvent>): () => void;
379
- };
380
-
381
- /**
382
- * Este hook devuelve un método que puede ser llamado para emitir un evento en
383
- * el panel desde el cual es llamado. Los eventos de panel son emitidos con id
384
- * de panel, tipo de panel, nombre de panel y tipo de evento y las suscripciones
385
- * pueden ser realizadas a un conjunto arbitrario de estos identificadores.
386
- *
387
- * El segundo parámetro del método fireEvent devuelto es el payload, que puede
388
- * ser de cualquier tipo.
389
- */
390
- declare function usePanelFireEvent(): (eventType: string, payload: any) => void;
391
-
392
- /**
393
- * Este hook permite realizar suscripciones a eventos de paneles. Deberá ser
394
- * llamado una vez por cada suscripción que desee hacerse dentro de un panel y
395
- * no se deberán ejecutar acciones para romper las suscripciones hechas, ya que
396
- * este hook maneja esa lógica de forma automática.
397
- */
398
- declare function usePanelOnEvent<PayloadEvent>(distinction: Partial<TPanelEventIdentifier>, callback: TPanelEventCallback<PayloadEvent>): void;
399
-
400
- declare function changePanelTitle(panelId: string, newTitle: string): void;
427
+ declare function changePanelTitle(identifier: TPanelIdentifier, newTitle: string): void;
401
428
  declare function usePanelChangeTitle(): (newTitle: string) => void;
402
429
 
403
430
  declare type ActionCreatorForCaseReducer<CR> = CR extends (state: any, action: infer Action) => any ? Action extends {
@@ -411,5 +438,20 @@ declare function createPanelStore<PanelState = any, Reducers extends SliceCaseRe
411
438
  <Selected>(panelName: TPanelName, selector: (state: PanelState) => Selected, comparator?: (a: Selected, b: Selected) => boolean) => Selected
412
439
  ];
413
440
 
414
- 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 };
441
+ declare function usePanelImage(): string;
442
+ declare function usePanelTitleDescription(): string;
443
+
444
+ declare const PanelButtons: react.FC<Omit<TPanelProps$1, "children" | "initialData"> & {
445
+ id: _apia_util.TId;
446
+ }>;
447
+
448
+ declare const PanelFooter: ({ footerContent, isRefreshable, footer, handleFooterClick, }: TUsePanelFooter & {
449
+ isRefreshable: boolean;
450
+ }) => react.JSX.Element;
451
+
452
+ declare const NetworkState: ({ title }: {
453
+ title: string;
454
+ }) => react.JSX.Element;
455
+
456
+ export { Dashboard, EmptyPanelWrapper, LandingPagePanelWrapper, NetworkState, PanelButtons, type PanelContainer, PanelContextProvider, PanelFooter, 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, type TUsePanelFooter, changePanelTitle, createPanelStore, eventsController, externalFirePanelAction, handleAction, store as parametersStore, saveParameters, useActionEventHandlers, useDashboardContext, useDashboardPanel, useMakePanelContext, usePanelActions, usePanelChangeTitle, usePanelContext, usePanelFireEvent, usePanelIdentity, usePanelImage, usePanelIsLoading, usePanelNetworkState, usePanelOnEvent, usePanelParametersSelector, usePanelPosition, usePanelTitleDescription, useYieldPanelIsReady };
415
457
  //# sourceMappingURL=index.d.ts.map