@apia/dashboard-controller 5.0.0 → 5.0.3
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/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 +76 -0
- package/dist/actions/firePanelAction.js.map +1 -0
- package/dist/actions/useActionEventHandlers.d.ts +10 -0
- package/dist/actions/useActionEventHandlers.d.ts.map +1 -0
- package/dist/actions/useActionEventHandlers.js +67 -0
- package/dist/actions/useActionEventHandlers.js.map +1 -0
- package/dist/actions/usePanelActions.d.ts +65 -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 +27 -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 +49 -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/ContainerNotFound.js +14 -0
- package/dist/dashboard/ContainerNotFound.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 +48 -0
- package/dist/dashboard/DashboardPanel.d.ts.map +1 -0
- package/dist/dashboard/DashboardPanel.js +264 -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 +17 -0
- package/dist/dashboard/PanelNotFound.js.map +1 -0
- package/dist/dashboard/dashboard.d.ts +28 -0
- package/dist/dashboard/dashboard.d.ts.map +1 -0
- package/dist/dashboard/dashboard.js +174 -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 +31 -459
- package/dist/index.js +28 -2241
- 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 +7 -0
- package/dist/panelsUtil/usePanelChangeTitle.d.ts.map +1 -0
- package/dist/panelsUtil/usePanelChangeTitle.js +19 -0
- package/dist/panelsUtil/usePanelChangeTitle.js.map +1 -0
- package/dist/panelsUtil/usePanelTitleAction.d.ts +5 -0
- package/dist/panelsUtil/usePanelTitleAction.d.ts.map +1 -0
- package/dist/panelsUtil/usePanelTitleAction.js +48 -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 +66 -0
- package/dist/splash/events/Drop.js.map +1 -0
- package/dist/splash/panels/DefaultPanelWrapper/CollapseButton.js +31 -0
- package/dist/splash/panels/DefaultPanelWrapper/CollapseButton.js.map +1 -0
- package/dist/splash/panels/DefaultPanelWrapper/NetworkState.d.ts +8 -0
- package/dist/splash/panels/DefaultPanelWrapper/NetworkState.d.ts.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.d.ts +10 -0
- package/dist/splash/panels/DefaultPanelWrapper/PanelButtons.d.ts.map +1 -0
- package/dist/splash/panels/DefaultPanelWrapper/PanelButtons.js +32 -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/index.js +82 -0
- package/dist/splash/panels/DefaultPanelWrapper/index.js.map +1 -0
- package/dist/splash/panels/EmptyPanelWrapper/index.d.ts +6 -0
- package/dist/splash/panels/EmptyPanelWrapper/index.d.ts.map +1 -0
- package/dist/splash/panels/EmptyPanelWrapper/index.js +10 -0
- package/dist/splash/panels/EmptyPanelWrapper/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 +49 -0
- package/dist/splash/panels/LandingPagePanelWrapper.js.map +1 -0
- package/dist/splash/panels/PanelContext/PanelFooter.d.ts +9 -0
- package/dist/splash/panels/PanelContext/PanelFooter.d.ts.map +1 -0
- package/dist/splash/panels/PanelContext/PanelFooter.js +72 -0
- package/dist/splash/panels/PanelContext/PanelFooter.js.map +1 -0
- package/dist/splash/panels/PanelContext/index.d.ts +46 -0
- package/dist/splash/panels/PanelContext/index.d.ts.map +1 -0
- package/dist/splash/panels/PanelContext/index.js +66 -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.d.ts +11 -0
- package/dist/splash/panels/PanelContext/usePanelFooter.d.ts.map +1 -0
- package/dist/splash/panels/PanelContext/usePanelFooter.js +35 -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 +244 -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 +30 -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 +55 -0
- package/dist/util.js.map +1 -0
- package/package.json +9 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkState.js","sources":["../../../../src/splash/panels/DefaultPanelWrapper/NetworkState.tsx"],"sourcesContent":["import { Icon } from '@apia/icons';\r\nimport { getLabel } from '@apia/util';\r\nimport { usePanelNetworkState } from '../../../actions';\r\n\r\nexport const NetworkState = ({ title }: { title: string }) => {\r\n const isConnected = usePanelNetworkState();\r\n return (\r\n <>\r\n {!isConnected && (\r\n <Icon\r\n tabIndex={0}\r\n title={\r\n getLabel('lblTestDBNoOk', {\r\n text: {\r\n TOK1: title,\r\n },\r\n }).text\r\n }\r\n aria-label={\r\n getLabel('lblTestDBNoOk', {\r\n text: {\r\n TOK1: title,\r\n },\r\n }).text\r\n }\r\n name=\"Alert\"\r\n />\r\n )}\r\n </>\r\n );\r\n};\r\n"],"names":[],"mappings":";;;;;AAIO,MAAM,YAAA,GAAe,CAAC,EAAE,KAAA,EAAM,KAAyB;AAC5D,EAAA,MAAM,cAAc,oBAAA,EAAqB;AACzC,EAAA,uBACE,GAAA,CAAA,QAAA,EAAA,EACG,WAAC,WAAA,oBACA,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,QAAA,EAAU,CAAA;AAAA,MACV,KAAA,EACE,SAAS,eAAA,EAAiB;AAAA,QACxB,IAAA,EAAM;AAAA,UACJ,IAAA,EAAM;AAAA;AACR,OACD,CAAA,CAAE,IAAA;AAAA,MAEL,YAAA,EACE,SAAS,eAAA,EAAiB;AAAA,QACxB,IAAA,EAAM;AAAA,UACJ,IAAA,EAAM;AAAA;AACR,OACD,CAAA,CAAE,IAAA;AAAA,MAEL,IAAA,EAAK;AAAA;AAAA,GACP,EAEJ,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as _apia_util from '@apia/util';
|
|
3
|
+
import { TPanelProps } from '../../../types.js';
|
|
4
|
+
|
|
5
|
+
declare const PanelButtons: react.FC<Omit<TPanelProps, "children" | "initialData"> & {
|
|
6
|
+
id: _apia_util.TId;
|
|
7
|
+
}>;
|
|
8
|
+
|
|
9
|
+
export { PanelButtons };
|
|
10
|
+
//# sourceMappingURL=PanelButtons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PanelButtons.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from '@apia/theme/jsx-runtime';
|
|
2
|
+
import { makeImperativeComponent } from '@apia/util';
|
|
3
|
+
import { RefreshButton } from './RefreshButton.js';
|
|
4
|
+
import { SettingsButton } from './SettingsButton.js';
|
|
5
|
+
import { CollapseButton } from './CollapseButton.js';
|
|
6
|
+
|
|
7
|
+
const [, panelButtonsActions, PanelButtons] = makeImperativeComponent()({
|
|
8
|
+
Component: (props) => {
|
|
9
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10
|
+
props.isRefreshable && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(RefreshButton, { ...props }) }),
|
|
11
|
+
props.isConfigurable && /* @__PURE__ */ jsx(SettingsButton, { title: props.title }),
|
|
12
|
+
props.hideCollapse ? null : props.isCollapsed ? /* @__PURE__ */ jsx(
|
|
13
|
+
CollapseButton,
|
|
14
|
+
{
|
|
15
|
+
icon: "ArrowDownThin",
|
|
16
|
+
title: props.title,
|
|
17
|
+
isCollapsed: true
|
|
18
|
+
}
|
|
19
|
+
) : /* @__PURE__ */ jsx(
|
|
20
|
+
CollapseButton,
|
|
21
|
+
{
|
|
22
|
+
icon: "ArrowUpThin",
|
|
23
|
+
title: props.title,
|
|
24
|
+
isCollapsed: false
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
] });
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export { PanelButtons, panelButtonsActions };
|
|
32
|
+
//# sourceMappingURL=PanelButtons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PanelButtons.js","sources":["../../../../src/splash/panels/DefaultPanelWrapper/PanelButtons.tsx"],"sourcesContent":["import { makeImperativeComponent } from '@apia/util';\r\nimport { RefreshButton } from './RefreshButton';\r\nimport { SettingsButton } from './SettingsButton';\r\nimport { TPanelProps } from '../../../types';\r\nimport { CollapseButton } from './CollapseButton';\r\n\r\nexport const [, panelButtonsActions, PanelButtons] = makeImperativeComponent<\r\n Omit<TPanelProps, 'initialData' | 'children'>,\r\n {\r\n disable: boolean;\r\n }\r\n>()({\r\n Component: (props) => {\r\n return (\r\n <>\r\n {props.isRefreshable && (\r\n <>\r\n <RefreshButton {...props} />\r\n </>\r\n )}\r\n {props.isConfigurable && <SettingsButton title={props.title} />}\r\n {props.hideCollapse ? null : props.isCollapsed ? (\r\n <CollapseButton\r\n icon=\"ArrowDownThin\"\r\n title={props.title}\r\n isCollapsed={true}\r\n />\r\n ) : (\r\n <CollapseButton\r\n icon=\"ArrowUpThin\"\r\n title={props.title}\r\n isCollapsed={false}\r\n />\r\n )}\r\n </>\r\n );\r\n },\r\n});\r\n"],"names":[],"mappings":";;;;;;AAMO,MAAM,GAAG,mBAAA,EAAqB,YAAY,CAAA,GAAI,yBAKnD,CAAE;AAAA,EACF,SAAA,EAAW,CAAC,KAAA,KAAU;AACpB,IAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,MAAA,KAAA,CAAM,iCACL,GAAA,CAAA,QAAA,EAAA,EACE,QAAA,kBAAA,GAAA,CAAC,aAAA,EAAA,EAAe,GAAG,OAAO,CAAA,EAC5B,CAAA;AAAA,MAED,MAAM,cAAA,oBAAkB,GAAA,CAAC,cAAA,EAAA,EAAe,KAAA,EAAO,MAAM,KAAA,EAAO,CAAA;AAAA,MAC5D,KAAA,CAAM,YAAA,GAAe,IAAA,GAAO,KAAA,CAAM,WAAA,mBACjC,GAAA;AAAA,QAAC,cAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAK,eAAA;AAAA,UACL,OAAO,KAAA,CAAM,KAAA;AAAA,UACb,WAAA,EAAa;AAAA;AAAA,OACf,mBAEA,GAAA;AAAA,QAAC,cAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAK,aAAA;AAAA,UACL,OAAO,KAAA,CAAM,KAAA;AAAA,UACb,WAAA,EAAa;AAAA;AAAA;AACf,KAAA,EAEJ,CAAA;AAAA;AAGN,CAAC;;;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx } from '@apia/theme/jsx-runtime';
|
|
2
|
+
import { IconButton } from '@apia/components';
|
|
3
|
+
import { useImperativeComponentEvents, getLabel } from '@apia/util';
|
|
4
|
+
import { useState, useCallback } from 'react';
|
|
5
|
+
import { usePanelActions } from '../../../actions/usePanelActions.js';
|
|
6
|
+
import { usePanelIsLoading } from '../../../actions/usePanelIsLoading.js';
|
|
7
|
+
|
|
8
|
+
const RefreshButton = (props) => {
|
|
9
|
+
const [isDisabled, setIsDisabled] = useState(false);
|
|
10
|
+
const isLoading = usePanelIsLoading();
|
|
11
|
+
const dispatch = usePanelActions();
|
|
12
|
+
useImperativeComponentEvents({
|
|
13
|
+
disable(newDisabledValue) {
|
|
14
|
+
setIsDisabled(newDisabledValue);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
IconButton,
|
|
19
|
+
{
|
|
20
|
+
icon: "Refresh",
|
|
21
|
+
variant: "buttons.icon-outline",
|
|
22
|
+
className: "panel__iconButton panel__refresh",
|
|
23
|
+
size: "Md",
|
|
24
|
+
onClick: useCallback(() => {
|
|
25
|
+
void dispatch({ action: "refresh" });
|
|
26
|
+
}, [dispatch]),
|
|
27
|
+
title: getLabel("lblRefreshPnl", { text: { TOK1: props.title } }).text,
|
|
28
|
+
isLoading,
|
|
29
|
+
disabled: isDisabled
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { RefreshButton };
|
|
35
|
+
//# sourceMappingURL=RefreshButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefreshButton.js","sources":["../../../../src/splash/panels/DefaultPanelWrapper/RefreshButton.tsx"],"sourcesContent":["import { IconButton } from '@apia/components';\r\nimport { getLabel, useImperativeComponentEvents } from '@apia/util';\r\nimport { useCallback, useState } from 'react';\r\nimport { usePanelActions, usePanelIsLoading } from '../../../actions';\r\n\r\nexport const RefreshButton = (props: {\r\n refreshOnStart: boolean;\r\n refreshOnHome: boolean;\r\n title: string;\r\n}) => {\r\n const [isDisabled, setIsDisabled] = useState(false);\r\n\r\n const isLoading = usePanelIsLoading();\r\n const dispatch = usePanelActions();\r\n\r\n useImperativeComponentEvents({\r\n disable(newDisabledValue: boolean) {\r\n setIsDisabled(newDisabledValue);\r\n },\r\n });\r\n\r\n return (\r\n <IconButton\r\n icon=\"Refresh\"\r\n variant=\"buttons.icon-outline\"\r\n className=\"panel__iconButton panel__refresh\"\r\n size=\"Md\"\r\n onClick={useCallback(() => {\r\n void dispatch({ action: 'refresh' });\r\n }, [dispatch])}\r\n title={getLabel('lblRefreshPnl', { text: { TOK1: props.title } }).text}\r\n isLoading={isLoading}\r\n disabled={isDisabled}\r\n />\r\n );\r\n};\r\n"],"names":[],"mappings":";;;;;;;AAKO,MAAM,aAAA,GAAgB,CAAC,KAAA,KAIxB;AACJ,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAAS,KAAK,CAAA;AAElD,EAAA,MAAM,YAAY,iBAAA,EAAkB;AACpC,EAAA,MAAM,WAAW,eAAA,EAAgB;AAEjC,EAAA,4BAAA,CAA6B;AAAA,IAC3B,QAAQ,gBAAA,EAA2B;AACjC,MAAA,aAAA,CAAc,gBAAgB,CAAA;AAAA;AAChC,GACD,CAAA;AAED,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,IAAA,EAAK,SAAA;AAAA,MACL,OAAA,EAAQ,sBAAA;AAAA,MACR,SAAA,EAAU,kCAAA;AAAA,MACV,IAAA,EAAK,IAAA;AAAA,MACL,OAAA,EAAS,YAAY,MAAM;AACzB,QAAA,KAAK,QAAA,CAAS,EAAE,MAAA,EAAQ,SAAA,EAAW,CAAA;AAAA,OACrC,EAAG,CAAC,QAAQ,CAAC,CAAA;AAAA,MACb,KAAA,EAAO,QAAA,CAAS,eAAA,EAAiB,EAAE,IAAA,EAAM,EAAE,IAAA,EAAM,KAAA,CAAM,KAAA,EAAM,EAAG,CAAA,CAAE,IAAA;AAAA,MAClE,SAAA;AAAA,MACA,QAAA,EAAU;AAAA;AAAA,GACZ;AAEJ;;;;"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx } from '@apia/theme/jsx-runtime';
|
|
2
|
+
import { IconButton } from '@apia/components';
|
|
3
|
+
import { useImperativeComponentEvents, getLabel } from '@apia/util';
|
|
4
|
+
import { useState, useCallback } from 'react';
|
|
5
|
+
import { usePanelConfig } from '../../../config/usePanelConfig.js';
|
|
6
|
+
import { usePanelActions } from '../../../actions/usePanelActions.js';
|
|
7
|
+
import { panelButtonsActions } from './PanelButtons.js';
|
|
8
|
+
import { usePanelIdentity } from '../../../common/usePanelIdentity.js';
|
|
9
|
+
|
|
10
|
+
const SettingsButton = (props) => {
|
|
11
|
+
const { panelId } = usePanelIdentity();
|
|
12
|
+
const configure = usePanelConfig();
|
|
13
|
+
const [isDisabled, setIsDisabled] = useState(false);
|
|
14
|
+
useImperativeComponentEvents({
|
|
15
|
+
disable(newDisabledValue) {
|
|
16
|
+
setIsDisabled(newDisabledValue);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
usePanelActions({
|
|
20
|
+
refresh() {
|
|
21
|
+
panelButtonsActions(panelId, "disable", false);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const openSettings = useCallback(() => {
|
|
25
|
+
try {
|
|
26
|
+
configure();
|
|
27
|
+
} catch (_) {
|
|
28
|
+
}
|
|
29
|
+
}, [configure]);
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
31
|
+
IconButton,
|
|
32
|
+
{
|
|
33
|
+
icon: "Settings",
|
|
34
|
+
size: "Md",
|
|
35
|
+
variant: "buttons.icon-outline",
|
|
36
|
+
className: "panel__iconButton panel__settings",
|
|
37
|
+
onClick: openSettings,
|
|
38
|
+
title: getLabel("lblOpenPnlConf", { text: { TOK1: props.title } }).text,
|
|
39
|
+
disabled: isDisabled
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { SettingsButton };
|
|
45
|
+
//# sourceMappingURL=SettingsButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettingsButton.js","sources":["../../../../src/splash/panels/DefaultPanelWrapper/SettingsButton.tsx"],"sourcesContent":["import { IconButton } from '@apia/components';\r\nimport { getLabel, useImperativeComponentEvents } from '@apia/util';\r\nimport { useCallback, useState } from 'react';\r\nimport { usePanelConfig } from '../../../config/usePanelConfig';\r\nimport { usePanelActions } from '../../../actions';\r\nimport { panelButtonsActions } from './PanelButtons';\r\nimport { usePanelIdentity } from '../../../common';\r\n\r\nexport const SettingsButton = (props: { title: string }) => {\r\n const { panelId } = usePanelIdentity();\r\n const configure = usePanelConfig();\r\n\r\n const [isDisabled, setIsDisabled] = useState(false);\r\n useImperativeComponentEvents({\r\n disable(newDisabledValue: boolean) {\r\n setIsDisabled(newDisabledValue);\r\n },\r\n });\r\n\r\n usePanelActions({\r\n refresh() {\r\n panelButtonsActions(panelId, 'disable', false);\r\n },\r\n });\r\n\r\n const openSettings = useCallback(() => {\r\n try {\r\n configure();\r\n } catch (_) {\r\n /* empty */\r\n }\r\n }, [configure]);\r\n\r\n return (\r\n <IconButton\r\n icon=\"Settings\"\r\n size=\"Md\"\r\n variant=\"buttons.icon-outline\"\r\n className=\"panel__iconButton panel__settings\"\r\n onClick={openSettings}\r\n title={getLabel('lblOpenPnlConf', { text: { TOK1: props.title } }).text}\r\n disabled={isDisabled}\r\n />\r\n );\r\n};\r\n"],"names":[],"mappings":";;;;;;;;;AAQO,MAAM,cAAA,GAAiB,CAAC,KAAA,KAA6B;AAC1D,EAAA,MAAM,EAAE,OAAA,EAAQ,GAAI,gBAAA,EAAiB;AACrC,EAAA,MAAM,YAAY,cAAA,EAAe;AAEjC,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAAS,KAAK,CAAA;AAClD,EAAA,4BAAA,CAA6B;AAAA,IAC3B,QAAQ,gBAAA,EAA2B;AACjC,MAAA,aAAA,CAAc,gBAAgB,CAAA;AAAA;AAChC,GACD,CAAA;AAED,EAAA,eAAA,CAAgB;AAAA,IACd,OAAA,GAAU;AACR,MAAA,mBAAA,CAAoB,OAAA,EAAS,WAAW,KAAK,CAAA;AAAA;AAC/C,GACD,CAAA;AAED,EAAA,MAAM,YAAA,GAAe,YAAY,MAAM;AACrC,IAAA,IAAI;AACF,MAAA,SAAA,EAAU;AAAA,aACH,CAAA,EAAG;AAAA;AAEZ,GACF,EAAG,CAAC,SAAS,CAAC,CAAA;AAEd,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,IAAA,EAAK,UAAA;AAAA,MACL,IAAA,EAAK,IAAA;AAAA,MACL,OAAA,EAAQ,sBAAA;AAAA,MACR,SAAA,EAAU,mCAAA;AAAA,MACV,OAAA,EAAS,YAAA;AAAA,MACT,KAAA,EAAO,QAAA,CAAS,gBAAA,EAAkB,EAAE,IAAA,EAAM,EAAE,IAAA,EAAM,KAAA,CAAM,KAAA,EAAM,EAAG,CAAA,CAAE,IAAA;AAAA,MACnE,QAAA,EAAU;AAAA;AAAA,GACZ;AAEJ;;;;"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx, jsxs } from '@apia/theme/jsx-runtime';
|
|
2
|
+
import { Box, getVariant } from '@apia/theme';
|
|
3
|
+
import { usePanelIdentity } from '../../../common/usePanelIdentity.js';
|
|
4
|
+
import { NetworkState } from './NetworkState.js';
|
|
5
|
+
import { PanelButtons } from './PanelButtons.js';
|
|
6
|
+
import { usePanelIsLoading } from '../../../actions/usePanelIsLoading.js';
|
|
7
|
+
import { useMakePanelContext, PanelContextProvider } from '../PanelContext/index.js';
|
|
8
|
+
import { PanelFooter } from '../PanelContext/PanelFooter.js';
|
|
9
|
+
import { usePanelTitleDescription, usePanelImage } from '../../../panelsUtil/usePanelTitleAction.js';
|
|
10
|
+
import { AutoEllipsis } from '@apia/components';
|
|
11
|
+
import AnimateHeight from 'react-animate-height';
|
|
12
|
+
|
|
13
|
+
const DefaultPanelWrapper = ({ children, ...props }) => {
|
|
14
|
+
const { panelId, panelName, panelType } = usePanelIdentity();
|
|
15
|
+
const { contextValue, title, ref, ...footerProps } = useMakePanelContext(props);
|
|
16
|
+
const panelTitleDescription = usePanelTitleDescription();
|
|
17
|
+
const panelImage = usePanelImage() ?? props.image;
|
|
18
|
+
const showHeader = props.showTitle || props.isConfigurable || props.isRefreshable || panelImage;
|
|
19
|
+
const isLoading = usePanelIsLoading();
|
|
20
|
+
return /* @__PURE__ */ jsx(Box, { ...getVariant("layout.common.dashboards.panel"), children: /* @__PURE__ */ jsx(PanelContextProvider, { value: contextValue, children: /* @__PURE__ */ jsxs(
|
|
21
|
+
"div",
|
|
22
|
+
{
|
|
23
|
+
ref,
|
|
24
|
+
className: `panel__container ${isLoading ? "isLoading" : ""} ${props.isCollapsed ? "collapsed" : ""}`,
|
|
25
|
+
"data-panelname": panelName,
|
|
26
|
+
"data-paneltype": panelType,
|
|
27
|
+
"data-panelid": panelId,
|
|
28
|
+
children: [
|
|
29
|
+
showHeader && /* @__PURE__ */ jsxs(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
draggable: props.canMove,
|
|
33
|
+
className: `panel__header ${props.canMove ? "drag_panel_container" : ""}`,
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsxs(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
className: "panel__header__left",
|
|
39
|
+
sx: {
|
|
40
|
+
maxWidth: "75%",
|
|
41
|
+
overflow: "hidden",
|
|
42
|
+
whiteSpace: "nowrap"
|
|
43
|
+
},
|
|
44
|
+
children: [
|
|
45
|
+
panelImage && !panelImage.match("(^.+null$)") && /* @__PURE__ */ jsx("img", { src: panelImage, className: "panel__icon" }),
|
|
46
|
+
/* @__PURE__ */ jsxs(AutoEllipsis, { children: [
|
|
47
|
+
props.showTitle && /* @__PURE__ */ jsx(
|
|
48
|
+
"span",
|
|
49
|
+
{
|
|
50
|
+
className: "panel__title",
|
|
51
|
+
title: panelTitleDescription ?? title,
|
|
52
|
+
children: title
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ jsx(NetworkState, { title })
|
|
56
|
+
] })
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
/* @__PURE__ */ jsx("div", { className: `panel__header__buttons`, children: /* @__PURE__ */ jsx(PanelButtons, { ...props, id: panelId }) })
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
/* @__PURE__ */ jsxs(
|
|
65
|
+
AnimateHeight,
|
|
66
|
+
{
|
|
67
|
+
className: `accordion__item__content ${props.isCollapsed ? " expanded" : ""}`,
|
|
68
|
+
height: !props.isCollapsed ? "auto" : 0,
|
|
69
|
+
duration: 100,
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ jsx("div", { className: "panel__content", children }),
|
|
72
|
+
/* @__PURE__ */ jsx(PanelFooter, { isRefreshable: props.isRefreshable, ...footerProps })
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
) }) });
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export { DefaultPanelWrapper };
|
|
82
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/splash/panels/DefaultPanelWrapper/index.tsx"],"sourcesContent":["import { Box, getVariant } from '@apia/theme';\r\nimport { PanelContainer } from '../../../types';\r\nimport { usePanelIdentity } from '../../../common';\r\nimport { NetworkState } from './NetworkState';\r\nimport { PanelButtons } from './PanelButtons';\r\nimport { usePanelIsLoading } from '../../../actions';\r\nimport { PanelContextProvider, useMakePanelContext } from '../PanelContext';\r\nimport { PanelFooter } from '../PanelContext/PanelFooter';\r\nimport {\r\n usePanelImage,\r\n usePanelTitleDescription,\r\n} from '../../../panelsUtil/usePanelTitleAction';\r\nimport { AutoEllipsis } from '@apia/components';\r\nimport AnimateHeight from 'react-animate-height';\r\n\r\nexport const DefaultPanelWrapper: PanelContainer = ({ children, ...props }) => {\r\n const { panelId, panelName, panelType } = usePanelIdentity();\r\n\r\n const { contextValue, title, ref, ...footerProps } =\r\n useMakePanelContext(props);\r\n\r\n const panelTitleDescription = usePanelTitleDescription();\r\n const panelImage = usePanelImage() ?? props.image;\r\n\r\n const showHeader =\r\n props.showTitle ||\r\n props.isConfigurable ||\r\n props.isRefreshable ||\r\n panelImage;\r\n\r\n const isLoading = usePanelIsLoading();\r\n return (\r\n <Box {...getVariant('layout.common.dashboards.panel')}>\r\n <PanelContextProvider value={contextValue}>\r\n <div\r\n ref={ref}\r\n className={`panel__container ${isLoading ? 'isLoading' : ''} ${props.isCollapsed ? 'collapsed' : ''}`}\r\n data-panelname={panelName}\r\n data-paneltype={panelType}\r\n data-panelid={panelId}\r\n >\r\n {showHeader && (\r\n <div\r\n draggable={props.canMove}\r\n className={`panel__header ${props.canMove ? 'drag_panel_container' : ''}`}\r\n >\r\n <div\r\n className=\"panel__header__left\"\r\n sx={{\r\n maxWidth: '75%',\r\n overflow: 'hidden',\r\n whiteSpace: 'nowrap',\r\n }}\r\n >\r\n {panelImage && !panelImage.match('(^.+null$)') && (\r\n <img src={panelImage} className=\"panel__icon\" />\r\n )}\r\n <AutoEllipsis>\r\n {props.showTitle && (\r\n <span\r\n className=\"panel__title\"\r\n title={panelTitleDescription ?? title}\r\n >\r\n {title}\r\n </span>\r\n )}\r\n <NetworkState title={title} />\r\n </AutoEllipsis>\r\n </div>\r\n\r\n <div className={`panel__header__buttons`}>\r\n <PanelButtons {...props} id={panelId} />\r\n </div>\r\n </div>\r\n )}\r\n <AnimateHeight\r\n className={`accordion__item__content ${props.isCollapsed ? ' expanded' : ''}`}\r\n height={!props.isCollapsed ? 'auto' : 0}\r\n duration={100}\r\n >\r\n <div className=\"panel__content\">{children}</div>\r\n <PanelFooter isRefreshable={props.isRefreshable} {...footerProps} />\r\n </AnimateHeight>\r\n </div>\r\n </PanelContextProvider>\r\n </Box>\r\n );\r\n};\r\n"],"names":[],"mappings":";;;;;;;;;;;;AAeO,MAAM,sBAAsC,CAAC,EAAE,QAAA,EAAU,GAAG,OAAM,KAAM;AAC7E,EAAA,MAAM,EAAE,OAAA,EAAS,SAAA,EAAW,SAAA,KAAc,gBAAA,EAAiB;AAE3D,EAAA,MAAM,EAAE,cAAc,KAAA,EAAO,GAAA,EAAK,GAAG,WAAA,EAAY,GAC/C,oBAAoB,KAAK,CAAA;AAE3B,EAAA,MAAM,wBAAwB,wBAAA,EAAyB;AACvD,EAAA,MAAM,UAAA,GAAa,aAAA,EAAc,IAAK,KAAA,CAAM,KAAA;AAE5C,EAAA,MAAM,aACJ,KAAA,CAAM,SAAA,IACN,KAAA,CAAM,cAAA,IACN,MAAM,aAAA,IACN,UAAA;AAEF,EA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A;AAAA,0BACV,OAAO,qBAAA,IAAyB,KAAA;AAAA,0BAE/B,QAAA,EAAA;AAAA;AAAA,uBACH;AAAA,sCAEF,GAAA,CAAC,gBAAa,KAAA,EAAc;AAAA,qBAAA,EAC9B;AAAA;AAAA;AAAA,eACF;AAAA,8BAEA,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,CAAA,sBAAA,CAAA,EACd,QAAA,kBAAA,GAAA,CAAC,gBAAc,GAAG,KAAA,EAAO,EAAA,EAAI,OAAA,EAAS,CAAA,EACxC;AAAA;AAAA;AAAA,SACF;AAAA,wBAEF,IAAA;AAAA,UAAC,aAAA;AAAA,UAAA;AAAA,YACC,SAAA,EAAW,CAAA,yBAAA,EAA4B,KAAA,CAAM,WAAA,GAAc,cAAc,EAAE,CAAA,CAAA;AAAA,YAC3E,MAAA,EAAQ,CAAC,KAAA,CAAM,WAAA,GAAc,MAAA,GAAS,CAAA;AAAA,YACtC,QAAA,EAAU,GAAA;AAAA,YAEV,QAAA,EAAA;AAAA,8BAAA,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,gBAAA,EAAkB,QAAA,EAAS,CAAA;AAAA,kCACzC,WAAA,EAAA,EAAY,aAAA,EAAe,KAAA,CAAM,aAAA,EAAgB,GAAG,WAAA,EAAa;AAAA;AAAA;AAAA;AACpE;AAAA;AAAA,KAEJ,CAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx } from '@apia/theme/jsx-runtime';
|
|
2
|
+
import { useMakePanelContext, PanelContextProvider } from '../PanelContext/index.js';
|
|
3
|
+
|
|
4
|
+
const EmptyPanelWrapper = (props) => {
|
|
5
|
+
const { contextValue } = useMakePanelContext(props);
|
|
6
|
+
return /* @__PURE__ */ jsx(PanelContextProvider, { value: contextValue, children: props.children });
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { EmptyPanelWrapper };
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/splash/panels/EmptyPanelWrapper/index.tsx"],"sourcesContent":["import { PanelContainer } from '../../../types';\r\nimport { PanelContextProvider, useMakePanelContext } from '../PanelContext';\r\n\r\nexport const EmptyPanelWrapper: PanelContainer = (props) => {\r\n const { contextValue } = useMakePanelContext(props);\r\n\r\n return (\r\n <PanelContextProvider value={contextValue}>\r\n {props.children}\r\n </PanelContextProvider>\r\n );\r\n};\r\n"],"names":[],"mappings":";;;AAGO,MAAM,iBAAA,GAAoC,CAAC,KAAA,KAAU;AAC1D,EAAA,MAAM,EAAE,YAAA,EAAa,GAAI,mBAAA,CAAoB,KAAK,CAAA;AAElD,EAAA,uBACE,GAAA,CAAC,oBAAA,EAAA,EAAqB,KAAA,EAAO,YAAA,EAC1B,gBAAM,QAAA,EACT,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LandingPagePanelWrapper.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx, jsxs } from '@apia/theme/jsx-runtime';
|
|
2
|
+
import { NetworkState } from './DefaultPanelWrapper/NetworkState.js';
|
|
3
|
+
import { usePanelIdentity } from '../../common/usePanelIdentity.js';
|
|
4
|
+
import { useMakePanelContext, PanelContextProvider } from './PanelContext/index.js';
|
|
5
|
+
import { PanelFooter } from './PanelContext/PanelFooter.js';
|
|
6
|
+
import { usePanelTitleAction, usePanelTitleDescription } from '../../panelsUtil/usePanelTitleAction.js';
|
|
7
|
+
import { useDashboardContext } from '../../dashboard/DashboardContext.js';
|
|
8
|
+
|
|
9
|
+
const LandingPagePanelWrapper = ({
|
|
10
|
+
children,
|
|
11
|
+
...props
|
|
12
|
+
}) => {
|
|
13
|
+
const { panelId, panelName, panelType } = usePanelIdentity();
|
|
14
|
+
const { contextValue, title, ref, ...footerProps } = useMakePanelContext(props);
|
|
15
|
+
const panelTitleAction = usePanelTitleAction();
|
|
16
|
+
const panelTitleDescription = usePanelTitleDescription();
|
|
17
|
+
const dashboard = useDashboardContext();
|
|
18
|
+
if (dashboard.getPanel(panelId).props.hasRss)
|
|
19
|
+
console.log(dashboard.getPanel(panelId).props);
|
|
20
|
+
return /* @__PURE__ */ jsx(PanelContextProvider, { value: contextValue, children: /* @__PURE__ */ jsxs(
|
|
21
|
+
"div",
|
|
22
|
+
{
|
|
23
|
+
className: "panel__container",
|
|
24
|
+
"data-panelname": panelName,
|
|
25
|
+
"data-paneltype": panelType,
|
|
26
|
+
"data-panelid": panelId,
|
|
27
|
+
ref,
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsx("div", { className: "panel__header", children: /* @__PURE__ */ jsxs("div", { className: "panel__header__left", children: [
|
|
30
|
+
props.showTitle && /* @__PURE__ */ jsx("span", { className: "panel__title", children: panelTitleAction ? /* @__PURE__ */ jsx(
|
|
31
|
+
"a",
|
|
32
|
+
{
|
|
33
|
+
title: panelTitleDescription,
|
|
34
|
+
className: "panel__title__link",
|
|
35
|
+
href: panelTitleAction,
|
|
36
|
+
children: title
|
|
37
|
+
}
|
|
38
|
+
) : title }),
|
|
39
|
+
/* @__PURE__ */ jsx(NetworkState, { title })
|
|
40
|
+
] }) }),
|
|
41
|
+
/* @__PURE__ */ jsx("div", { className: "panel__content", children }),
|
|
42
|
+
/* @__PURE__ */ jsx(PanelFooter, { isRefreshable: false, ...footerProps })
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
) });
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export { LandingPagePanelWrapper };
|
|
49
|
+
//# sourceMappingURL=LandingPagePanelWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LandingPagePanelWrapper.js","sources":["../../../src/splash/panels/LandingPagePanelWrapper.tsx"],"sourcesContent":["import { PanelContainer } from '../../types';\r\nimport { NetworkState } from './DefaultPanelWrapper/NetworkState';\r\nimport { usePanelIdentity } from '../../common';\r\nimport { PanelContextProvider, useMakePanelContext } from './PanelContext';\r\nimport { PanelFooter } from './PanelContext/PanelFooter';\r\nimport {\r\n usePanelTitleAction,\r\n usePanelTitleDescription,\r\n} from '../../panelsUtil/usePanelTitleAction';\r\nimport { useDashboardContext } from '../../dashboard/DashboardContext';\r\n\r\nexport const LandingPagePanelWrapper: PanelContainer = ({\r\n children,\r\n ...props\r\n}) => {\r\n const { panelId, panelName, panelType } = usePanelIdentity();\r\n\r\n const { contextValue, title, ref, ...footerProps } =\r\n useMakePanelContext(props);\r\n\r\n const panelTitleAction = usePanelTitleAction();\r\n const panelTitleDescription = usePanelTitleDescription();\r\n\r\n const dashboard = useDashboardContext();\r\n\r\n if (dashboard.getPanel(panelId).props.hasRss)\r\n console.log(dashboard.getPanel(panelId).props);\r\n\r\n return (\r\n <PanelContextProvider value={contextValue}>\r\n <div\r\n className=\"panel__container\"\r\n data-panelname={panelName}\r\n data-paneltype={panelType}\r\n data-panelid={panelId}\r\n ref={ref}\r\n >\r\n <div className=\"panel__header\">\r\n <div className=\"panel__header__left\">\r\n {props.showTitle && (\r\n <span className=\"panel__title\">\r\n {panelTitleAction ? (\r\n <a\r\n title={panelTitleDescription}\r\n className=\"panel__title__link\"\r\n href={panelTitleAction}\r\n >\r\n {title}\r\n </a>\r\n ) : (\r\n title\r\n )}\r\n </span>\r\n )}\r\n <NetworkState title={title} />\r\n </div>\r\n </div>\r\n <div className=\"panel__content\">{children}</div>\r\n <PanelFooter isRefreshable={false} {...footerProps} />\r\n </div>\r\n </PanelContextProvider>\r\n );\r\n};\r\n"],"names":[],"mappings":";;;;;;;;AAWO,MAAM,0BAA0C,CAAC;AAAA,EACtD,QAAA;AAAA,EACA,GAAG;AACL,CAAA,KAAM;AACJ,EAAA,MAAM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A,EACF,CAAA;AAAA,wBACA,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,gBAAA,EAAkB,QAAA,EAAS,CAAA;AAAA,wBAC1C,GAAA,CAAC,WAAA,EAAA,EAAY,aAAA,EAAe,KAAA,EAAQ,GAAG,WAAA,EAAa;AAAA;AAAA;AAAA,GACtD,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
|
|
3
|
+
declare const PanelFooter: ({ footerContent, isRefreshable, footer, handleFooterClick, force, }: any & {
|
|
4
|
+
isRefreshable: boolean;
|
|
5
|
+
force?: boolean;
|
|
6
|
+
}) => react.JSX.Element;
|
|
7
|
+
|
|
8
|
+
export { PanelFooter };
|
|
9
|
+
//# sourceMappingURL=PanelFooter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PanelFooter.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from '@apia/theme/jsx-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { usePanelActions } from '../../../actions/usePanelActions.js';
|
|
4
|
+
import { AutoEllipsis, SimpleButton } from '@apia/components';
|
|
5
|
+
import { Box } from '@apia/theme';
|
|
6
|
+
|
|
7
|
+
const PanelFooter = ({
|
|
8
|
+
footerContent,
|
|
9
|
+
isRefreshable,
|
|
10
|
+
footer,
|
|
11
|
+
handleFooterClick,
|
|
12
|
+
force
|
|
13
|
+
}) => {
|
|
14
|
+
const [lastUpdate, setLastUpdate] = useState(0);
|
|
15
|
+
usePanelActions({
|
|
16
|
+
refresh() {
|
|
17
|
+
setLastUpdate(Date.now());
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return /* @__PURE__ */ jsx(Fragment, { children: (isRefreshable || footer || force) && /* @__PURE__ */ jsxs("div", { className: "panel__footer", children: [
|
|
21
|
+
footerContent ?? (footer && (!footer.action || footer.actionBehavior === "DO_NOTHING") && /* @__PURE__ */ jsx("div", { className: "panel__footer__text", children: /* @__PURE__ */ jsx(
|
|
22
|
+
AutoEllipsis,
|
|
23
|
+
{
|
|
24
|
+
overrideStyles: (el) => {
|
|
25
|
+
const styles = window.getComputedStyle(
|
|
26
|
+
el.closest(".panel__footer")
|
|
27
|
+
);
|
|
28
|
+
const width = Number.parseInt(styles.width, 10);
|
|
29
|
+
const padding = Number.parseInt(styles.paddingLeft, 10) + Number.parseInt(styles.paddingRight, 10);
|
|
30
|
+
return {
|
|
31
|
+
width: `${width - padding}px`
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
children: footer.text
|
|
35
|
+
}
|
|
36
|
+
) })),
|
|
37
|
+
footer?.action && footer.actionBehavior !== "DO_NOTHING" && /* @__PURE__ */ jsx(
|
|
38
|
+
SimpleButton,
|
|
39
|
+
{
|
|
40
|
+
onClick: handleFooterClick,
|
|
41
|
+
onDoubleClick: handleFooterClick,
|
|
42
|
+
variant: "link",
|
|
43
|
+
className: "panel__footer__text",
|
|
44
|
+
children: /* @__PURE__ */ jsx(
|
|
45
|
+
AutoEllipsis,
|
|
46
|
+
{
|
|
47
|
+
overrideStyles: (el) => {
|
|
48
|
+
const styles = window.getComputedStyle(
|
|
49
|
+
el.closest(".panel__footer")
|
|
50
|
+
);
|
|
51
|
+
const width = Number.parseInt(styles.width, 10);
|
|
52
|
+
const padding = Number.parseInt(styles.paddingLeft, 10) + Number.parseInt(styles.paddingRight, 10);
|
|
53
|
+
return {
|
|
54
|
+
width: `${width - padding}px`
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
children: footer.text
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
!footer && /* @__PURE__ */ jsx("div", {}),
|
|
63
|
+
lastUpdate > 0 && /* @__PURE__ */ jsxs(Box, { className: "lastUpdate__wrapper", children: [
|
|
64
|
+
new Date(lastUpdate).toLocaleDateString(),
|
|
65
|
+
" ",
|
|
66
|
+
new Date(lastUpdate).toLocaleTimeString()
|
|
67
|
+
] })
|
|
68
|
+
] }) });
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export { PanelFooter };
|
|
72
|
+
//# sourceMappingURL=PanelFooter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PanelFooter.js","sources":["../../../../src/splash/panels/PanelContext/PanelFooter.tsx"],"sourcesContent":["import { useState } from 'react';\r\nimport { usePanelActions } from '../../../actions';\r\nimport { AutoEllipsis, SimpleButton } from '@apia/components';\r\nimport { Box } from '@apia/theme';\r\n\r\nexport const PanelFooter = ({\r\n footerContent,\r\n isRefreshable,\r\n footer,\r\n handleFooterClick,\r\n force,\r\n}: any & { isRefreshable: boolean; force?: boolean }) => {\r\n const [lastUpdate, setLastUpdate] = useState<number>(0);\r\n\r\n usePanelActions({\r\n refresh() {\r\n setLastUpdate(Date.now());\r\n },\r\n });\r\n\r\n return (\r\n <>\r\n {(isRefreshable || footer || force) && (\r\n <div className=\"panel__footer\">\r\n {footerContent ??\r\n (footer &&\r\n (!footer.action || footer.actionBehavior === 'DO_NOTHING') && (\r\n <div className=\"panel__footer__text\">\r\n <AutoEllipsis\r\n overrideStyles={(el) => {\r\n const styles = window.getComputedStyle(\r\n el.closest('.panel__footer') as HTMLElement,\r\n );\r\n const width = Number.parseInt(styles.width, 10);\r\n const padding =\r\n Number.parseInt(styles.paddingLeft, 10) +\r\n Number.parseInt(styles.paddingRight, 10);\r\n return {\r\n width: `${width - padding}px`,\r\n };\r\n }}\r\n >\r\n {footer.text}\r\n </AutoEllipsis>\r\n </div>\r\n ))}\r\n {footer?.action && footer.actionBehavior !== 'DO_NOTHING' && (\r\n <SimpleButton\r\n onClick={handleFooterClick}\r\n onDoubleClick={handleFooterClick}\r\n variant=\"link\"\r\n className=\"panel__footer__text\"\r\n >\r\n <AutoEllipsis\r\n overrideStyles={(el) => {\r\n const styles = window.getComputedStyle(\r\n el.closest('.panel__footer') as HTMLElement,\r\n );\r\n const width = Number.parseInt(styles.width, 10);\r\n const padding =\r\n Number.parseInt(styles.paddingLeft, 10) +\r\n Number.parseInt(styles.paddingRight, 10);\r\n return {\r\n width: `${width - padding}px`,\r\n };\r\n }}\r\n >\r\n {footer.text}\r\n </AutoEllipsis>\r\n </SimpleButton>\r\n )}\r\n {!footer && <div></div>}\r\n {lastUpdate > 0 && (\r\n <Box className=\"lastUpdate__wrapper\">\r\n {new Date(lastUpdate).toLocaleDateString()}{' '}\r\n {new Date(lastUpdate).toLocaleTimeString()}\r\n </Box>\r\n )}\r\n </div>\r\n )}\r\n </>\r\n );\r\n};\r\n"],"names":[],"mappings":";;;;;;AAKO,MAAM,cAAc,CAAC;AAAA,EAC1B,aAAA;AAAA,EACA,aAAA;AAAA,EACA,MAAA;AAAA,EACA,iBAAA;AAAA,EACA;AACF,CAAA,KAAyD;AACvD,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAAiB,CAAC,CAAA;AAEtD,EAAA,eAAA,CAAgB;AAAA,IACd,OAAA,GAAU;AACR,MAAA,aAAA,CAAc,IAAA,CAAK,KAAK,CAAA;AAAA;AAC1B,GACD,CAAA;AAED,EAAA,uCAEM,QAAA,EAAA,CAAA,aAAA,IAAiB,MAAA,IAAU,0BAC3B,IAAA,CAAC,KAAA,EAAA,EAAI,WAAU,eAAA,EACZ,QAAA,EAAA;AAAA,IAAA,aAAA,KACE,MAAA,KACE,CAAC,MAAA,CAAO,MAAA,IAAU,MAAA,CAAO,mBAAmB,YAAA,CAAA,oBAC3C,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,qBAAA,EACb,QAAA,kBAAA,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,cAAA,EAAgB,CAAC,EAAA,KAAO;AACtB,UAAA,MAAM,SAAS,MAAA,CAAO,gBAAA;AAAA,YACpB,EAAA,CAAG,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F;AAAA,YAEC,QAAA,EAAA,MAAA,CAAO;AAAA;AAAA;AACV;AAAA,KACF;AAAA,IAED,CAAC,MAAA,oBAAU,GAAA,CAAC,KAAA,EAAA,EAAI,CAAA;AAAA,IAChB,UAAA,GAAa,CAAA,oBACZ,IAAA,CAAC,GAAA,EAAA,EAAI,WAAU,qBAAA,EACZ,QAAA,EAAA;AAAA,MAAA,IAAI,IAAA,CAAK,UAAU,CAAA,CAAE,kBAAA,EAAmB;AAAA,MAAG,GAAA;AAAA,MAC3C,IAAI,IAAA,CAAK,UAAU,CAAA,CAAE,kBAAA;AAAmB,KAAA,EAC3C;AAAA,GAAA,EAEJ,CAAA,EAEJ,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { TPanelProps } from '../../../types.js';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { TPanelLayout } from './usePanelContextLayout.js';
|
|
5
|
+
import { TFooter } from '../../../actions/usePanelActions.js';
|
|
6
|
+
import '../../../dashboard/DashboardPanelsBootstraper.js';
|
|
7
|
+
|
|
8
|
+
type TPanelContext = {
|
|
9
|
+
/**
|
|
10
|
+
* Permite establecer contenido arbitrario en el footer del panel.
|
|
11
|
+
*/
|
|
12
|
+
setFooterContent(content: ReactNode): void;
|
|
13
|
+
/**
|
|
14
|
+
* setLayout es una función que permite decidir en qué formato se muestran
|
|
15
|
+
* los contenidos del panel.
|
|
16
|
+
*
|
|
17
|
+
* dense: No hay paddings
|
|
18
|
+
* clever: Hay paddings grandes
|
|
19
|
+
*/
|
|
20
|
+
setLayout: (newLayout: TPanelLayout) => void;
|
|
21
|
+
setTitle: (newTitle: string) => void;
|
|
22
|
+
panelProps: Omit<TPanelProps, 'children'>;
|
|
23
|
+
/**
|
|
24
|
+
* Cuando un panel renderiza sus hijos en pantalla, debe setear el ref de
|
|
25
|
+
* modo que se pueda continuar con el flujo normal del panel. Este ref puede
|
|
26
|
+
* estar en cualquier nivel, cuando sea instanciado, se llamará al refresh
|
|
27
|
+
* inicial.
|
|
28
|
+
*/
|
|
29
|
+
setRef: (el: HTMLElement | null) => void;
|
|
30
|
+
};
|
|
31
|
+
declare function usePanelContext(): TPanelContext;
|
|
32
|
+
declare const PanelContextProvider: ({ children, value, }: {
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
value: TPanelContext;
|
|
35
|
+
}) => react.JSX.Element;
|
|
36
|
+
declare function useMakePanelContext(panelProps: Omit<TPanelProps, 'children'>): {
|
|
37
|
+
footerContent: ReactNode;
|
|
38
|
+
title: string;
|
|
39
|
+
footer: TFooter | null;
|
|
40
|
+
handleFooterClick: (ev: react.MouseEvent | react.KeyboardEvent) => void;
|
|
41
|
+
contextValue: TPanelContext;
|
|
42
|
+
ref: (el: HTMLDivElement) => void;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { PanelContextProvider, type TPanelContext, useMakePanelContext, usePanelContext };
|
|
46
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx } from '@apia/theme/jsx-runtime';
|
|
2
|
+
import { useContext, createContext, useCallback, useState, useRef, useMemo } from 'react';
|
|
3
|
+
import { usePanelOnEvent } from '../../../eventsController/usePanelOnEvent.js';
|
|
4
|
+
import { usePanelContextLayout } from './usePanelContextLayout.js';
|
|
5
|
+
import { usePanelFooter } from './usePanelFooter.js';
|
|
6
|
+
import { useDashboardContext } from '../../../dashboard/DashboardContext.js';
|
|
7
|
+
import { usePanelIdentity } from '../../../common/usePanelIdentity.js';
|
|
8
|
+
import { changePanelTitle } from '../../../panelsUtil/usePanelChangeTitle.js';
|
|
9
|
+
|
|
10
|
+
const PanelContext = createContext(null);
|
|
11
|
+
function usePanelContext() {
|
|
12
|
+
const context = useContext(PanelContext);
|
|
13
|
+
if (!context)
|
|
14
|
+
throw new Error("No panel wrapper context defined");
|
|
15
|
+
return context;
|
|
16
|
+
}
|
|
17
|
+
const PanelContextProvider = ({
|
|
18
|
+
children,
|
|
19
|
+
value
|
|
20
|
+
}) => {
|
|
21
|
+
return /* @__PURE__ */ jsx(PanelContext.Provider, { value, children });
|
|
22
|
+
};
|
|
23
|
+
function useMakePanelContext(panelProps) {
|
|
24
|
+
const identifier = usePanelIdentity();
|
|
25
|
+
const setTitle = useCallback(
|
|
26
|
+
(newTitle) => {
|
|
27
|
+
changePanelTitle(identifier, newTitle);
|
|
28
|
+
},
|
|
29
|
+
[identifier]
|
|
30
|
+
);
|
|
31
|
+
const { ref, setLayout } = usePanelContextLayout();
|
|
32
|
+
const [title, setTitleState] = useState(panelProps.title);
|
|
33
|
+
usePanelOnEvent(
|
|
34
|
+
{ eventType: "changeTitle", panelId: identifier.panelId },
|
|
35
|
+
(ev) => {
|
|
36
|
+
setTitleState(ev.payload);
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
const { footer, handleFooterClick } = usePanelFooter(panelProps);
|
|
40
|
+
const [footerContent, setFooterContent] = useState(null);
|
|
41
|
+
const hasRefreshedOnStartup = useRef(false);
|
|
42
|
+
const dashboard = useDashboardContext();
|
|
43
|
+
const setRef = useCallback(
|
|
44
|
+
(el) => {
|
|
45
|
+
if (el && !hasRefreshedOnStartup.current) {
|
|
46
|
+
hasRefreshedOnStartup.current = true;
|
|
47
|
+
if (panelProps.refreshOnStart) {
|
|
48
|
+
dashboard.getPanel(panelProps.id).refresh().then(() => {
|
|
49
|
+
dashboard.bootstrapper.setPanelHasLoaded(identifier.panelId);
|
|
50
|
+
});
|
|
51
|
+
} else {
|
|
52
|
+
dashboard.bootstrapper.setPanelHasLoaded(identifier.panelId);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
[dashboard, identifier.panelId, panelProps.id, panelProps.refreshOnStart]
|
|
57
|
+
);
|
|
58
|
+
const contextValue = useMemo(
|
|
59
|
+
() => ({ setFooterContent, setTitle, setLayout, panelProps, setRef }),
|
|
60
|
+
[setTitle, setLayout, panelProps, setRef]
|
|
61
|
+
);
|
|
62
|
+
return { footerContent, title, footer, handleFooterClick, contextValue, ref };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { PanelContext, PanelContextProvider, useMakePanelContext, usePanelContext };
|
|
66
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/splash/panels/PanelContext/index.tsx"],"sourcesContent":["import {\r\n ReactNode,\r\n createContext,\r\n useCallback,\r\n useContext,\r\n useMemo,\r\n useRef,\r\n useState,\r\n} from 'react';\r\nimport { changePanelTitle } from '../../../panelsUtil';\r\nimport { TPanelEvent, usePanelOnEvent } from '../../../eventsController';\r\nimport { TPanelLayout, usePanelContextLayout } from './usePanelContextLayout';\r\nimport { usePanelFooter } from './usePanelFooter';\r\nimport { TPanelProps } from '../../../types';\r\nimport { useYieldPanelIsReady } from './useYieldPanelIsReady';\r\nimport { useDashboardContext } from '../../../dashboard/DashboardContext';\r\nimport { usePanelIdentity } from '../../../common';\r\n\r\nexport const PanelContext = createContext<TPanelContext | null>(null);\r\nexport { useYieldPanelIsReady };\r\n\r\nexport type TPanelContext = {\r\n /**\r\n * Permite establecer contenido arbitrario en el footer del panel.\r\n */\r\n setFooterContent(content: ReactNode): void;\r\n /**\r\n * setLayout es una función que permite decidir en qué formato se muestran\r\n * los contenidos del panel.\r\n *\r\n * dense: No hay paddings\r\n * clever: Hay paddings grandes\r\n */\r\n setLayout: (newLayout: TPanelLayout) => void;\r\n setTitle: (newTitle: string) => void;\r\n panelProps: Omit<TPanelProps, 'children'>;\r\n /**\r\n * Cuando un panel renderiza sus hijos en pantalla, debe setear el ref de\r\n * modo que se pueda continuar con el flujo normal del panel. Este ref puede\r\n * estar en cualquier nivel, cuando sea instanciado, se llamará al refresh\r\n * inicial.\r\n */\r\n setRef: (el: HTMLElement | null) => void;\r\n};\r\n\r\nexport function usePanelContext() {\r\n const context = useContext(PanelContext);\r\n if (!context) throw new Error('No panel wrapper context defined');\r\n return context;\r\n}\r\nexport const PanelContextProvider = ({\r\n children,\r\n value,\r\n}: {\r\n children: ReactNode;\r\n value: TPanelContext;\r\n}) => {\r\n return (\r\n <PanelContext.Provider value={value}>{children}</PanelContext.Provider>\r\n );\r\n};\r\n\r\nexport function useMakePanelContext(panelProps: Omit<TPanelProps, 'children'>) {\r\n const identifier = usePanelIdentity();\r\n\r\n const setTitle = useCallback(\r\n (newTitle: string) => {\r\n changePanelTitle(identifier, newTitle);\r\n },\r\n [identifier],\r\n );\r\n\r\n const { ref, setLayout } = usePanelContextLayout();\r\n\r\n const [title, setTitleState] = useState(panelProps.title);\r\n usePanelOnEvent(\r\n { eventType: 'changeTitle', panelId: identifier.panelId },\r\n (ev: TPanelEvent<string>) => {\r\n setTitleState(ev.payload);\r\n },\r\n );\r\n const { footer, handleFooterClick } = usePanelFooter(panelProps);\r\n\r\n const [footerContent, setFooterContent] = useState<ReactNode>(null);\r\n\r\n const hasRefreshedOnStartup = useRef(false);\r\n const dashboard = useDashboardContext();\r\n\r\n const setRef = useCallback(\r\n (el: HTMLElement | null) => {\r\n if (el && !hasRefreshedOnStartup.current) {\r\n hasRefreshedOnStartup.current = true;\r\n if (panelProps.refreshOnStart) {\r\n dashboard\r\n .getPanel(panelProps.id)\r\n .refresh()\r\n .then(() => {\r\n dashboard.bootstrapper.setPanelHasLoaded(identifier.panelId);\r\n });\r\n } else {\r\n dashboard.bootstrapper.setPanelHasLoaded(identifier.panelId);\r\n }\r\n }\r\n },\r\n [dashboard, identifier.panelId, panelProps.id, panelProps.refreshOnStart],\r\n );\r\n\r\n const contextValue = useMemo<TPanelContext>(\r\n () => ({ setFooterContent, setTitle, setLayout, panelProps, setRef }),\r\n [setTitle, setLayout, panelProps, setRef],\r\n );\r\n\r\n return { footerContent, title, footer, handleFooterClick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