@m4l/components 9.1.100 → 9.1.101

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.
@@ -0,0 +1,33 @@
1
+ import { NewWindowProps } from '../../../types';
2
+ export declare const moduleIdsTest: {
3
+ users: {
4
+ moduleId: string;
5
+ title: string;
6
+ };
7
+ roles: {
8
+ moduleId: string;
9
+ title: string;
10
+ };
11
+ calibrations: {
12
+ moduleId: string;
13
+ title: string;
14
+ };
15
+ sensors: {
16
+ moduleId: string;
17
+ title: string;
18
+ };
19
+ };
20
+ interface WindowForAreaTest {
21
+ title: string;
22
+ moduleId: string;
23
+ }
24
+ /**
25
+ * *****************************************************************************************
26
+ * Función que retorna un objeto con la estructura de una ventana para el área de trabajo.
27
+ * @param title Título de la ventana.
28
+ * @param iconUrl Url de la imagen del ícono de la ventana.
29
+ * @param moduleId Identificador del módulo.
30
+ * *****************************************************************************************
31
+ */
32
+ export declare const getWindowForAreaTest: ({ title, moduleId }: WindowForAreaTest) => NewWindowProps;
33
+ export {};
@@ -10,6 +10,7 @@ export declare const COOKIE_AREAS_ADMIN_CONTAINER_ID = "areas";
10
10
  export declare const COOKIE_AREAS_ADMIN_ID = "admin";
11
11
  export declare const COOKIE_BREAKPOINT_LAYOUTS = "layoutPros";
12
12
  export declare const COOKIE_WINDOWS = "windows";
13
+ export declare const COOKIE_WINDOW_SELECTED = "windowSelected";
13
14
  export declare const BREAKPOINT_SIZES: {
14
15
  lg: number;
15
16
  md: number;
@@ -10,6 +10,7 @@ const COOKIE_AREAS_ADMIN_CONTAINER_ID = "areas";
10
10
  const COOKIE_AREAS_ADMIN_ID = "admin";
11
11
  const COOKIE_BREAKPOINT_LAYOUTS = "layoutPros";
12
12
  const COOKIE_WINDOWS = "windows";
13
+ const COOKIE_WINDOW_SELECTED = "windowSelected";
13
14
  const BREAKPOINT_SIZES = { lg: 1200, md: 996, sm: 768, xs: 480, xxs: 1 };
14
15
  const NORMALIZED_COLS = { lg: 64, md: 48, sm: 32, xs: 24, xxs: 1 };
15
16
  const DEFAULT_LAYOUTS = { lg: [], md: [], sm: [], xs: [], xxs: [] };
@@ -207,14 +208,16 @@ export {
207
208
  RESPONSIVE_ROW_HEIGHTS as a,
208
209
  COOKIE_AREAS_ADMIN_ID as b,
209
210
  addArea as c,
210
- DEFAULT_WINDOW as d,
211
- deleteLayoutFromBreakPoints as e,
212
- COOKIE_WINDOWS as f,
211
+ COOKIE_WINDOW_SELECTED as d,
212
+ DEFAULT_WINDOW as e,
213
+ deleteLayoutFromBreakPoints as f,
213
214
  getSelectedAreaIdFromCookies as g,
214
- COOKIE_BREAKPOINT_LAYOUTS as h,
215
- DEBOUCED_SAVE_TIME as i,
216
- getDataFromResponse as j,
217
- getCookiesContainer as k,
215
+ COOKIE_WINDOWS as h,
216
+ COOKIE_BREAKPOINT_LAYOUTS as i,
217
+ DEBOUCED_SAVE_TIME as j,
218
+ getDataFromResponse as k,
219
+ getParmsFromValue as l,
220
+ getCookiesContainer as m,
218
221
  setColapsedLayoutBreakPoints as s,
219
222
  updateOwnerStateClasses as u
220
223
  };
@@ -3,12 +3,12 @@ import { devtools } from "zustand/middleware";
3
3
  import { immer } from "zustand/middleware/immer";
4
4
  import { u as useAreasViewerUtilityClasses } from "../../components/AreasViewer/classes/index.js";
5
5
  import { u as useAreasAdminUtilityClasses } from "../../components/AreasAdmin/classes/index.js";
6
- import { u as updateOwnerStateClasses, C as COOKIE_AREAS_ADMIN_CONTAINER_ID, b as COOKIE_AREAS_ADMIN_ID, D as DEFAULT_AREA, c as addArea, g as getSelectedAreaIdFromCookies, d as DEFAULT_WINDOW, a as RESPONSIVE_ROW_HEIGHTS, P as PADDING_GRIDLAYOUT, M as MARGIN_GRIDLAYOUT, N as NORMALIZED_COLS, e as deleteLayoutFromBreakPoints, f as COOKIE_WINDOWS, h as COOKIE_BREAKPOINT_LAYOUTS, i as DEBOUCED_SAVE_TIME, s as setColapsedLayoutBreakPoints, j as getDataFromResponse, k as getCookiesContainer } from "./helpers/helper.js";
6
+ import { u as updateOwnerStateClasses, C as COOKIE_AREAS_ADMIN_CONTAINER_ID, b as COOKIE_AREAS_ADMIN_ID, D as DEFAULT_AREA, c as addArea, g as getSelectedAreaIdFromCookies, d as COOKIE_WINDOW_SELECTED, e as DEFAULT_WINDOW, a as RESPONSIVE_ROW_HEIGHTS, P as PADDING_GRIDLAYOUT, M as MARGIN_GRIDLAYOUT, N as NORMALIZED_COLS, f as deleteLayoutFromBreakPoints, h as COOKIE_WINDOWS, i as COOKIE_BREAKPOINT_LAYOUTS, j as DEBOUCED_SAVE_TIME, s as setColapsedLayoutBreakPoints, k as getDataFromResponse, l as getParmsFromValue, m as getCookiesContainer } from "./helpers/helper.js";
7
7
  import { c as createDynamicMFStore } from "../DynamicMFParmsContext/store.js";
8
8
  import cloneDeep from "lodash-es/cloneDeep";
9
9
  import debounce from "lodash-es/debounce";
10
10
  import { g as generateModuleCount } from "./helpers/generateModuleCount.js";
11
- import { g as getCookie, s as setCookie, d as deleteCookie } from "../../../../helpers/cookies/cookies.js";
11
+ import { g as getCookie, d as deleteCookie, s as setCookie } from "../../../../helpers/cookies/cookies.js";
12
12
  import { d as addLayoutItemToBreakPoints, e as cloneLayouts } from "../../../GridLayout/subcomponents/Responsive/responsiveUtils.js";
13
13
  import { k as isEqualLayouts } from "../../../GridLayout/utils.js";
14
14
  const createAreasStore = (initProps) => {
@@ -177,6 +177,12 @@ const createAreasStore = (initProps) => {
177
177
  toastError: false
178
178
  });
179
179
  }
