@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
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { shallowEqual } from '@apia/store';
|
|
2
|
+
import { useState, useRef } from 'react';
|
|
3
|
+
import { panelsStore, usePanelStoreSelector } from './panelsStore.js';
|
|
4
|
+
import { usePanelIdentity } from '../common/usePanelIdentity.js';
|
|
5
|
+
|
|
6
|
+
const undefinedObject = {};
|
|
7
|
+
function usePanelSelector(panelType, panelName, initialState, selector, comparator = shallowEqual) {
|
|
8
|
+
const { panelId } = usePanelIdentity();
|
|
9
|
+
if (!panelId)
|
|
10
|
+
throw new Error(`Cannot find panel with name ${panelName}`);
|
|
11
|
+
const storeState = panelsStore.getState().panelsSlice[panelType];
|
|
12
|
+
const [selection, setSelection] = useState(
|
|
13
|
+
initialState ? selector(storeState?.[panelId] ?? initialState) : {}
|
|
14
|
+
);
|
|
15
|
+
const previousSelected = useRef(
|
|
16
|
+
selection ?? undefinedObject
|
|
17
|
+
);
|
|
18
|
+
usePanelStoreSelector((global) => {
|
|
19
|
+
const newState = global.panelsSlice[panelType]?.[panelId];
|
|
20
|
+
if (newState !== void 0) {
|
|
21
|
+
const newSelected = selector(newState);
|
|
22
|
+
if (previousSelected.current === undefinedObject || !comparator(previousSelected.current, newSelected)) {
|
|
23
|
+
previousSelected.current = newSelected;
|
|
24
|
+
setSelection(newSelected);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return selection;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { undefinedObject, usePanelSelector };
|
|
32
|
+
//# sourceMappingURL=usePanelSelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePanelSelector.js","sources":["../../src/panelsStore/usePanelSelector.ts"],"sourcesContent":["import { shallowEqual } from '@apia/store';\r\nimport { useRef, useState } from 'react';\r\nimport { TPanelName, TPanelType } from '../types';\r\nimport { panelsStore, usePanelStoreSelector } from './panelsStore';\r\nimport { usePanelIdentity } from '../common';\r\n\r\nexport const undefinedObject = {};\r\n\r\n/**\r\n * Permite escuchar el store de un panel al igual que se haría con un\r\n * useSelector de redux.\r\n *\r\n * @param selector Una función selectora que recibe el estado del panel y devuelve la selección deseada\r\n * @param comparator Opcionalmente se puede pasar un comparador para determinar si el estado debe actualizarse o no, dependiendo de la selección actual y la selección previa. Por defecto se usa shallowEqual de redux.\r\n * @returns La selección determinada en el selector, siempre que haya cambiado de acuerdo al comparador.\r\n *\r\n * @example\r\n *\r\n import { TRecordsPanelStore } from '..../recordsPanel';\r\n\r\n // Assume TRecordsPanelStore = { peopleNames: string[] }\r\n\r\n const firstName = usePanelSelector<TRecordsPanelStore>(\r\n 'RecordsPanel',\r\n 'RecordThisYear',\r\n (state) => { return state.peopleNames[0] }\r\n );\r\n */\r\nexport function usePanelSelector<StoreType, Selected>(\r\n panelType: TPanelType,\r\n panelName: TPanelName,\r\n initialState: StoreType,\r\n selector: (state: StoreType) => Selected,\r\n comparator: (a: Selected, b: Selected) => boolean = shallowEqual,\r\n): Selected {\r\n const { panelId } = usePanelIdentity();\r\n if (!panelId) throw new Error(`Cannot find panel with name ${panelName}`);\r\n\r\n const storeState = panelsStore.getState().panelsSlice[panelType];\r\n const [selection, setSelection] = useState<Selected>(\r\n initialState\r\n ? selector((storeState?.[panelId] as StoreType) ?? initialState)\r\n : ({} as Selected),\r\n );\r\n\r\n const previousSelected = useRef<Selected>(\r\n selection ?? (undefinedObject as Selected),\r\n );\r\n\r\n usePanelStoreSelector((global) => {\r\n const newState = global.panelsSlice[panelType]?.[panelId] as\r\n | StoreType\r\n | undefined;\r\n if (newState !== undefined) {\r\n const newSelected = selector(newState);\r\n if (\r\n previousSelected.current === undefinedObject ||\r\n !comparator(previousSelected.current as Selected, newSelected)\r\n ) {\r\n previousSelected.current = newSelected;\r\n setSelection(newSelected);\r\n }\r\n }\r\n });\r\n\r\n return selection;\r\n}\r\n"],"names":[],"mappings":";;;;;AAMO,MAAM,kBAAkB,GAAC;AAsBzB,SAAS,iBACd,SACA,EAAA,SAAA,EACA,YACA,EAAA,QAAA,EACA,aAAoD,YAC1C,EAAA;AACV,EAAM,MAAA,EAAE,OAAQ,EAAA,GAAI,gBAAiB,EAAA,CAAA;AACrC,EAAA,IAAI,CAAC,OAAA;AAAS,IAAA,MAAM,IAAI,KAAA,CAAM,CAA+B,4BAAA,EAAA,SAAS,CAAE,CAAA,CAAA,CAAA;AAExE,EAAA,MAAM,UAAa,GAAA,WAAA,CAAY,QAAS,EAAA,CAAE,YAAY,SAAS,CAAA,CAAA;AAC/D,EAAM,MAAA,CAAC,SAAW,EAAA,YAAY,CAAI,GAAA,QAAA;AAAA,IAChC,eACI,QAAU,CAAA,UAAA,GAAa,OAAO,CAAmB,IAAA,YAAY,IAC5D,EAAC;AAAA,GACR,CAAA;AAEA,EAAA,MAAM,gBAAmB,GAAA,MAAA;AAAA,IACvB,SAAc,IAAA,eAAA;AAAA,GAChB,CAAA;AAEA,EAAA,qBAAA,CAAsB,CAAC,MAAW,KAAA;AAChC,IAAA,MAAM,QAAW,GAAA,MAAA,CAAO,WAAY,CAAA,SAAS,IAAI,OAAO,CAAA,CAAA;AAGxD,IAAA,IAAI,aAAa,KAAW,CAAA,EAAA;AAC1B,MAAM,MAAA,WAAA,GAAc,SAAS,QAAQ,CAAA,CAAA;AACrC,MACE,IAAA,gBAAA,CAAiB,YAAY,eAC7B,IAAA,CAAC,WAAW,gBAAiB,CAAA,OAAA,EAAqB,WAAW,CAC7D,EAAA;AACA,QAAA,gBAAA,CAAiB,OAAU,GAAA,WAAA,CAAA;AAC3B,QAAA,YAAA,CAAa,WAAW,CAAA,CAAA;AAAA,OAC1B;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AAED,EAAO,OAAA,SAAA,CAAA;AACT;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePanelChangeTitle.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { eventsController } from '../eventsController/eventsController.js';
|
|
3
|
+
import { usePanelFireEvent } from '../eventsController/usePanelFireEvent.js';
|
|
4
|
+
|
|
5
|
+
function changePanelTitle(panelId, newTitle) {
|
|
6
|
+
eventsController.fireEvent(
|
|
7
|
+
{ panelId },
|
|
8
|
+
"changeTitle",
|
|
9
|
+
newTitle
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
function usePanelChangeTitle() {
|
|
13
|
+
const fireEvent = usePanelFireEvent();
|
|
14
|
+
return useCallback(
|
|
15
|
+
(newTitle) => {
|
|
16
|
+
fireEvent("changeTitle", newTitle);
|
|
17
|
+
},
|
|
18
|
+
[fireEvent]
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { changePanelTitle, usePanelChangeTitle };
|
|
23
|
+
//# sourceMappingURL=usePanelChangeTitle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePanelChangeTitle.js","sources":["../../src/panelsUtil/usePanelChangeTitle.ts"],"sourcesContent":["import { useCallback } from 'react';\r\nimport {\r\n TPanelIdentifier,\r\n eventsController,\r\n usePanelFireEvent,\r\n} from '../eventsController';\r\n\r\nexport function changePanelTitle(panelId: string, newTitle: string) {\r\n eventsController.fireEvent(\r\n { panelId } as TPanelIdentifier,\r\n 'changeTitle',\r\n newTitle,\r\n );\r\n}\r\n\r\nexport function usePanelChangeTitle() {\r\n const fireEvent = usePanelFireEvent();\r\n\r\n return useCallback(\r\n (newTitle: string) => {\r\n fireEvent('changeTitle', newTitle);\r\n },\r\n [fireEvent],\r\n );\r\n}\r\n"],"names":[],"mappings":";;;;AAOgB,SAAA,gBAAA,CAAiB,SAAiB,QAAkB,EAAA;AAClE,EAAiB,gBAAA,CAAA,SAAA;AAAA,IACf,EAAE,OAAQ,EAAA;AAAA,IACV,aAAA;AAAA,IACA,QAAA;AAAA,GACF,CAAA;AACF,CAAA;AAEO,SAAS,mBAAsB,GAAA;AACpC,EAAA,MAAM,YAAY,iBAAkB,EAAA,CAAA;AAEpC,EAAO,OAAA,WAAA;AAAA,IACL,CAAC,QAAqB,KAAA;AACpB,MAAA,SAAA,CAAU,eAAe,QAAQ,CAAA,CAAA;AAAA,KACnC;AAAA,IACA,CAAC,SAAS,CAAA;AAAA,GACZ,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { usePanelParametersSelector } from '../config/usePanelParametersSelector.js';
|
|
2
|
+
import { parametersStore as store, parametersActions } from '../config/parametersStore.js';
|
|
3
|
+
|
|
4
|
+
const panelActionParameterName = "__panelTitleAction";
|
|
5
|
+
const panelDescriptionParameterName = "__panelTitleDescription";
|
|
6
|
+
function setPanelTitleAction(panelId, newAction) {
|
|
7
|
+
store.dispatch(
|
|
8
|
+
parametersActions.udpate({
|
|
9
|
+
panelId,
|
|
10
|
+
parameters: { [panelActionParameterName]: newAction }
|
|
11
|
+
})
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
function setPanelTitleDescritpion(panelId, newDescription) {
|
|
15
|
+
store.dispatch(
|
|
16
|
+
parametersActions.udpate({
|
|
17
|
+
panelId,
|
|
18
|
+
parameters: { [panelDescriptionParameterName]: newDescription }
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
function usePanelTitleAction() {
|
|
23
|
+
return usePanelParametersSelector(
|
|
24
|
+
(current) => current[panelActionParameterName]
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
function usePanelTitleDescription() {
|
|
28
|
+
return usePanelParametersSelector(
|
|
29
|
+
(current) => current[panelDescriptionParameterName]
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { setPanelTitleAction, setPanelTitleDescritpion, usePanelTitleAction, usePanelTitleDescription };
|
|
34
|
+
//# sourceMappingURL=usePanelTitleAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePanelTitleAction.js","sources":["../../src/panelsUtil/usePanelTitleAction.ts"],"sourcesContent":["import { parametersStore, usePanelParametersSelector } from '../config';\r\nimport { parametersActions } from '../config/parametersStore';\r\n\r\nconst panelActionParameterName = '__panelTitleAction';\r\nconst panelDescriptionParameterName = '__panelTitleDescription';\r\n\r\nexport function setPanelTitleAction(panelId: string, newAction: string) {\r\n parametersStore.dispatch(\r\n parametersActions.udpate({\r\n panelId,\r\n parameters: { [panelActionParameterName]: newAction },\r\n }),\r\n );\r\n}\r\nexport function setPanelTitleDescritpion(\r\n panelId: string,\r\n newDescription: string,\r\n) {\r\n parametersStore.dispatch(\r\n parametersActions.udpate({\r\n panelId,\r\n parameters: { [panelDescriptionParameterName]: newDescription },\r\n }),\r\n );\r\n}\r\n\r\nexport function usePanelTitleAction() {\r\n return usePanelParametersSelector(\r\n (current) => current[panelActionParameterName] as string,\r\n );\r\n}\r\n\r\nexport function usePanelTitleDescription() {\r\n return usePanelParametersSelector(\r\n (current) => current[panelDescriptionParameterName] as string,\r\n );\r\n}\r\n"],"names":["parametersStore"],"mappings":";;;AAGA,MAAM,wBAA2B,GAAA,oBAAA,CAAA;AACjC,MAAM,6BAAgC,GAAA,yBAAA,CAAA;AAEtB,SAAA,mBAAA,CAAoB,SAAiB,SAAmB,EAAA;AACtE,EAAgBA,KAAA,CAAA,QAAA;AAAA,IACd,kBAAkB,MAAO,CAAA;AAAA,MACvB,OAAA;AAAA,MACA,UAAY,EAAA,EAAE,CAAC,wBAAwB,GAAG,SAAU,EAAA;AAAA,KACrD,CAAA;AAAA,GACH,CAAA;AACF,CAAA;AACgB,SAAA,wBAAA,CACd,SACA,cACA,EAAA;AACA,EAAgBA,KAAA,CAAA,QAAA;AAAA,IACd,kBAAkB,MAAO,CAAA;AAAA,MACvB,OAAA;AAAA,MACA,UAAY,EAAA,EAAE,CAAC,6BAA6B,GAAG,cAAe,EAAA;AAAA,KAC/D,CAAA;AAAA,GACH,CAAA;AACF,CAAA;AAEO,SAAS,mBAAsB,GAAA;AACpC,EAAO,OAAA,0BAAA;AAAA,IACL,CAAC,OAAY,KAAA,OAAA,CAAQ,wBAAwB,CAAA;AAAA,GAC/C,CAAA;AACF,CAAA;AAEO,SAAS,wBAA2B,GAAA;AACzC,EAAO,OAAA,0BAAA;AAAA,IACL,CAAC,OAAY,KAAA,OAAA,CAAQ,6BAA6B,CAAA;AAAA,GACpD,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TId } from '@apia/util';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Permite conocer la posición del panel, se actualiza automáticamente cuando
|
|
5
|
+
* ésta cambia provocando un renderizado en el padre
|
|
6
|
+
*/
|
|
7
|
+
declare function usePanelPosition(): {
|
|
8
|
+
containerId: TId;
|
|
9
|
+
position: number;
|
|
10
|
+
} | undefined;
|
|
11
|
+
|
|
12
|
+
export { usePanelPosition };
|
|
13
|
+
//# sourceMappingURL=usePanelPosition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePanelPosition.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ApiaApi, makeApiaUrl } from '@apia/api';
|
|
2
|
+
import { EventEmitter } from '@apia/util';
|
|
3
|
+
import { usePanelIdentity } from '../common/usePanelIdentity.js';
|
|
4
|
+
import { useState, useEffect } from 'react';
|
|
5
|
+
|
|
6
|
+
class PanelPositionEmitter extends EventEmitter {
|
|
7
|
+
}
|
|
8
|
+
const panelPositionEmitter = new PanelPositionEmitter();
|
|
9
|
+
function usePanelPosition() {
|
|
10
|
+
const { panelId } = usePanelIdentity();
|
|
11
|
+
const [position, setPosition] = useState();
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
return panelPositionEmitter.on("panelUpdate", (ev) => {
|
|
14
|
+
if (ev.panelId === panelId)
|
|
15
|
+
setPosition({ containerId: ev.containerId, position: ev.newPosition });
|
|
16
|
+
});
|
|
17
|
+
}, [panelId]);
|
|
18
|
+
return position;
|
|
19
|
+
}
|
|
20
|
+
async function updatePanelPosition(panelId, containerId, newPosition) {
|
|
21
|
+
const result = await ApiaApi.post(
|
|
22
|
+
makeApiaUrl({
|
|
23
|
+
action: "panelMove",
|
|
24
|
+
pnlId: panelId,
|
|
25
|
+
containerId,
|
|
26
|
+
newPosition
|
|
27
|
+
})
|
|
28
|
+
);
|
|
29
|
+
const hasUpdated = result?.data && !result.hasError && !result.hasMessages;
|
|
30
|
+
if (hasUpdated)
|
|
31
|
+
panelPositionEmitter.emit("panelUpdate", {
|
|
32
|
+
panelId,
|
|
33
|
+
containerId,
|
|
34
|
+
newPosition
|
|
35
|
+
});
|
|
36
|
+
return hasUpdated;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { panelPositionEmitter, updatePanelPosition, usePanelPosition };
|
|
40
|
+
//# sourceMappingURL=usePanelPosition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePanelPosition.js","sources":["../../src/position/usePanelPosition.ts"],"sourcesContent":["import { ApiaApi, makeApiaUrl } from '@apia/api';\r\nimport { EventEmitter, TId } from '@apia/util';\r\nimport { usePanelIdentity } from '../common';\r\nimport { useEffect, useState } from 'react';\r\n\r\nclass PanelPositionEmitter extends EventEmitter<{\r\n panelUpdate: {\r\n panelId: TId;\r\n containerId: TId;\r\n newPosition: number;\r\n };\r\n}> {}\r\n\r\nexport const panelPositionEmitter = new PanelPositionEmitter();\r\n\r\n/**\r\n * Permite conocer la posición del panel, se actualiza automáticamente cuando\r\n * ésta cambia provocando un renderizado en el padre\r\n */\r\nexport function usePanelPosition() {\r\n const { panelId } = usePanelIdentity();\r\n\r\n const [position, setPosition] = useState<{\r\n containerId: TId;\r\n position: number;\r\n }>();\r\n\r\n useEffect(() => {\r\n return panelPositionEmitter.on('panelUpdate', (ev) => {\r\n if (ev.panelId === panelId)\r\n setPosition({ containerId: ev.containerId, position: ev.newPosition });\r\n });\r\n }, [panelId]);\r\n\r\n return position;\r\n}\r\n\r\nexport async function updatePanelPosition(\r\n panelId: TId,\r\n containerId: TId,\r\n newPosition: number,\r\n) {\r\n const result = await ApiaApi.post(\r\n makeApiaUrl({\r\n action: 'panelMove',\r\n pnlId: panelId,\r\n containerId,\r\n newPosition,\r\n }),\r\n );\r\n\r\n const hasUpdated = result?.data && !result.hasError && !result.hasMessages;\r\n\r\n if (hasUpdated)\r\n panelPositionEmitter.emit('panelUpdate', {\r\n panelId,\r\n containerId,\r\n newPosition,\r\n });\r\n\r\n return hasUpdated;\r\n}\r\n\r\nexport function useUpdatePanelPosition() {\r\n const { panelId } = usePanelIdentity();\r\n return async function updatePosition(containerId: TId, newPosition: number) {\r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;AACT;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { isChild } from '@apia/util';
|
|
2
|
+
|
|
3
|
+
function dragleave(_ev, DragAndDrop2) {
|
|
4
|
+
const ev = _ev;
|
|
5
|
+
if (ev.relatedTarget === null || isChild(ev.relatedTarget, (current) => {
|
|
6
|
+
return current.parentElement === null && current === document.getRootNode() && current.dataset.splash === void 0;
|
|
7
|
+
})) {
|
|
8
|
+
const shadows = document.querySelectorAll(".apia_panel_falseDiv");
|
|
9
|
+
shadows.forEach((el) => el.remove());
|
|
10
|
+
DragAndDrop2.draggingPanel?.setAttribute("style", "");
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { dragleave };
|
|
15
|
+
//# sourceMappingURL=Dragleave.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dragleave.js","sources":["../../../src/splash/events/Dragleave.ts"],"sourcesContent":["import { isChild } from '@apia/util';\r\nimport { DragAndDrop } from '../util/DragAndDrop';\r\n\r\nexport function dragleave(_ev: Event, DragAndDrop: DragAndDrop) {\r\n const ev = _ev as DragEvent;\r\n\r\n if (\r\n ev.relatedTarget === null ||\r\n isChild(ev.relatedTarget as HTMLElement, (current) => {\r\n return (\r\n current.parentElement === null &&\r\n current === document.getRootNode() &&\r\n current.dataset.splash === undefined\r\n );\r\n })\r\n ) {\r\n const shadows = document.querySelectorAll('.apia_panel_falseDiv');\r\n\r\n shadows.forEach((el) => el.remove());\r\n DragAndDrop.draggingPanel?.setAttribute('style', '');\r\n }\r\n}\r\n"],"names":["DragAndDrop"],"mappings":";;AAGgB,SAAA,SAAA,CAAU,KAAYA,YAA0B,EAAA;AAC9D,EAAA,MAAM,EAAK,GAAA,GAAA,CAAA;AAEX,EAAA,IACE,GAAG,aAAkB,KAAA,IAAA,IACrB,QAAQ,EAAG,CAAA,aAAA,EAA8B,CAAC,OAAY,KAAA;AACpD,IACE,OAAA,OAAA,CAAQ,kBAAkB,IAC1B,IAAA,OAAA,KAAY,SAAS,WAAY,EAAA,IACjC,OAAQ,CAAA,OAAA,CAAQ,MAAW,KAAA,KAAA,CAAA,CAAA;AAAA,GAE9B,CACD,EAAA;AACA,IAAM,MAAA,OAAA,GAAU,QAAS,CAAA,gBAAA,CAAiB,sBAAsB,CAAA,CAAA;AAEhE,IAAA,OAAA,CAAQ,OAAQ,CAAA,CAAC,EAAO,KAAA,EAAA,CAAG,QAAQ,CAAA,CAAA;AACnC,IAAAA,YAAY,CAAA,aAAA,EAAe,YAAa,CAAA,OAAA,EAAS,EAAE,CAAA,CAAA;AAAA,GACrD;AACF;;;;"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { isCursorInArea } from '../util/isCursorInArea.js';
|
|
2
|
+
import { getColumnAreas } from '../util/getColumnAreas.js';
|
|
3
|
+
|
|
4
|
+
function dragover(event, DragAndDrop2) {
|
|
5
|
+
const ev = event;
|
|
6
|
+
ev.preventDefault();
|
|
7
|
+
DragAndDrop2.timeout = -1;
|
|
8
|
+
if ((ev.clientX !== DragAndDrop2.dragoverPosition.x || ev.clientY !== DragAndDrop2.dragoverPosition.y) && DragAndDrop2.draggingPanelId !== "" && DragAndDrop2.shadowDiv) {
|
|
9
|
+
DragAndDrop2.clearTimeout();
|
|
10
|
+
DragAndDrop2.currentBottomPanel = DragAndDrop2.findBottomPanel(
|
|
11
|
+
ev.clientX,
|
|
12
|
+
ev.clientY + DragAndDrop2.currentScroll
|
|
13
|
+
);
|
|
14
|
+
DragAndDrop2.dragoverPosition.x = ev.clientX;
|
|
15
|
+
DragAndDrop2.dragoverPosition.y = ev.clientY;
|
|
16
|
+
const snapshotSection = DragAndDrop2.findBottomSection(
|
|
17
|
+
ev.clientX,
|
|
18
|
+
ev.clientY + DragAndDrop2.currentScroll
|
|
19
|
+
);
|
|
20
|
+
if (DragAndDrop2.shadowDivData && isCursorInArea({
|
|
21
|
+
cursorX: ev.clientX,
|
|
22
|
+
cursorY: ev.clientY + DragAndDrop2.currentScroll,
|
|
23
|
+
bottom: DragAndDrop2.shadowDivData?.panelBottom,
|
|
24
|
+
top: DragAndDrop2.shadowDivData?.panelTop,
|
|
25
|
+
left: DragAndDrop2.shadowDivData?.panelLeft,
|
|
26
|
+
right: DragAndDrop2.shadowDivData?.panelRight
|
|
27
|
+
})) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (DragAndDrop2.currentBottomPanel && snapshotSection) {
|
|
31
|
+
const bottomPanel = DragAndDrop2.splash.querySelector(
|
|
32
|
+
`[data-panel][data-id='${DragAndDrop2.currentBottomPanel.id}']`
|
|
33
|
+
);
|
|
34
|
+
const draggingPanel = DragAndDrop2.splash.querySelector(
|
|
35
|
+
`[data-panel][data-id='${DragAndDrop2.draggingPanelId}']`
|
|
36
|
+
);
|
|
37
|
+
const bottomSection = DragAndDrop2.splash.querySelector(
|
|
38
|
+
`[data-locationid='${snapshotSection.sectionId}']`
|
|
39
|
+
);
|
|
40
|
+
if (bottomSection) {
|
|
41
|
+
if (isCursorInArea({
|
|
42
|
+
cursorX: ev.clientX,
|
|
43
|
+
cursorY: ev.clientY + DragAndDrop2.currentScroll,
|
|
44
|
+
...getColumnAreas({
|
|
45
|
+
...DragAndDrop2.currentBottomPanel,
|
|
46
|
+
panelLeft: bottomSection?.getBoundingClientRect().left ?? 0,
|
|
47
|
+
panelRight: bottomSection?.getBoundingClientRect().right ?? 0
|
|
48
|
+
}).top
|
|
49
|
+
})) {
|
|
50
|
+
if (draggingPanel) {
|
|
51
|
+
draggingPanel.setAttribute("style", "display: none; height: 0;");
|
|
52
|
+
}
|
|
53
|
+
if (bottomPanel && snapshotSection) {
|
|
54
|
+
if (bottomSection) {
|
|
55
|
+
DragAndDrop2.shadowDiv.setAttribute("style", "opacity: 50%;");
|
|
56
|
+
DragAndDrop2.debounceBefore(
|
|
57
|
+
bottomPanel,
|
|
58
|
+
DragAndDrop2.shadowDiv,
|
|
59
|
+
bottomSection
|
|
60
|
+
);
|
|
61
|
+
DragAndDrop2.snapshot();
|
|
62
|
+
DragAndDrop2.clearTimeout();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
} else if (isCursorInArea({
|
|
66
|
+
cursorX: ev.clientX,
|
|
67
|
+
cursorY: ev.clientY + DragAndDrop2.currentScroll,
|
|
68
|
+
...getColumnAreas({
|
|
69
|
+
...DragAndDrop2.currentBottomPanel,
|
|
70
|
+
panelLeft: bottomSection?.getBoundingClientRect().left ?? 0,
|
|
71
|
+
panelRight: bottomSection?.getBoundingClientRect().right ?? 0
|
|
72
|
+
}).bottom
|
|
73
|
+
})) {
|
|
74
|
+
const bottomPanel2 = DragAndDrop2.splash.querySelector(
|
|
75
|
+
`[data-panel][data-id='${DragAndDrop2.currentBottomPanel.id}']`
|
|
76
|
+
);
|
|
77
|
+
const draggingPanel2 = DragAndDrop2.splash.querySelector(
|
|
78
|
+
`[data-panel][data-id='${DragAndDrop2.draggingPanelId}']`
|
|
79
|
+
);
|
|
80
|
+
if (draggingPanel2) {
|
|
81
|
+
draggingPanel2.setAttribute("style", "display: none;");
|
|
82
|
+
}
|
|
83
|
+
if (bottomPanel2 && snapshotSection) {
|
|
84
|
+
const bottomSection2 = DragAndDrop2.splash.querySelector(
|
|
85
|
+
`[data-locationid='${snapshotSection.sectionId}']`
|
|
86
|
+
);
|
|
87
|
+
if (bottomSection2) {
|
|
88
|
+
DragAndDrop2.shadowDiv.setAttribute("style", "opacity: 50%;");
|
|
89
|
+
DragAndDrop2.debounceAfter(DragAndDrop2.shadowDiv, bottomPanel2);
|
|
90
|
+
DragAndDrop2.snapshot();
|
|
91
|
+
DragAndDrop2.clearTimeout();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
} else if (!DragAndDrop2.currentBottomPanel && snapshotSection) {
|
|
97
|
+
const bottomSection = DragAndDrop2.splash.querySelector(
|
|
98
|
+
`[data-locationid='${snapshotSection.sectionId}']`
|
|
99
|
+
);
|
|
100
|
+
if (bottomSection) {
|
|
101
|
+
const draggingPanel = DragAndDrop2.splash.querySelector(
|
|
102
|
+
`[data-panel][data-id='${DragAndDrop2.draggingPanelId}']`
|
|
103
|
+
);
|
|
104
|
+
if (draggingPanel) {
|
|
105
|
+
draggingPanel.setAttribute("style", "display: none;");
|
|
106
|
+
}
|
|
107
|
+
DragAndDrop2.shadowDiv.setAttribute("style", "opacity: 50%;");
|
|
108
|
+
DragAndDrop2.debounceAppend(
|
|
109
|
+
bottomSection,
|
|
110
|
+
DragAndDrop2.shadowDiv
|
|
111
|
+
);
|
|
112
|
+
DragAndDrop2.snapshot();
|
|
113
|
+
DragAndDrop2.clearTimeout();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export { dragover };
|
|
120
|
+
//# sourceMappingURL=Dragover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dragover.js","sources":["../../../src/splash/events/Dragover.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\r\nimport { isCursorInArea } from '../util/isCursorInArea';\r\nimport { getColumnAreas } from '../util/getColumnAreas';\r\nimport { DragAndDrop } from '../util/DragAndDrop';\r\n\r\nexport function dragover(event: Event, DragAndDrop: DragAndDrop) {\r\n const ev = event as DragEvent;\r\n ev.preventDefault();\r\n\r\n DragAndDrop.timeout = -1;\r\n if (\r\n (ev.clientX !== DragAndDrop.dragoverPosition.x ||\r\n ev.clientY !== DragAndDrop.dragoverPosition.y) &&\r\n DragAndDrop.draggingPanelId !== '' &&\r\n DragAndDrop.shadowDiv\r\n ) {\r\n DragAndDrop.clearTimeout();\r\n DragAndDrop.currentBottomPanel = DragAndDrop.findBottomPanel(\r\n ev.clientX,\r\n ev.clientY + DragAndDrop.currentScroll,\r\n );\r\n\r\n DragAndDrop.dragoverPosition.x = ev.clientX;\r\n DragAndDrop.dragoverPosition.y = ev.clientY;\r\n\r\n const snapshotSection = DragAndDrop.findBottomSection(\r\n ev.clientX,\r\n ev.clientY + DragAndDrop.currentScroll,\r\n );\r\n\r\n if (\r\n DragAndDrop.shadowDivData &&\r\n isCursorInArea({\r\n cursorX: ev.clientX,\r\n cursorY: ev.clientY + DragAndDrop.currentScroll,\r\n bottom: DragAndDrop.shadowDivData?.panelBottom,\r\n top: DragAndDrop.shadowDivData?.panelTop,\r\n left: DragAndDrop.shadowDivData?.panelLeft,\r\n right: DragAndDrop.shadowDivData?.panelRight,\r\n })\r\n ) {\r\n return;\r\n }\r\n\r\n if (DragAndDrop.currentBottomPanel && snapshotSection) {\r\n const bottomPanel = DragAndDrop.splash.querySelector(\r\n `[data-panel][data-id='${DragAndDrop.currentBottomPanel.id}']`,\r\n );\r\n const draggingPanel = DragAndDrop.splash.querySelector(\r\n `[data-panel][data-id='${DragAndDrop.draggingPanelId}']`,\r\n );\r\n const bottomSection = DragAndDrop.splash.querySelector(\r\n `[data-locationid='${snapshotSection.sectionId}']`,\r\n );\r\n\r\n if (bottomSection) {\r\n if (\r\n isCursorInArea({\r\n cursorX: ev.clientX,\r\n cursorY: ev.clientY + DragAndDrop.currentScroll,\r\n ...getColumnAreas({\r\n ...DragAndDrop.currentBottomPanel,\r\n panelLeft: bottomSection?.getBoundingClientRect().left ?? 0,\r\n panelRight: bottomSection?.getBoundingClientRect().right ?? 0,\r\n }).top,\r\n })\r\n ) {\r\n if (draggingPanel) {\r\n draggingPanel.setAttribute('style', 'display: none; height: 0;');\r\n }\r\n if (bottomPanel && snapshotSection) {\r\n if (bottomSection) {\r\n DragAndDrop.shadowDiv.setAttribute('style', 'opacity: 50%;');\r\n DragAndDrop.debounceBefore(\r\n bottomPanel,\r\n DragAndDrop.shadowDiv,\r\n bottomSection as HTMLElement,\r\n );\r\n DragAndDrop.snapshot();\r\n DragAndDrop.clearTimeout();\r\n }\r\n }\r\n } else if (\r\n isCursorInArea({\r\n cursorX: ev.clientX,\r\n cursorY: ev.clientY + DragAndDrop.currentScroll,\r\n ...getColumnAreas({\r\n ...DragAndDrop.currentBottomPanel,\r\n panelLeft: bottomSection?.getBoundingClientRect().left ?? 0,\r\n panelRight: bottomSection?.getBoundingClientRect().right ?? 0,\r\n }).bottom,\r\n })\r\n ) {\r\n const bottomPanel = DragAndDrop.splash.querySelector(\r\n `[data-panel][data-id='${DragAndDrop.currentBottomPanel.id}']`,\r\n );\r\n const draggingPanel = DragAndDrop.splash.querySelector(\r\n `[data-panel][data-id='${DragAndDrop.draggingPanelId}']`,\r\n );\r\n if (draggingPanel) {\r\n draggingPanel.setAttribute('style', 'display: none;');\r\n }\r\n if (bottomPanel && snapshotSection) {\r\n const bottomSection = DragAndDrop.splash.querySelector(\r\n `[data-locationid='${snapshotSection.sectionId}']`,\r\n );\r\n if (bottomSection) {\r\n DragAndDrop.shadowDiv.setAttribute('style', 'opacity: 50%;');\r\n DragAndDrop.debounceAfter(DragAndDrop.shadowDiv, bottomPanel);\r\n DragAndDrop.snapshot();\r\n DragAndDrop.clearTimeout();\r\n }\r\n }\r\n }\r\n }\r\n } else if (!DragAndDrop.currentBottomPanel && snapshotSection) {\r\n const bottomSection = DragAndDrop.splash.querySelector(\r\n `[data-locationid='${snapshotSection.sectionId}']`,\r\n );\r\n if (bottomSection) {\r\n const draggingPanel = DragAndDrop.splash.querySelector(\r\n `[data-panel][data-id='${DragAndDrop.draggingPanelId}']`,\r\n );\r\n if (draggingPanel) {\r\n draggingPanel.setAttribute('style', 'display: none;');\r\n }\r\n DragAndDrop.shadowDiv.setAttribute('style', 'opacity: 50%;');\r\n DragAndDrop.debounceAppend(\r\n bottomSection as HTMLElement,\r\n DragAndDrop.shadowDiv,\r\n );\r\n DragAndDrop.snapshot();\r\n DragAndDrop.clearTimeout();\r\n }\r\n }\r\n }\r\n}\r\n"],"names":["DragAndDrop","bottomPanel","draggingPanel","bottomSection"],"mappings":";;;AAKgB,SAAA,QAAA,CAAS,OAAcA,YAA0B,EAAA;AAC/D,EAAA,MAAM,EAAK,GAAA,K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,cAAAA,YAAY,CAAA,aAAA,CAAcA,YAAY,CAAA,SAAA,EAAWC,YAAW,CAAA,CAAA;AAC5D,cAAAD,aAAY,QAAS,EAAA,CAAA;AACrB,cAAAA,aAAY,YAAa,EAAA,CAAA;AAAA,aAC3B;AAAA,WACF;AAAA,SACF;AAAA,OACF;AAAA,KACS,MAAA,IAAA,CAACA,YAAY,CAAA,kBAAA,IAAsB,eAAiB,EAAA;AAC7D,MAAM,MAAA,aAAA,GAAgBA,aAAY,MAAO,CAAA,aAAA;AAAA,QACvC,CAAA,kBAAA,EAAqB,gBAAgB,SAAS,CAAA,EAAA,CAAA;AAAA,OAChD,CAAA;AACA,MAAA,IAAI,aAAe,EAAA;AACjB,QAAM,MAAA,aAAA,GAAgBA,aAAY,MAAO,CAAA,aAAA;AAAA,UACvC,CAAA,sBAAA,EAAyBA,aAAY,eAAe,CAAA,EAAA,CAAA;AAAA,SACtD,CAAA;AACA,QAAA,IAAI,aAAe,EAAA;AACjB,UAAc,aAAA,CAAA,YAAA,CAAa,SAAS,gBAAgB,CAAA,CAAA;AAAA,SACtD;AACA,QAAAA,YAAY,CAAA,SAAA,CAAU,YAAa,CAAA,OAAA,EAAS,eAAe,CAAA,CAAA;AAC3D,QAAAA,YAAY,CAAA,cAAA;AAAA,UACV,aAAA;AAAA,UACAA,YAAY,CAAA,SAAA;AAAA,SACd,CAAA;AACA,QAAAA,aAAY,QAAS,EAAA,CAAA;AACrB,QAAAA,aAAY,YAAa,EAAA,CAAA;AAAA,OAC3B;AAAA,KACF;AAAA,GACF;AACF;;;;"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { getSpecificParent } from '@apia/util';
|
|
2
|
+
|
|
3
|
+
function dragstart(ev, el, DragAndDrop2) {
|
|
4
|
+
if (!(el instanceof HTMLElement))
|
|
5
|
+
return;
|
|
6
|
+
DragAndDrop2.drawMinimap();
|
|
7
|
+
DragAndDrop2.sectionData = [];
|
|
8
|
+
const targetPanel = getSpecificParent(
|
|
9
|
+
ev.target,
|
|
10
|
+
(current) => !!current.dataset?.id && !!current.dataset?.panel
|
|
11
|
+
);
|
|
12
|
+
ev?.dataTransfer?.setData("text", targetPanel?.dataset.id);
|
|
13
|
+
if (targetPanel) {
|
|
14
|
+
DragAndDrop2.placeholderImage = targetPanel.cloneNode(true);
|
|
15
|
+
DragAndDrop2.placeholderImage.style.position = "fixed";
|
|
16
|
+
DragAndDrop2.placeholderImage.style.top = "-10000000.45px";
|
|
17
|
+
const children = DragAndDrop2.placeholderImage.querySelectorAll("*");
|
|
18
|
+
children.forEach((current) => current.style.overflow = "hidden");
|
|
19
|
+
document.body.append(DragAndDrop2.placeholderImage);
|
|
20
|
+
ev?.dataTransfer?.setDragImage(DragAndDrop2.placeholderImage, 0, 0);
|
|
21
|
+
}
|
|
22
|
+
if (ev.dataTransfer) {
|
|
23
|
+
ev.dataTransfer.effectAllowed = "move";
|
|
24
|
+
}
|
|
25
|
+
setTimeout(() => {
|
|
26
|
+
const targetSection = getSpecificParent(
|
|
27
|
+
ev.target,
|
|
28
|
+
(current) => !!current.dataset?.locationid
|
|
29
|
+
);
|
|
30
|
+
const sections = DragAndDrop2.body?.querySelectorAll("[data-locationid]");
|
|
31
|
+
const emptySectionsId = [];
|
|
32
|
+
sections?.forEach((sec) => {
|
|
33
|
+
if (sec.children.length === 0) {
|
|
34
|
+
emptySectionsId.push(sec.dataset.locationid ?? "");
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
emptySectionsId.forEach((emptySecId) => {
|
|
38
|
+
const section = DragAndDrop2.body?.querySelector(
|
|
39
|
+
`[data-locationid="${emptySecId}"]`
|
|
40
|
+
);
|
|
41
|
+
if (section) {
|
|
42
|
+
section.setAttribute("style", "padding: 10px; border:2px dashed #ccc");
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
DragAndDrop2.snapshot();
|
|
46
|
+
if (targetPanel) {
|
|
47
|
+
DragAndDrop2.draggingPanelSectionId = targetSection?.dataset.locationid ?? "";
|
|
48
|
+
DragAndDrop2.draggingPanelId = targetPanel.dataset.id;
|
|
49
|
+
DragAndDrop2.draggingPanel = targetPanel;
|
|
50
|
+
}
|
|
51
|
+
if (DragAndDrop2.draggingPanelId === "") {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const falseDiv = targetPanel?.cloneNode(true);
|
|
55
|
+
falseDiv.style.opacity = `50%`;
|
|
56
|
+
falseDiv.style.width = `100%`;
|
|
57
|
+
falseDiv.style.height = `auto`;
|
|
58
|
+
falseDiv.style.backgroundColor = `rgba(0,0,0,0.1)`;
|
|
59
|
+
falseDiv.className = "apia_panel_falseDiv";
|
|
60
|
+
DragAndDrop2.shadowDiv = falseDiv;
|
|
61
|
+
}, 0);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { dragstart };
|
|
65
|
+
//# sourceMappingURL=Dragstart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dragstart.js","sources":["../../../src/splash/events/Dragstart.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\r\nimport { getSpecificParent } from '@apia/util';\r\nimport { DragAndDrop } from '../util/DragAndDrop';\r\n\r\nexport function dragstart(\r\n ev: DragEvent,\r\n el: Element,\r\n DragAndDrop: DragAndDrop,\r\n) {\r\n if (!(el instanceof HTMLElement)) return;\r\n DragAndDrop.drawMinimap();\r\n DragAndDrop.sectionData = [];\r\n\r\n const targetPanel = getSpecificParent(\r\n ev.target as HTMLElement,\r\n (current) => !!current.dataset?.id && !!current.dataset?.panel,\r\n );\r\n\r\n ev?.dataTransfer?.setData('text', targetPanel?.dataset.id as string);\r\n if (targetPanel) {\r\n DragAndDrop.placeholderImage = targetPanel.cloneNode(true) as HTMLElement;\r\n DragAndDrop.placeholderImage.style.position = 'fixed';\r\n DragAndDrop.placeholderImage.style.top = '-10000000.45px';\r\n\r\n const children =\r\n DragAndDrop.placeholderImage.querySelectorAll<HTMLElement>('*');\r\n children.forEach((current) => (current.style.overflow = 'hidden'));\r\n document.body.append(DragAndDrop.placeholderImage);\r\n ev?.dataTransfer?.setDragImage(DragAndDrop.placeholderImage, 0, 0);\r\n }\r\n if (ev.dataTransfer) {\r\n // eslint-disable-next-line no-param-reassign\r\n ev.dataTransfer.effectAllowed = 'move';\r\n }\r\n\r\n setTimeout(() => {\r\n const targetSection = getSpecificParent(\r\n ev.target as HTMLElement,\r\n (current) => !!current.dataset?.locationid,\r\n );\r\n\r\n const sections = DragAndDrop.body?.querySelectorAll('[data-locationid]');\r\n\r\n const emptySectionsId: string[] = [];\r\n\r\n sections?.forEach((sec) => {\r\n if (sec.children.length === 0) {\r\n emptySectionsId.push((sec as HTMLElement).dataset.locationid ?? '');\r\n }\r\n });\r\n\r\n emptySectionsId.forEach((emptySecId) => {\r\n const section = DragAndDrop.body?.querySelector(\r\n `[data-locationid=\"${emptySecId}\"]`,\r\n );\r\n if (section) {\r\n section.setAttribute('style', 'padding: 10px; border:2px dashed #ccc');\r\n }\r\n });\r\n\r\n DragAndDrop.snapshot();\r\n\r\n if (targetPanel) {\r\n DragAndDrop.draggingPanelSectionId =\r\n targetSection?.dataset.locationid ?? '';\r\n DragAndDrop.draggingPanelId = targetPanel.dataset.id as string;\r\n DragAndDrop.draggingPanel = targetPanel;\r\n }\r\n if (DragAndDrop.draggingPanelId === '') {\r\n return;\r\n }\r\n const falseDiv = targetPanel?.cloneNode(true) as HTMLDivElement;\r\n falseDiv.style.opacity = `50%`;\r\n falseDiv.style.width = `100%`;\r\n falseDiv.style.height = `auto`;\r\n falseDiv.style.backgroundColor = `rgba(0,0,0,0.1)`;\r\n falseDiv.className = 'apia_panel_falseDiv';\r\n DragAndDrop.shadowDiv = falseDiv;\r\n }, 0);\r\n}\r\n"],"names":["DragAndDrop"],"mappings":";;AAIgB,SAAA,SAAA,CACd,EACA,EAAA,EAAA,EACAA,YACA,EAAA;AACA,EAAA,IAAI,EAAE,EAAc,YAAA,WAAA,CAAA;AAAc,IAAA,OAAA;AAClC,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AAS,MAAM,OAAU,GAAA,CAAA,GAAA,CAAA,CAAA;AACzB,IAAA,QAAA,CAAS,MAAM,KAAQ,GAAA,CAAA,IAAA,CAAA,CAAA;AACvB,IAAA,QAAA,CAAS,MAAM,MAAS,GAAA,CAAA,IAAA,CAAA,CAAA;AACxB,IAAA,QAAA,CAAS,MAAM,eAAkB,GAAA,CAAA,eAAA,CAAA,CAAA;AACjC,IAAA,QAAA,CAAS,SAAY,GAAA,qBAAA,CAAA;AACrB,IAAAA,aAAY,SAAY,GAAA,QAAA,CAAA;AAAA,KACvB,CAAC,CAAA,CAAA;AACN;;;;"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { getSpecificParent } from '@apia/util';
|
|
2
|
+
import { updatePanelPosition } from '../../position/usePanelPosition.js';
|
|
3
|
+
|
|
4
|
+
function Drop(event, DragAndDrop2) {
|
|
5
|
+
if (DragAndDrop2.body) {
|
|
6
|
+
const ev = event;
|
|
7
|
+
const data = ev?.dataTransfer?.getData("text");
|
|
8
|
+
const sections = DragAndDrop2.body?.querySelectorAll("[data-locationid]");
|
|
9
|
+
sections.forEach((sec) => {
|
|
10
|
+
sec.setAttribute("style", "");
|
|
11
|
+
});
|
|
12
|
+
const draggingPanel = DragAndDrop2.body.querySelector(
|
|
13
|
+
`[data-panel][data-id="${DragAndDrop2.draggingPanelId}"]:not(.apia_panel_falseDiv)`
|
|
14
|
+
);
|
|
15
|
+
if (draggingPanel) {
|
|
16
|
+
draggingPanel.setAttribute("style", "");
|
|
17
|
+
}
|
|
18
|
+
const falseDiv = document.querySelector(".apia_panel_falseDiv");
|
|
19
|
+
if (data) {
|
|
20
|
+
const child = document.querySelector(
|
|
21
|
+
`[data-panel][data-id="${data}"]:not(.apia_panel_falseDiv)`
|
|
22
|
+
);
|
|
23
|
+
sections.forEach((sec) => {
|
|
24
|
+
if (sec.children.length === 1) {
|
|
25
|
+
sec.setAttribute("style", "");
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
if (falseDiv) {
|
|
29
|
+
const newSection = getSpecificParent(
|
|
30
|
+
falseDiv,
|
|
31
|
+
(current) => !!current.dataset.locationid
|
|
32
|
+
);
|
|
33
|
+
if (newSection) {
|
|
34
|
+
const panelsArray = Array.from(newSection.children);
|
|
35
|
+
const childId = child.dataset.id;
|
|
36
|
+
if (childId) {
|
|
37
|
+
const index = panelsArray.findIndex(
|
|
38
|
+
(panel) => panel.dataset.id === childId
|
|
39
|
+
);
|
|
40
|
+
if (typeof index === "number" && newSection.dataset.locationid) {
|
|
41
|
+
void updatePanelPosition(
|
|
42
|
+
childId,
|
|
43
|
+
newSection.dataset.locationid,
|
|
44
|
+
index + 1
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
falseDiv.replaceWith(child);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
DragAndDrop2.draggingPanelId = "";
|
|
53
|
+
DragAndDrop2.panelData = [];
|
|
54
|
+
DragAndDrop2.drawMinimap();
|
|
55
|
+
DragAndDrop2.removePlaceholder();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { Drop };
|
|
60
|
+
//# sourceMappingURL=Drop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Drop.js","sources":["../../../src/splash/events/Drop.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\r\nimport { getSpecificParent } from '@apia/util';\r\nimport { updatePanelPosition } from '../../position/usePanelPosition';\r\nimport { DragAndDrop } from '../util/DragAndDrop';\r\n\r\nexport function Drop(event: Event, DragAndDrop: DragAndDrop) {\r\n if (DragAndDrop.body) {\r\n const ev = event as DragEvent;\r\n const data = ev?.dataTransfer?.getData('text');\r\n\r\n const sections = DragAndDrop.body?.querySelectorAll('[data-locationid]');\r\n\r\n sections.forEach((sec) => {\r\n sec.setAttribute('style', '');\r\n });\r\n\r\n const draggingPanel = DragAndDrop.body.querySelector(\r\n `[data-panel][data-id=\"${DragAndDrop.draggingPanelId}\"]:not(.apia_panel_falseDiv)`,\r\n );\r\n\r\n if (draggingPanel) {\r\n draggingPanel.setAttribute('style', '');\r\n }\r\n const falseDiv = document.querySelector('.apia_panel_falseDiv');\r\n\r\n if (data) {\r\n const child = document.querySelector(\r\n `[data-panel][data-id=\"${data}\"]:not(.apia_panel_falseDiv)`,\r\n );\r\n sections.forEach((sec) => {\r\n if (sec.children.length === 1) {\r\n sec.setAttribute('style', '');\r\n }\r\n });\r\n if (falseDiv) {\r\n const newSection = getSpecificParent(\r\n falseDiv as HTMLElement,\r\n (current) => !!current.dataset.locationid,\r\n );\r\n\r\n if (newSection) {\r\n const panelsArray = Array.from(newSection.children);\r\n const childId = (child as HTMLElement).dataset.id;\r\n\r\n if (childId) {\r\n const index = panelsArray.findIndex(\r\n (panel) => (panel as HTMLElement).dataset.id === childId,\r\n );\r\n\r\n if (typeof index === 'number' && newSection.dataset.locationid) {\r\n void updatePanelPosition(\r\n childId,\r\n newSection.dataset.locationid,\r\n index + 1,\r\n );\r\n }\r\n }\r\n }\r\n falseDiv.replaceWith(child as Node);\r\n }\r\n }\r\n\r\n DragAndDrop.draggingPanelId = '';\r\n DragAndDrop.panelData = [];\r\n DragAndDrop.drawMinimap();\r\n\r\n DragAndDrop.removePlaceholder();\r\n }\r\n}\r\n"],"names":["DragAndDrop"],"mappings":";;;AAKgB,SAAA,IAAA,CAAK,OAAcA,YAA0B,EAAA;AAC3D,EAAA,IAAIA,aAAY,IAAM,EAAA;AACpB,IAAA,MAAM,EAAK,GAAA,KAAA,CAAA;AACX,IAAA,MAAM,IAAO,GAAA,EAAA,EAAI,YAAc,EAAA,OAAA,CAAQ,MAAM,CAAA,CAAA;AAE7C,IAAA,MAAM,QAAWA,GAAAA,YAAAA,CAAY,IAAM,EAAA,gBAAA,CAAiB,mBAAmB,CAAA,CAAA;AAEvE,IAAS,QAAA,CAAA,OAAA,CAAQ,CAAC,GAAQ,KAAA;AACxB,MAAI,G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OAAA;AAAA,aACnD,CAAA;AAEA,YAAA,IAAI,OAAO,KAAA,KAAU,QAAY,IAAA,UAAA,CAAW,QAAQ,UAAY,EAAA;AAC9D,cAAK,KAAA,mBAAA;AAAA,gBACH,OAAA;AAAA,gBACA,WAAW,OAAQ,CAAA,UAAA;AAAA,gBACnB,KAAQ,GAAA,CAAA;AAAA,eACV,CAAA;AAAA,aACF;AAAA,WACF;AAAA,SACF;AACA,QAAA,QAAA,CAAS,YAAY,KAAa,CAAA,CAAA;AAAA,OACpC;AAAA,KACF;AAEA,IAAAA,aAAY,eAAkB,GAAA,EAAA,CAAA;AAC9B,IAAAA,YAAAA,CAAY,YAAY,EAAC,CAAA;AACzB,IAAAA,aAAY,WAAY,EAAA,CAAA;AAExB,IAAAA,aAAY,iBAAkB,EAAA,CAAA;AAAA,GAChC;AACF;;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx, Fragment } from '@apia/theme/jsx-runtime';
|
|
2
|
+
import { Icon } from '@apia/icons';
|
|
3
|
+
import { getLabel } from '@apia/util';
|
|
4
|
+
import { usePanelNetworkState } from '../../../actions/usePanelNetworkState.js';
|
|
5
|
+
|
|
6
|
+
const NetworkState = ({ title }) => {
|
|
7
|
+
const isConnected = usePanelNetworkState();
|
|
8
|
+
return /* @__PURE__ */ jsx(Fragment, { children: !isConnected && /* @__PURE__ */ jsx(
|
|
9
|
+
Icon,
|
|
10
|
+
{
|
|
11
|
+
tabIndex: 0,
|
|
12
|
+
title: getLabel("lblTestDBNoOk", {
|
|
13
|
+
text: {
|
|
14
|
+
TOK1: title
|
|
15
|
+
}
|
|
16
|
+
}).text,
|
|
17
|
+
"aria-label": getLabel("lblTestDBNoOk", {
|
|
18
|
+
text: {
|
|
19
|
+
TOK1: title
|
|
20
|
+
}
|
|
21
|
+
}).text,
|
|
22
|
+
name: "Alert"
|
|
23
|
+
}
|
|
24
|
+
) });
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { NetworkState };
|
|
28
|
+
//# sourceMappingURL=NetworkState.js.map
|
|
@@ -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,YAAe,GAAA,CAAC,EAAE,KAAA,EAA+B,KAAA;AAC5D,EAAA,MAAM,cAAc,oBAAqB,EAAA,CAAA;AACzC,EACE,uBAAA,GAAA,CAAA,QAAA,EAAA,EACG,WAAC,WACA,oBAAA,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,QAAU,EAAA,CAAA;AAAA,MACV,KAAA,EACE,SAAS,eAAiB,EAAA;AAAA,QACxB,IAAM,EAAA;AAAA,UACJ,IAAM,EAAA,KAAA;AAAA,SACR;AAAA,OACD,CAAE,CAAA,IAAA;AAAA,MAEL,YAAA,EACE,SAAS,eAAiB,EAAA;AAAA,QACxB,IAAM,EAAA;AAAA,UACJ,IAAM,EAAA,KAAA;AAAA,SACR;AAAA,OACD,CAAE,CAAA,IAAA;AAAA,MAEL,IAAK,EAAA,OAAA;AAAA,KAAA;AAAA,GAGX,EAAA,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
|
|
6
|
+
const [, panelButtonsActions, PanelButtons] = makeImperativeComponent()({
|
|
7
|
+
Component: (props) => {
|
|
8
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9
|
+
props.isRefreshable && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(RefreshButton, { ...props }) }),
|
|
10
|
+
props.isConfigurable && /* @__PURE__ */ jsx(SettingsButton, { title: props.title })
|
|
11
|
+
] });
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export { PanelButtons, panelButtonsActions };
|
|
16
|
+
//# 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\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 </>\r\n );\r\n },\r\n});\r\n"],"names":[],"mappings":";;;;;AAKO,MAAM,GAAG,mBAAA,EAAqB,YAAY,CAAA,GAAI,yBAKjD,CAAA;AAAA,EACF,SAAA,EAAW,CAAC,KAAU,KAAA;AACpB,IAAA,uBAEK,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,MAAA,KAAA,CAAM,iCAEH,GAAA,CAAA,QAAA,EAAA,EAAA,QAAA,kBAAA,GAAA,CAAC,aAAe,EAAA,EAAA,GAAG,OAAO,CAC5B,EAAA,CAAA;AAAA,MAED,MAAM,cAAkB,oBAAA,GAAA,CAAC,cAAe,EAAA,EAAA,KAAA,EAAO,MAAM,KAAO,EAAA,CAAA;AAAA,KAC/D,EAAA,CAAA,CAAA;AAAA,GAEJ;AACF,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",
|
|
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\"\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":";;;;;;;AAKa,MAAA,aAAA,GAAgB,CAAC,KAIxB,KAAA;AACJ,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AAElD,EAAA,MAAM,YAAY,iBAAkB,EAAA,CAAA;AACpC,EAAA,MAAM,WAAW,eAAgB,EAAA,CAAA;AAEjC,EAA6B,4BAAA,CAAA;AAAA,IAC3B,QAAQ,gBAA2B,EAAA;AACjC,MAAA,aAAA,CAAc,gBAAgB,CAAA,CAAA;AAAA,KAChC;AAAA,GACD,CAAA,CAAA;AAED,EACE,uBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,SAAA;AAAA,MACL,OAAQ,EAAA,sBAAA;AAAA,MACR,SAAU,EAAA,mBAAA;AAAA,MACV,IAAK,EAAA,IAAA;AAAA,MACL,OAAA,EAAS,YAAY,MAAM;AACzB,QAAA,KAAK,QAAS,CAAA,EAAE,MAAQ,EAAA,SAAA,EAAW,CAAA,CAAA;AAAA,OACrC,EAAG,CAAC,QAAQ,CAAC,CAAA;AAAA,MACb,KAAA,EAAO,QAAS,CAAA,eAAA,EAAiB,EAAE,IAAA,EAAM,EAAE,IAAA,EAAM,KAAM,CAAA,KAAA,EAAQ,EAAC,CAAE,CAAA,IAAA;AAAA,MAClE,SAAA;AAAA,MACA,QAAU,EAAA,UAAA;AAAA,KAAA;AAAA,GACZ,CAAA;AAEJ;;;;"}
|