@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":"panelsStore.js","sources":["../../src/panelsStore/panelsStore.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\r\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\r\n/* eslint-disable no-restricted-imports */\r\n/* eslint-disable @typescript-eslint/no-explicit-any */\r\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\r\nimport {\r\n createSlice,\r\n injectReducers,\r\n PayloadAction,\r\n Draft,\r\n SliceCaseReducers,\r\n CaseReducer,\r\n} from '@apia/store';\r\nimport { TPanelId, TPanelType } from '../types';\r\n\r\ntype ValidateSliceCaseReducers<S, ACR extends SliceCaseReducers<S>> = ACR & {\r\n [T in keyof ACR]: ACR[T] extends {\r\n reducer(s: S, action?: infer A): any;\r\n }\r\n ? {\r\n prepare(...a: never[]): Omit<A, 'type'>;\r\n }\r\n : {};\r\n};\r\n\r\nexport type TPanelsSliceState = Record<string, Record<string, unknown>>;\r\n\r\nexport type TReducers<\r\n State = any,\r\n CR extends SliceCaseReducers<State> = SliceCaseReducers<State>,\r\n> = ValidateSliceCaseReducers<State, CR>;\r\n\r\ntype TPanelsReducers<\r\n State = any,\r\n CR extends SliceCaseReducers<State> = SliceCaseReducers<State>,\r\n> = Record<string, TReducers<State, CR>>;\r\n\r\n/**\r\n * Los updaters son funciones que permiten modificar la forma en la que un\r\n * panel modifica su estado, se puede pensar como un análogo del reducer\r\n *\r\n * {\r\n * panelTypeA: {\r\n * updaterA: (state, data) => { ...update panel store },\r\n * updaterB: (state, data) => { ...update panel store },\r\n * }\r\n * }\r\n */\r\nexport const reducers: TPanelsReducers<Record<string, unknown>> = {};\r\n\r\nexport function initPanelTypeUpdater(panelType: TPanelType) {\r\n if (!reducers[panelType]) {\r\n reducers[panelType] = {\r\n defaultReducer: (\r\n panelsState,\r\n payload: PayloadAction<{ name: string }>,\r\n ) => {\r\n Object.assign(panelsState, payload);\r\n },\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * Permite registrar nuevas formas de actualizar el estado de un tipo de panel\r\n */\r\nexport function registerReducers<\r\n State = any,\r\n CR extends SliceCaseReducers<State> = SliceCaseReducers<State>,\r\n>(panelType: TPanelType, newReducers: TReducers<State, CR>) {\r\n initPanelTypeUpdater(panelType);\r\n Object.assign(reducers[panelType], newReducers);\r\n}\r\n\r\nexport function initPanelState(\r\n state: Draft<TPanelsSliceState>,\r\n panelType: TPanelType,\r\n panelId: TPanelId,\r\n initialState: any,\r\n) {\r\n if (!state[panelType]) {\r\n state[panelType] = {};\r\n }\r\n if (!state[panelType][panelId]) state[panelType][panelId] = {};\r\n state[panelType][panelId] = initialState;\r\n}\r\n\r\nexport const panelsSlice = createSlice({\r\n name: 'panelsSlice',\r\n initialState: {} as TPanelsSliceState,\r\n reducers: {\r\n initState(\r\n state,\r\n {\r\n payload: { panelId, panelType, initialState },\r\n }: PayloadAction<{\r\n panelType: TPanelType;\r\n panelId: TPanelId;\r\n reducer?: string; // reducer will be used to customize the way the slice is updated\r\n initialState: any;\r\n }>,\r\n ) {\r\n if (!state[panelType]?.[panelId]) {\r\n initPanelState(state, panelType, panelId, initialState);\r\n state[panelType][panelId] = initialState;\r\n }\r\n },\r\n updatePanelStore(\r\n state,\r\n {\r\n payload: { data, panelId, panelType, reducer, initialState },\r\n }: PayloadAction<{\r\n panelType: TPanelType;\r\n panelId: TPanelId;\r\n reducer?: string; // Updater will be used to customize the way the slice is updated\r\n data: any;\r\n initialState?: any;\r\n }>,\r\n ) {\r\n if (!state[panelType]?.[panelId]) {\r\n initPanelState(state, panelType, panelId, initialState ?? {});\r\n }\r\n const panelsStore = state[panelType][panelId];\r\n initPanelTypeUpdater(panelType);\r\n\r\n if (!reducers[panelType][reducer ?? 'default']) {\r\n return;\r\n }\r\n\r\n const currentReducer = reducers[panelType][\r\n reducer ?? 'default'\r\n ] as CaseReducer;\r\n currentReducer(panelsStore, data);\r\n },\r\n },\r\n});\r\n\r\nexport const { useSelector: usePanelStoreSelector, store: panelsStore } =\r\n injectReducers({\r\n panelsSlice: panelsSlice.reducer,\r\n });\r\n\r\nexport const panelsActions = panelsSlice.actions;\r\n"],"names":["panelsStore"],"mappings":";;AAgDO,MAAM,WAAqD;AAE3D,SAAS,qBAAqB,SAAA,EAAuB;AAC1D,EAAA,IAAI,CAAC,QAAA,CAAS,SAAS,CAAA,EAAG;AACxB,IAAA,QAAA,CAAS,SAAS,CAAA,GAAI;AAAA,MACpB,cAAA,EAAgB,CACd,WAAA,EACA,OAAA,KACG;AACH,QAAA,MAAA,CAAO,MAAA,CAAO,aAAa,OAAO,CAAA;AAAA;AACpC,KACF;AAAA;AAEJ;AAKO,SAAS,gBAAA,CAGd,WAAuB,WAAA,EAAmC;AAC1D,EAAA,oBAAA,CAAqB,SAAS,CAAA;AAC9B,EAAA,MAAA,CAAO,MAAA,CAAO,QAAA,CAAS,SAAS,CAAA,EAAG,WAAW,CAAA;AAChD;AAEO,SAAS,cAAA,CACd,KAAA,EACA,SAAA,EACA,OAAA,EACA,YAAA,EACA;AACA,EAAA,IAAI,CAAC,KAAA,CAAM,SAAS,CAAA,EAAG;AACrB,IAAA,KAAA,CAAM,SAAS,IAAI,EAAC;AAAA;AAEtB,EAAA,IAAI,CAAC,KAAA,CAAM,SAAS,CAAA,CAAE,OAAO,CAAA;AAAG,IAAA,KAAA,CAAM,SAAS,CAAA,CAAE,OAAO,CAAA,GAAI,EAAC;AAC7D,EAAA,KAAA,CAAM,SAAS,CAAA,CAAE,OAAO,CAAA,GAAI,YAAA;AAC9B;AAEO,MAAM,cAAc,WAAA,CAAY;AA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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;AAsBxB,SAAS,iBACd,SAAA,EACA,SAAA,EACA,YAAA,EACA,QAAA,EACA,aAAoD,YAAA,EAC1C;AACV,EAAA,MAAM,EAAE,OAAA,EAAQ,GAAI,gBAAA,EAAiB;AACrC,EAAA,IAAI,CAAC,OAAA;AAAS,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,4BAAA,EAA+B,SAAS,CAAA,CAAE,CAAA;AAExE,EAAA,MAAM,UAAA,GAAa,WAAA,CAAY,QAAA,EAAS,CAAE,YAAY,SAAS,CAAA;AAC/D,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,QAAA;AAAA,IAChC,eACI,QAAA,CAAU,UAAA,GAAa,OAAO,CAAA,IAAmB,YAAY,IAC5D;AAAC,GACR;AAEA,EAAA,MAAM,gBAAA,GAAmB,MAAA;AAAA,IACvB,SAAA,IAAc;AAAA,GAChB;AAEA,EAAA,qBAAA,CAAsB,CAAC,MAAA,KAAW;AAChC,IAAA,MAAM,QAAA,GAAW,MAAA,CAAO,WAAA,CAAY,SAAS,IAAI,OAAO,CAAA;AAGxD,IAAA,IAAI,aAAa,MAAA,EAAW;AAC1B,MAAA,MAAM,WAAA,GAAc,SAAS,QAAQ,CAAA;AACrC,MAAA,IACE,gBAAA,CAAiB,YAAY,eAAA,IAC7B,CAAC,WAAW,gBAAA,CAAiB,OAAA,EAAqB,WAAW,CAAA,EAC7D;AACA,QAAA,gBAAA,CAAiB,OAAA,GAAU,WAAA;AAC3B,QAAA,YAAA,CAAa,WAAW,CAAA;AAAA;AAC1B;AACF,GACD,CAAA;AAED,EAAA,OAAO,SAAA;AACT;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TPanelIdentifier } from '../eventsController/types.js';
|
|
2
|
+
|
|
3
|
+
declare function changePanelTitle(identifier: TPanelIdentifier, newTitle: string): void;
|
|
4
|
+
declare function usePanelChangeTitle(): (newTitle: string) => void;
|
|
5
|
+
|
|
6
|
+
export { changePanelTitle, usePanelChangeTitle };
|
|
7
|
+
//# sourceMappingURL=usePanelChangeTitle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePanelChangeTitle.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { eventsController } from '../eventsController/eventsController.js';
|
|
3
|
+
import { usePanelFireEvent } from '../eventsController/usePanelFireEvent.js';
|
|
4
|
+
|
|
5
|
+
function changePanelTitle(identifier, newTitle) {
|
|
6
|
+
eventsController.fireEvent(identifier, "changeTitle", newTitle);
|
|
7
|
+
}
|
|
8
|
+
function usePanelChangeTitle() {
|
|
9
|
+
const fireEvent = usePanelFireEvent();
|
|
10
|
+
return useCallback(
|
|
11
|
+
(newTitle) => {
|
|
12
|
+
fireEvent("changeTitle", newTitle);
|
|
13
|
+
},
|
|
14
|
+
[fireEvent]
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { changePanelTitle, usePanelChangeTitle };
|
|
19
|
+
//# 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(\r\n identifier: TPanelIdentifier,\r\n newTitle: string,\r\n) {\r\n eventsController.fireEvent(identifier, 'changeTitle', newTitle);\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":";;;;AAOO,SAAS,gBAAA,CACd,YACA,QAAA,EACA;AACA,EAAA,gBAAA,CAAiB,SAAA,CAAU,UAAA,EAAY,aAAA,EAAe,QAAQ,CAAA;AAChE;AAEO,SAAS,mBAAA,GAAsB;AACpC,EAAA,MAAM,YAAY,iBAAA,EAAkB;AAEpC,EAAA,OAAO,WAAA;AAAA,IACL,CAAC,QAAA,KAAqB;AACpB,MAAA,SAAA,CAAU,eAAe,QAAQ,CAAA;AAAA,KACnC;AAAA,IACA,CAAC,SAAS;AAAA,GACZ;AACF;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePanelTitleAction.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { usePanelParametersSelector } from '../config/usePanelParametersSelector.js';
|
|
2
|
+
import { parametersStore, parametersActions } from '../config/parametersStore.js';
|
|
3
|
+
|
|
4
|
+
const panelActionParameterName = "__panelTitleAction";
|
|
5
|
+
const panelImageParameterName = "__panelImageAction";
|
|
6
|
+
const panelDescriptionParameterName = "__panelTitleDescription";
|
|
7
|
+
function setPanelTitleAction(panelId, newAction) {
|
|
8
|
+
parametersStore.dispatch(
|
|
9
|
+
parametersActions.udpate({
|
|
10
|
+
panelId,
|
|
11
|
+
parameters: { [panelActionParameterName]: newAction }
|
|
12
|
+
})
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
function setPanelTitleDescritpion(panelId, newDescription) {
|
|
16
|
+
parametersStore.dispatch(
|
|
17
|
+
parametersActions.udpate({
|
|
18
|
+
panelId,
|
|
19
|
+
parameters: { [panelDescriptionParameterName]: newDescription }
|
|
20
|
+
})
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
function setPanelImageAction(panelId, newImage) {
|
|
24
|
+
parametersStore.dispatch(
|
|
25
|
+
parametersActions.udpate({
|
|
26
|
+
panelId,
|
|
27
|
+
parameters: { [panelImageParameterName]: newImage }
|
|
28
|
+
})
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
function usePanelTitleAction() {
|
|
32
|
+
return usePanelParametersSelector(
|
|
33
|
+
(current) => current[panelActionParameterName]
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
function usePanelImage() {
|
|
37
|
+
return usePanelParametersSelector(
|
|
38
|
+
(current) => current[panelImageParameterName]
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
function usePanelTitleDescription() {
|
|
42
|
+
return usePanelParametersSelector(
|
|
43
|
+
(current) => current[panelDescriptionParameterName]
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { setPanelImageAction, setPanelTitleAction, setPanelTitleDescritpion, usePanelImage, usePanelTitleAction, usePanelTitleDescription };
|
|
48
|
+
//# 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 panelImageParameterName = '__panelImageAction';\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\nexport function setPanelImageAction(panelId: string, newImage: string) {\r\n parametersStore.dispatch(\r\n parametersActions.udpate({\r\n panelId,\r\n parameters: { [panelImageParameterName]: newImage },\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 usePanelImage() {\r\n return usePanelParametersSelector(\r\n (current) => current[panelImageParameterName] 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":[],"mappings":";;;AAGA,MAAM,wBAAA,GAA2B,oBAAA;AACjC,MAAM,uBAAA,GAA0B,oBAAA;AAChC,MAAM,6BAAA,GAAgC,yBAAA;AAE/B,SAAS,mBAAA,CAAoB,SAAiB,SAAA,EAAmB;AACtE,EAAA,eAAA,CAAgB,QAAA;AAAA,IACd,kBAAkB,MAAA,CAAO;AAAA,MACvB,OAAA;AAAA,MACA,UAAA,EAAY,EAAE,CAAC,wBAAwB,GAAG,SAAA;AAAU,KACrD;AAAA,GACH;AACF;AACO,SAAS,wBAAA,CACd,SACA,cAAA,EACA;AACA,EAAA,eAAA,CAAgB,QAAA;AAAA,IACd,kBAAkB,MAAA,CAAO;AAAA,MACvB,OAAA;AAAA,MACA,UAAA,EAAY,EAAE,CAAC,6BAA6B,GAAG,cAAA;AAAe,KAC/D;AAAA,GACH;AACF;AACO,SAAS,mBAAA,CAAoB,SAAiB,QAAA,EAAkB;AACrE,EAAA,eAAA,CAAgB,QAAA;AAAA,IACd,kBAAkB,MAAA,CAAO;AAAA,MACvB,OAAA;AAAA,MACA,UAAA,EAAY,EAAE,CAAC,uBAAuB,GAAG,QAAA;AAAS,KACnD;AAAA,GACH;AACF;AAEO,SAAS,mBAAA,GAAsB;AACpC,EAAA,OAAO,0BAAA;AAAA,IACL,CAAC,OAAA,KAAY,OAAA,CAAQ,wBAAwB;AAAA,GAC/C;AACF;AAEO,SAAS,aAAA,GAAgB;AAC9B,EAAA,OAAO,0BAAA;AAAA,IACL,CAAC,OAAA,KAAY,OAAA,CAAQ,uBAAuB;AAAA,GAC9C;AACF;AAEO,SAAS,wBAAA,GAA2B;AACzC,EAAA,OAAO,0BAAA;AAAA,IACL,CAAC,OAAA,KAAY,OAAA,CAAQ,6BAA6B;AAAA,GACpD;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\n return updatePanelPosition(panelId, containerId, newPosition);\r\n };\r\n}\r\n"],"names":[],"mappings":";;;;;AAKA,MAAM,6BAA6B,YAAA,CAMhC;AAAC;AAEG,MAAM,oBAAA,GAAuB,IAAI,oBAAA;AAMjC,SAAS,gBAAA,GAAmB;AACjC,EAAA,MAAM,EAAE,OAAA,EAAQ,GAAI,gBAAA,EAAiB;AAErC,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,QAAA,EAG7B;AAEH,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,OAAO,oBAAA,CAAqB,EAAA,CAAG,aAAA,EAAe,CAAC,EAAA,KAAO;AACpD,MAAA,IAAI,GAAG,OAAA,KAAY,OAAA;AACjB,QAAA,WAAA,CAAY,EAAE,WAAA,EAAa,EAAA,CAAG,aAAa,QAAA,EAAU,EAAA,CAAG,aAAa,CAAA;AAAA,KACxE,CAAA;AAAA,GACH,EAAG,CAAC,OAAO,CAAC,CAAA;AAEZ,EAAA,OAAO,QAAA;AACT;AAEA,eAAsB,mBAAA,CACpB,OAAA,EACA,WAAA,EACA,WAAA,EACA;AACA,EAAA,MAAM,MAAA,GAAS,MAAM,OAAA,CAAQ,IAAA;AAAA,IAC3B,WAAA,CAAY;AAAA,MACV,MAAA,EAAQ,WAAA;AAAA,MACR,KAAA,EAAO,OAAA;AAAA,MACP,WAAA;AAAA,MACA;AAAA,KACD;AAAA,GACH;AAEA,EAAA,MAAM,aAAa,MAAA,EAAQ,IAAA,IAAQ,CAAC,MAAA,CAAO,QAAA,IAAY,CAAC,MAAA,CAAO,WAAA;AAE/D,EAAA,IAAI,UAAA;AACF,IAAA,oBAAA,CAAqB,KAAK,aAAA,EAAe;AAAA,MACvC,OAAA;AAAA,MACA,WAAA;AAAA,MACA;AAAA,KACD,CAAA;AAEH,EAAA,OAAO,UAAA;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":";;AAGO,SAAS,SAAA,CAAU,KAAYA,YAAAA,EAA0B;AAC9D,EAAA,MAAM,EAAA,GAAK,GAAA;AAEX,EAAA,IACE,GAAG,aAAA,KAAkB,IAAA,IACrB,QAAQ,EAAA,CAAG,aAAA,EAA8B,CAAC,OAAA,KAAY;AACpD,IAAA,OACE,OAAA,CAAQ,kBAAkB,IAAA,IAC1B,OAAA,KAAY,SAAS,WAAA,EAAY,IACjC,OAAA,CAAQ,OAAA,CAAQ,MAAA,KAAW,MAAA;AAAA,GAE9B,CAAA,EACD;AACA,IAAA,MAAM,OAAA,GAAU,QAAA,CAAS,gBAAA,CAAiB,sBAAsB,CAAA;AAEhE,IAAA,OAAA,CAAQ,OAAA,CAAQ,CAAC,EAAA,KAAO,EAAA,CAAG,QAAQ,CAAA;AACnC,IAAAA,YAAAA,CAAY,aAAA,EAAe,YAAA,CAAa,OAAA,EAAS,EAAE,CAAA;AAAA;AAEvD;;;;"}
|
|
@@ -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":";;;AAKO,S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AACF,KACF,MAAA,IAAW,CAACA,YAAAA,CAAY,kBAAA,IAAsB,eAAA,EAAiB;AAC7D,MAAA,MAAM,aAAA,GAAgBA,aAAY,MAAA,CAAO,aAAA;AAAA,QACvC,CAAA,kBAAA,EAAqB,gBAAgB,SAAS,CAAA,EAAA;AAAA,OAChD;AACA,MAAA,IAAI,aAAA,EAAe;AACjB,QAAA,MAAM,aAAA,GAAgBA,aAAY,MAAA,CAAO,aAAA;AAAA,UACvC,CAAA,sBAAA,EAAyBA,aAAY,eAAe,CAAA,EAAA;AAAA,SACtD;AACA,QAAA,IAAI,aAAA,EAAe;AACjB,UAAA,aAAA,CAAc,YAAA,CAAa,SAAS,gBAAgB,CAAA;AAAA;AAEtD,QAAAA,YAAAA,CAAY,SAAA,CAAU,YAAA,CAAa,OAAA,EAAS,eAAe,CAAA;AAC3D,QAAAA,YAAAA,CAAY,cAAA;AAAA,UACV,aAAA;AAAA,UACAA,YAAAA,CAAY;AAAA,SACd;AACA,QAAAA,aAAY,QAAA,EAAS;AACrB,QAAAA,aAAY,YAAA,EAAa;AAAA;AAC3B;AACF;AAEJ;;;;"}
|
|
@@ -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":";;AAIO,SAAS,SAAA,CACd,EAAA,EACA,EAAA,EACAA,YAAAA,EACA;AACA,EAAA,IAAI,EAAE,EAAA,YAAc,WAAA,CAAA;AAAc,IAAA;AAClC,EAAAA,aAAY,WAAA,EAAY;AACxB,EAAAA,YAAAA,CAAY,cAAc,EAAC;AAE3B,EAAA,MAAM,WAAA,GAAc,iBAAA;AAAA,IAClB,EAAA,CAAG,MAAA;AAAA,IACH,CAAC,OAAA,KAAY,CAAC,CAAC,OAAA,CAAQ,SAAS,EAAA,IAAM,CAAC,CAAC,OAAA,CAAQ,OAAA,EAAS;AAAA,GAC3D;AAEA,EAAA,EAAA,EAAI,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oB,OAAA,CAAQ,UAAA,IAAc,EAAE,CAAA;AAAA;AACpE,KACD,CAAA;AAED,IAAA,eAAA,CAAgB,OAAA,CAAQ,CAAC,UAAA,KAAe;AACtC,MAAA,MAAM,OAAA,GAAUA,aAAY,IAAA,EAAM,aAAA;AAAA,QAChC,qBAAqB,UAAU,CAAA,EAAA;AAAA,OACjC;AACA,MAAA,IAAI,OAAA,EAAS;AACX,QAAA,OAAA,CAAQ,YAAA,CAAa,SAAS,uCAAuC,CAAA;AAAA;AACvE,KACD,CAAA;AAED,IAAAA,aAAY,QAAA,EAAS;AAErB,IAAA,IAAI,WAAA,EAAa;AACf,MAAAA,YAAAA,CAAY,sBAAA,GACV,aAAA,EAAe,OAAA,CAAQ,UAAA,IAAc,EAAA;AACvC,MAAAA,YAAAA,CAAY,eAAA,GAAkB,WAAA,CAAY,OAAA,CAAQ,EAAA;AAClD,MAAAA,aAAY,aAAA,GAAgB,WAAA;AAAA;AAE9B,IAAA,IAAIA,YAAAA,CAAY,oBAAoB,EAAA,EAAI;AACtC,MAAA;AAAA;AAEF,IAAA,MAAM,QAAA,GAAW,WAAA,EAAa,SAAA,CAAU,IAAI,CAAA;AAC5C,IAAA,QAAA,CAAS,MAAM,OAAA,GAAU,CAAA,GAAA,CAAA;AACzB,IAAA,QAAA,CAAS,MAAM,KAAA,GAAQ,CAAA,IAAA,CAAA;AACvB,IAAA,QAAA,CAAS,MAAM,MAAA,GAAS,CAAA,IAAA,CAAA;AACxB,IAAA,QAAA,CAAS,MAAM,eAAA,GAAkB,CAAA,eAAA,CAAA;AACjC,IAAA,QAAA,CAAS,SAAA,GAAY,qBAAA;AACrB,IAAAA,aAAY,SAAA,GAAY,QAAA;AAAA,KACvB,CAAC,CAAA;AACN;;;;"}
|
|
@@ -0,0 +1,66 @@
|
|
|
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.filter(
|
|
38
|
+
(panel) => !(panel.dataset.id === childId && !panel.classList.contains(
|
|
39
|
+
"apia_panel_falseDiv"
|
|
40
|
+
))
|
|
41
|
+
).findIndex(
|
|
42
|
+
(panel) => panel.dataset.id === childId && panel.classList.contains(
|
|
43
|
+
"apia_panel_falseDiv"
|
|
44
|
+
)
|
|
45
|
+
);
|
|
46
|
+
if (typeof index === "number" && newSection.dataset.locationid) {
|
|
47
|
+
void updatePanelPosition(
|
|
48
|
+
childId,
|
|
49
|
+
newSection.dataset.locationid,
|
|
50
|
+
index + 1
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
falseDiv.replaceWith(child);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
DragAndDrop2.draggingPanelId = "";
|
|
59
|
+
DragAndDrop2.panelData = [];
|
|
60
|
+
DragAndDrop2.drawMinimap();
|
|
61
|
+
DragAndDrop2.removePlaceholder();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { Drop };
|
|
66
|
+
//# 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\r\n .filter(\r\n (panel) =>\r\n !(\r\n (panel as HTMLElement).dataset.id === childId &&\r\n !(panel as HTMLElement).classList.contains(\r\n 'apia_panel_falseDiv',\r\n )\r\n ),\r\n )\r\n .findIndex(\r\n (panel) =>\r\n (panel as HTMLElement).dataset.id === childId &&\r\n (panel as HTMLElement).classList.contains(\r\n 'apia_panel_falseDiv',\r\n ),\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":";;;AAKO,SAAS,IAAA,CAAK,OAAcA,YAAAA,EAA0B;AAC3D,EAAA,IAAIA,aAAY,IAAA,EAAM;AACpB,IAAA,MAAM,EAAA,GAAK,KAAA;AACX,IAAA,MAAM,IAAA,GAAO,EAAA,EAAI,YAAA,EAAc,OAAA,CAAQ,MAAM,CAAA;AAE7C,IAAA,MAAM,QAAA,GAAWA,YAAAA,CAAY,IAAA,EAAM,gBAAA,CAAiB,mBAAmB,CAAA;AAEvE,IAAA,QAAA,CAAS,OAAA,CAAQ,CAAC,GAAA,KAAQ;AACxB,MAAA,GAAA,CAAI,YAAA,CAAa,SAAS,EAAE,CAAA;AAAA,KAC7B,CAAA;AAED,IAAA,MAAM,aAAA,GAAgBA,aAAY,IAAA,CAAK,aAAA;AAAA,MACrC,CAAA,sBAAA,EAAyBA,aAAY,eAAe,CAAA,4BAAA;AAAA,KACtD;A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AAA,EAAY;AAC9D,cAAA,KAAK,mBAAA;AAAA,gBACH,OAAA;AAAA,gBACA,WAAW,OAAA,CAAQ,UAAA;AAAA,gBACnB,KAAA,GAAQ;AAAA,eACV;AAAA;AACF;AACF;AAEF,QAAA,QAAA,CAAS,YAAY,KAAa,CAAA;AAAA;AACpC;AAGF,IAAAA,aAAY,eAAA,GAAkB,EAAA;AAC9B,IAAAA,YAAAA,CAAY,YAAY,EAAC;AACzB,IAAAA,aAAY,WAAA,EAAY;AAExB,IAAAA,aAAY,iBAAA,EAAkB;AAAA;AAElC;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx } from '@apia/theme/jsx-runtime';
|
|
2
|
+
import { IconButton } from '@apia/components';
|
|
3
|
+
import { usePanelIdentity } from '../../../common/usePanelIdentity.js';
|
|
4
|
+
import { useDashboardContext } from '../../../dashboard/DashboardContext.js';
|
|
5
|
+
import { getLabel } from '@apia/util';
|
|
6
|
+
|
|
7
|
+
const CollapseButton = ({
|
|
8
|
+
icon,
|
|
9
|
+
title,
|
|
10
|
+
isCollapsed
|
|
11
|
+
}) => {
|
|
12
|
+
const { panelId } = usePanelIdentity();
|
|
13
|
+
const dashboard = useDashboardContext();
|
|
14
|
+
const panel = dashboard.getPanel(panelId);
|
|
15
|
+
const collapseLabel = isCollapsed ? getLabel("lblShowPanel", { text: { TOK1: title } }).text : getLabel("lblHidePanel", { text: { TOK1: title } }).text;
|
|
16
|
+
return /* @__PURE__ */ jsx(
|
|
17
|
+
IconButton,
|
|
18
|
+
{
|
|
19
|
+
size: "Md",
|
|
20
|
+
variant: "buttons.icon-outline",
|
|
21
|
+
className: "panel__iconButton panel__collapse",
|
|
22
|
+
icon,
|
|
23
|
+
onClick: () => panel.collapse(),
|
|
24
|
+
title: collapseLabel,
|
|
25
|
+
"aria-label": collapseLabel
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { CollapseButton };
|
|
31
|
+
//# sourceMappingURL=CollapseButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CollapseButton.js","sources":["../../../../src/splash/panels/DefaultPanelWrapper/CollapseButton.tsx"],"sourcesContent":["import { IconButton } from '@apia/components';\r\nimport { TIconName } from '@apia/icons';\r\nimport React from 'react';\r\nimport { usePanelIdentity } from '../../../common';\r\nimport { useDashboardContext } from '../../../dashboard';\r\nimport { getLabel } from '@apia/util';\r\n\r\nexport const CollapseButton = ({\r\n icon,\r\n title,\r\n isCollapsed,\r\n}: {\r\n icon: TIconName;\r\n title: string;\r\n isCollapsed: boolean;\r\n}) => {\r\n const { panelId } = usePanelIdentity();\r\n const dashboard = useDashboardContext();\r\n const panel = dashboard.getPanel(panelId);\r\n const collapseLabel = isCollapsed\r\n ? getLabel('lblShowPanel', { text: { TOK1: title } }).text\r\n : getLabel('lblHidePanel', { text: { TOK1: title } }).text;\r\n\r\n return (\r\n <IconButton\r\n size=\"Md\"\r\n variant=\"buttons.icon-outline\"\r\n className=\"panel__iconButton panel__collapse\"\r\n icon={icon}\r\n onClick={() => panel.collapse()}\r\n title={collapseLabel}\r\n aria-label={collapseLabel}\r\n />\r\n );\r\n};\r\n"],"names":[],"mappings":";;;;;;AAOO,MAAM,iBAAiB,CAAC;AAAA,EAC7B,IAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ,EAAA,MAAM,EAAE,OAAA,EAAQ,GAAI,gBAAA,EAAiB;AACrC,EAAA,MAAM,YAAY,mBAAA,EAAoB;AACtC,EAAA,MAAM,KAAA,GAAQ,SAAA,CAAU,QAAA,CAAS,OAAO,CAAA;AACxC,EAAA,MAAM,aAAA,GAAgB,cAClB,QAAA,CAAS,cAAA,EAAgB,EAAE,IAAA,EAAM,EAAE,IAAA,EAAM,KAAA,EAAM,EAAG,EAAE,IAAA,GACpD,QAAA,CAAS,gBAAgB,EAAE,IAAA,EAAM,EAAE,IAAA,EAAM,KAAA,EAAM,EAAG,CAAA,CAAE,IAAA;AAExD,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,IAAA,EAAK,IAAA;AAAA,MACL,OAAA,EAAQ,sBAAA;AAAA,MACR,SAAA,EAAU,mCAAA;AAAA,MACV,IAAA;AAAA,MACA,OAAA,EAAS,MAAM,KAAA,CAAM,QAAA,EAAS;AAAA,MAC9B,KAAA,EAAO,aAAA;AAAA,MACP,YAAA,EAAY;AAAA;AAAA,GACd;AAEJ;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkState.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -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
|