180
+ if (state.loadCookiesFromNetwork) {
181
+ deleteCookie({
182
+ networkOperation: get().networkOperation,
183
+ data: { f: [{ n: "container_id", o: "c", o1: areaId }] }
184
+ });
185
+ }
180
186
  });
181
187
  if (selectNewAreaId) {
182
188
  get().areasActions.selectArea(selectNewAreaId);
@@ -207,7 +213,6 @@ const createAreasStore = (initProps) => {
207
213
  });
208
214
  }
209
215
  }
210
- if (get().hashAreas[areaId].maximizedId !== void 0) ;
211
216
  setCookie({
212
217
  networkOperation: get().networkOperation,
213
218
  endPoint: `${COOKIE_AREAS_ADMIN_CONTAINER_ID}/${COOKIE_AREAS_ADMIN_ID}`,
@@ -255,6 +260,11 @@ const createAreasStore = (initProps) => {
255
260
  } else if (newWindowProps.emergeType === "modal") {
256
261
  get().areaActions.addWindowModal(get().currentAreaId, windowId, newWindowProps);
257
262
  }
263
+ setCookie({
264
+ networkOperation: get().networkOperation,
265
+ endPoint: `${get().currentAreaId}/${COOKIE_WINDOW_SELECTED}`,
266
+ value: { currentLayoutId: windowId }
267
+ });
258
268
  },
259
269
  /**
260
270
  * addLayout store
@@ -364,6 +374,12 @@ const createAreasStore = (initProps) => {
364
374
  get().areaActions.closeLayout(areaId, layoutItem.windowId);
365
375
  }
366
376
  }
377
+ if (get().hashAreas[areaId].currentLayoutId === removeLayoutId) {
378
+ deleteCookie({
379
+ networkOperation: get().networkOperation,
380
+ data: { f: [{ n: "id", o: "e", o1: COOKIE_WINDOW_SELECTED }] }
381
+ });
382
+ }
367
383
  },
368
384
  /**
369
385
  * saveLayouts
@@ -553,6 +569,11 @@ const createAreasStore = (initProps) => {
553
569
  state.currentModuleId = "";
554
570
  }
555
571
  }
572
+ setCookie({
573
+ networkOperation: get().networkOperation,
574
+ endPoint: `${area.id}/${COOKIE_WINDOW_SELECTED}`,
575
+ value: { currentLayoutId: layoutId }
576
+ });
556
577
  });
557
578
  },
558
579
  /**
@@ -659,10 +680,11 @@ const createAreasStore = (initProps) => {
659
680
  if (!area2) {
660
681
  return;
661
682
  }
683
+ const dataResponse = response.data;
662
684
  set((state) => {
663
685
  const area3 = state.hashAreas[areaId];
664
686
  const { newBreakPointsLayouts, newHashLayoutItems } = getDataFromResponse(
665
- response.data,
687
+ dataResponse,
666
688
  state,
667
689
  areaId
668
690
  );
@@ -670,6 +692,10 @@ const createAreasStore = (initProps) => {
670
692
  area3.layoutItemsIds = newHashLayoutItems;
671
693
  area3.status = "loaded";
672
694
  });
695
+ const layoutSelected = getParmsFromValue(COOKIE_WINDOW_SELECTED, dataResponse);
696
+ if (layoutSelected) {
697
+ get().areaActions.selectLayout(areaId, layoutSelected.currentLayoutId);
698
+ }
673
699
  }).catch((_response) => {
674
700
  set((state) => {
675
701
  state.hashAreas[areaId].status = "loaded";
@@ -11,6 +11,7 @@ export declare const endPoints: {
11
11
  cookies: string;
12
12
  cookies_admin: string;
13
13
  };
14
+ export declare const windowSelected = "windowSelected";
14
15
  /**
15
16
  * Función para ser usada como una implementación de mock
16
17
  * de la función networkOperation del hook useNetwork.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.1.100",
3
+ "version": "9.1.101",
4
4
  "license": "UNLICENSED",
5
5
  "lint-staged": {
6
6
  "*.{js,ts,tsx}": "eslint --fix --max-warnings 0"