@griddo/ax 1.74.29 → 1.74.31

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@griddo/ax",
3
3
  "description": "Griddo Author Experience",
4
- "version": "1.74.29",
4
+ "version": "1.74.31",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Carlos Torres <carlos.torres@secuoyas.com>",
@@ -229,5 +229,5 @@
229
229
  "publishConfig": {
230
230
  "access": "public"
231
231
  },
232
- "gitHead": "99bb983ffd06c3728640e8373d5a8615d530d92e"
232
+ "gitHead": "96e2675183aa8af789eaa4550873f174787023e3"
233
233
  }
@@ -22,7 +22,7 @@ jest.mock("react", () => {
22
22
  const useMockRef = useRef as jest.MockedFunction<typeof useRef>;
23
23
 
24
24
  describe("ResizePanel component rendering", () => {
25
- it("should render the component with 2 panels", () => {
25
+ it("should render the component with fixed panel", () => {
26
26
  const defaultProps: IResizePanelProps = {
27
27
  leftPanel: <div>Left Panel</div>,
28
28
  rightPanel: <div>Right Panel</div>,
@@ -37,13 +37,15 @@ describe("ResizePanel component rendering", () => {
37
37
  </ThemeProvider>
38
38
  );
39
39
 
40
- const leftPanel = screen.getByTestId("left-panel-fixed");
40
+ const leftPanel = screen.getByTestId("left-panel");
41
41
  expect(leftPanel).toBeTruthy();
42
+ const fixedPanel = screen.getByTestId("fixed-panel");
43
+ expect(fixedPanel).toBeTruthy();
42
44
  const rightPanel = screen.getByTestId("right-panel");
43
45
  expect(rightPanel).toBeTruthy();
44
46
  });
45
47
 
46
- it("should render the component with 2 panels if left if not fixed", () => {
48
+ it("should render the component with without fixed panel", () => {
47
49
  const defaultProps: IResizePanelProps = {
48
50
  leftPanel: <div>Left Panel</div>,
49
51
  rightPanel: <div>Right Panel</div>,
@@ -61,50 +63,14 @@ describe("ResizePanel component rendering", () => {
61
63
 
62
64
  const leftPanel = screen.getByTestId("left-panel");
63
65
  expect(leftPanel).toBeTruthy();
66
+ const fixedPanel = screen.queryByTestId("fixed-panel");
67
+ expect(fixedPanel).toBeFalsy();
64
68
  const rightPanel = screen.getByTestId("right-panel");
65
69
  expect(rightPanel).toBeTruthy();
66
70
  });
67
71
  });
68
72
 
69
73
  describe("ResizePanel mouse events", () => {
70
- it("fixed panel changes position on scroll", () => {
71
- const defaultProps: IResizePanelProps = {
72
- leftPanel: <div>Left Panel</div>,
73
- rightPanel: <div>Right Panel</div>,
74
- fixed: true,
75
- };
76
-
77
- const scroll = 100;
78
-
79
- const rightPanelRef = { current: {} };
80
- Object.defineProperty(rightPanelRef, "current", {
81
- set(_current) {
82
- if (_current) {
83
- jest.spyOn(_current, "offsetWidth", "get").mockReturnValueOnce(350);
84
- }
85
- this._current = _current;
86
- },
87
- get() {
88
- return this._current;
89
- },
90
- });
91
- useMockRef.mockReturnValue(rightPanelRef);
92
-
93
- render(
94
- <ThemeProvider theme={parseTheme(globalTheme)}>
95
- <ResizePanel {...defaultProps} />
96
- </ThemeProvider>
97
- );
98
-
99
- const fixedPanel = screen.getByTestId("fixed-panel");
100
- expect(fixedPanel).toBeTruthy();
101
-
102
- fireEvent.scroll(window, { target: { scrollX: scroll } });
103
- const leftPosition = getComputedStyle(fixedPanel).left;
104
-
105
- expect(leftPosition).toBe(`calc(24px - ${scroll}px)`);
106
- });
107
-
108
74
  it("right panel should change width if handle moves past its width", () => {
109
75
  const defaultProps: IResizePanelProps = {
110
76
  leftPanel: <div>Left Panel</div>,
@@ -1,5 +1,7 @@
1
1
  import styled from "styled-components";
2
2
 
3
- const Wrapper = styled.div``;
3
+ const Wrapper = styled.div`
4
+ width: 100%;
5
+ `;
4
6
 
5
7
  export { Wrapper };
@@ -33,6 +33,7 @@ const ReferenceField = (props: IReferenceFieldProps) => {
33
33
  resetValidation,
34
34
  handleValidation,
35
35
  mandatory,
36
+ editorID,
36
37
  } = props;
37
38
 
38
39
  const { isOpen, toggleModal } = useModal();
@@ -102,7 +103,7 @@ const ReferenceField = (props: IReferenceFieldProps) => {
102
103
  isMounted = false;
103
104
  };
104
105
  // eslint-disable-next-line react-hooks/exhaustive-deps
105
- }, []);
106
+ }, [editorID]);
106
107
 
107
108
  const handleAddItems = () => {
108
109
  toggleModal();
@@ -230,6 +231,7 @@ export interface IReferenceFieldProps {
230
231
  resetValidation?: () => void;
231
232
  handleValidation?: (value: string, validators?: Record<string, unknown>) => void;
232
233
  mandatory: boolean;
234
+ editorID: number;
233
235
  }
234
236
 
235
237
  const mapStateToProps = (state: IRootState) => ({
@@ -3,8 +3,6 @@ import React from "react";
3
3
  import * as S from "./style";
4
4
 
5
5
  const ResizeHandle = (props: IResizeHandleProps): JSX.Element => {
6
- const { left } = props;
7
-
8
6
  const initListeners = () => {
9
7
  window.addEventListener("mousemove", handleResize, false);
10
8
  window.addEventListener("mouseup", handleMouseUp, false);
@@ -26,16 +24,11 @@ const ResizeHandle = (props: IResizeHandleProps): JSX.Element => {
26
24
  onMouseMove(newWidth);
27
25
  };
28
26
 
29
- return (
30
- <S.HandlerWrapper>
31
- <S.Handler onMouseDown={handleMouseDown} left={left ? left : 0} data-testid="handler" />
32
- </S.HandlerWrapper>
33
- );
27
+ return <S.Handler onMouseDown={handleMouseDown} data-testid="handler" />;
34
28
  };
35
29
 
36
30
  export interface IResizeHandleProps {
37
31
  onMouseMove: (value: number) => void;
38
- left?: number;
39
32
  }
40
33
 
41
34
  export default ResizeHandle;
@@ -1,22 +1,17 @@
1
1
  import styled from "styled-components";
2
2
 
3
- export const HandlerWrapper = styled.div`
4
- width: 4px;
5
- height: 100%;
6
- position: fixed;
7
- `;
8
-
9
- export const Handler = styled.div<{ left: number }>`
10
- position: absolute;
11
- top: calc(50% - 64px);
12
- left: -16px;
3
+ const Handler = styled.div`
4
+ position: sticky;
5
+ top: 50%;
13
6
  height: 64px;
14
7
  width: 4px;
15
- background-color: ${p => p.theme.color.interactiveDisabled};
8
+ background-color: ${(p) => p.theme.color.interactiveDisabled};
16
9
  cursor: ew-resize;
17
- transform: translate(-${p => p.left}px,-50%);
18
10
  z-index: 1;
11
+ transform: translateX(${(p) => `-${p.theme.spacing.s}`});
19
12
  &:hover {
20
- background-color: ${p => p.theme.color.interactive01};
13
+ background-color: ${(p) => p.theme.color.interactive01};
21
14
  }
22
15
  `;
16
+
17
+ export { Handler };
@@ -7,7 +7,6 @@ const ResizePanel = (props: IResizePanelProps): JSX.Element => {
7
7
  const { leftPanel, rightPanel, fixed = true } = props;
8
8
 
9
9
  const [rwidth, setRwidth] = useState(0);
10
- const [scroll, setScroll] = useState(0);
11
10
 
12
11
  const rightPanelRef = useRef<HTMLDivElement>(null);
13
12
 
@@ -15,12 +14,6 @@ const ResizePanel = (props: IResizePanelProps): JSX.Element => {
15
14
  if (rightPanelRef.current) {
16
15
  setRwidth(rightPanelRef.current.offsetWidth);
17
16
  }
18
-
19
- const handleScroll = () => {
20
- setScroll(window.scrollX);
21
- };
22
-
23
- window.addEventListener("scroll", handleScroll);
24
17
  }, [rightPanelRef]);
25
18
 
26
19
  const resize = (value: number) => {
@@ -31,17 +24,17 @@ const ResizePanel = (props: IResizePanelProps): JSX.Element => {
31
24
 
32
25
  return (
33
26
  <>
34
- {fixed ? (
35
- <S.LeftPanel data-testid="left-panel-fixed">
36
- <S.FixedPanel width={rwidth} left={scroll} data-testid="fixed-panel">
27
+ <S.LeftPanel data-testid="left-panel">
28
+ {fixed ? (
29
+ <S.FixedPanel width={rwidth} data-testid="fixed-panel">
37
30
  {leftPanel}
38
31
  </S.FixedPanel>
39
- </S.LeftPanel>
40
- ) : (
41
- <S.LeftPanel data-testid="left-panel">{leftPanel}</S.LeftPanel>
42
- )}
32
+ ) : (
33
+ leftPanel
34
+ )}
35
+ </S.LeftPanel>
43
36
  <S.RightPanel width={rwidth} ref={rightPanelRef} data-testid="right-panel">
44
- <ResizeHandle left={scroll} onMouseMove={resize} />
37
+ <ResizeHandle onMouseMove={resize} />
45
38
  {rightPanel}
46
39
  </S.RightPanel>
47
40
  </>
@@ -1,16 +1,19 @@
1
1
  import styled from "styled-components";
2
2
 
3
3
  const getWidth = (width: number, space: string) => {
4
- const minWidth = 1280 - width - (parseInt(space) * 2);
4
+ const minWidth = 1280 - width - parseInt(space) * 2;
5
5
  return minWidth < 500 ? `500px` : `${minWidth}px`;
6
6
  };
7
7
 
8
8
  export const LeftPanel = styled.section`
9
+ position: relative;
9
10
  flex-grow: 1;
10
11
  min-width: 500px;
11
12
  `;
12
13
 
13
14
  export const RightPanel = styled.section<{ width: number }>`
15
+ display: flex;
16
+ position: relative;
14
17
  padding: ${(p) => p.theme.spacing.m};
15
18
  flex-shrink: 0;
16
19
  width: ${(p) => p.width}px;
@@ -18,12 +21,13 @@ export const RightPanel = styled.section<{ width: number }>`
18
21
  max-width: ${(p) => `calc(100% - 500px - ${p.theme.spacing.m})`};
19
22
  `;
20
23
 
21
- export const FixedPanel = styled.div<{ width: number; left: number }>`
22
- position: fixed;
24
+ export const FixedPanel = styled.div<{ width: number }>`
25
+ position: sticky;
23
26
  top: calc(${(p) => p.theme.spacing.xl} + ${(p) => p.theme.spacing.m});
24
- left: ${(p) => `calc(${p.theme.spacing.m} - ${p.left}px)`};
25
- height: calc(100vh - (${(p) => p.theme.spacing.xl} + (${(p) => p.theme.spacing.m} * 2)) - (${(p) => p.theme.spacing.m} + (${(p) => p.theme.spacing.xs} * 2)));
26
- min-width: ${(p) => getWidth(p.width,p.theme.spacing.m)};
27
- max-width: calc(100% - (${(p) => p.theme.spacing.xl} * 5) - (${(p) => p.theme.spacing.m} * 2));
28
- width: calc(100% - ${(p) => p.width}px - ${(p) => p.theme.spacing.m});
27
+ height: calc(
28
+ 100vh - (${(p) => p.theme.spacing.xl} + (${(p) => p.theme.spacing.m} * 2)) -
29
+ (${(p) => p.theme.spacing.m} + (${(p) => p.theme.spacing.xs} * 2))
30
+ );
31
+ min-width: ${(p) => getWidth(p.width, p.theme.spacing.m)};
32
+ margin-left: ${(p) => p.theme.spacing.m};
29
33
  `;
@@ -13,6 +13,7 @@ const SearchField = (props: ISearchFieldProps): JSX.Element => {
13
13
  disabled = false,
14
14
  searchFilters,
15
15
  onFilterChange,
16
+ small,
16
17
  } = props;
17
18
 
18
19
  const [isOpen, setIsOpen] = useState(false);
@@ -91,6 +92,7 @@ const SearchField = (props: ISearchFieldProps): JSX.Element => {
91
92
  closeOnInactive={closeOnInactive}
92
93
  disabled={disabled}
93
94
  data-testid="search-input"
95
+ small={small}
94
96
  />
95
97
  {inputValue.trim() !== "" && searchOnEnter && <S.HelpText>Press ENTER</S.HelpText>}
96
98
  {closeOnInactive || inputValue.length > 0 ? (
@@ -120,6 +122,7 @@ export interface ISearchFieldProps {
120
122
  disabled?: boolean;
121
123
  searchFilters?: any;
122
124
  onFilterChange?(filter: string): void;
125
+ small?: boolean;
123
126
  }
124
127
 
125
128
  export default SearchField;
@@ -19,7 +19,7 @@ const FieldWrapper = styled.div<{ closeOnInactive: boolean; disabled: boolean }>
19
19
  border-radius: ${(p) => (p.closeOnInactive ? 0 : p.theme.radii.s)};
20
20
  `;
21
21
 
22
- const Input = styled.input<{ closeOnInactive: boolean; disabled: boolean }>`
22
+ const Input = styled.input<{ closeOnInactive: boolean; disabled: boolean; small?: boolean }>`
23
23
  ${(p) => p.theme.textStyle.fieldContent};
24
24
  color: ${(p) => p.theme.color.textHighEmphasis};
25
25
  background-color: ${(p) => p.theme.color.interactiveBackground};
@@ -27,6 +27,7 @@ const Input = styled.input<{ closeOnInactive: boolean; disabled: boolean }>`
27
27
  height: ${(p) => p.theme.spacing.l};
28
28
  padding-left: ${(p) => p.theme.spacing.xs};
29
29
  border: none;
30
+ width: ${(p) => (p.small ? `calc(${p.theme.spacing.xl} * 2)` : `calc(${p.theme.spacing.xl} * 4)`)};
30
31
 
31
32
  &:active,
32
33
  &:focus {
@@ -149,7 +149,7 @@ const SideModal = (props: ISideModalProps): JSX.Element | null => {
149
149
  <S.Title data-testid="side-modal-title">{optionsType}</S.Title>
150
150
  {showSearch && optionsType !== "components" && (
151
151
  <S.SearchWrapper>
152
- <SearchField onChange={setSearchQuery} closeOnInactive />
152
+ <SearchField onChange={setSearchQuery} closeOnInactive small={!filters} />
153
153
  </S.SearchWrapper>
154
154
  )}
155
155
  {!showSearch && (
@@ -40,11 +40,10 @@ const ColumnsWrapper = styled.div`
40
40
  const Content = styled.div`
41
41
  list-style: none;
42
42
  padding: ${(p) => p.theme.spacing.m};
43
+ height: ${(p) => `calc(100vh - ${p.theme.spacing.xl})`};
43
44
  width: ${(p) => `calc(${p.theme.spacing.xl} * 3)`};
44
45
  overflow: auto;
45
46
  border-right: 1px solid ${(p) => p.theme.colors.uiLine};
46
- height: 100vh;
47
- max-height: ${(p) => `calc(100vh - ${p.theme.spacing.xl})`};
48
47
  &:last-child {
49
48
  border-right: 0;
50
49
  width: ${(p) => `calc(${p.theme.spacing.xl} * 4)`};
@@ -63,9 +62,7 @@ const FeaturedWrapper = styled.div`
63
62
  margin-bottom: ${(p) => p.theme.spacing.xs};
64
63
  `;
65
64
 
66
- const SearchWrapper = styled.div`
67
- width: ${(p) => `calc(${p.theme.spacing.xl} * 4)`};
68
- `;
65
+ const SearchWrapper = styled.div``;
69
66
 
70
67
  const Link = styled.div<{ active: boolean }>`
71
68
  color: ${(p) => (p.active ? p.theme.color.textHighEmphasis : p.theme.color.textMediumEmphasis)};
@@ -723,6 +723,7 @@ function resetDefaultsValues(): (dispatch: Dispatch) => Promise<void> {
723
723
  dispatch(setFooter(null));
724
724
  dispatch(setCurrentNavigationLanguages([]));
725
725
  dispatch(setIsNewTranslation(false));
726
+ dispatch(setCurrentDefaultsContent([]));
726
727
  } catch (e) {
727
728
  console.log("Error", e); //TODO
728
729
  }
@@ -442,44 +442,46 @@ const GlobalEditor = (props: IProps) => {
442
442
  pageStatusActions={pageStatusActions}
443
443
  tabs={tabsPreview}
444
444
  >
445
- {isLivePageChanged && (
446
- <S.NotificationWrapper>
447
- <Notification type="warning" text={modifiedNotificationText} />
448
- </S.NotificationWrapper>
449
- )}
450
- {sitePageID && (
451
- <S.NotificationWrapper>
452
- <Notification
453
- type="info"
454
- text={globalNotificationText}
455
- btnText="Go Back"
456
- onClick={handleClickNotification}
457
- />
458
- </S.NotificationWrapper>
459
- )}
460
- {notification && (
461
- <S.NotificationWrapper>
462
- <Notification
463
- type={notification.type}
464
- text={notification.text}
465
- btnText={notification.btnText}
466
- onClick={notification.onClick}
467
- resetError={() => setNotification(null)}
468
- />
469
- </S.NotificationWrapper>
470
- )}
471
- <ErrorToast size="l" />
472
445
  {selectedTab === "edit" ? (
473
- <S.Content>
474
- <Editor
475
- isGlobal={true}
476
- isEditable={isEditable}
477
- isReadOnly={isReadOnly}
478
- theme={theme}
479
- browserRef={browserRef}
480
- setNotification={setNotification}
481
- />
482
- </S.Content>
446
+ <>
447
+ {isLivePageChanged && (
448
+ <S.NotificationWrapper>
449
+ <Notification type="warning" text={modifiedNotificationText} />
450
+ </S.NotificationWrapper>
451
+ )}
452
+ {sitePageID && (
453
+ <S.NotificationWrapper>
454
+ <Notification
455
+ type="info"
456
+ text={globalNotificationText}
457
+ btnText="Go Back"
458
+ onClick={handleClickNotification}
459
+ />
460
+ </S.NotificationWrapper>
461
+ )}
462
+ {notification && (
463
+ <S.NotificationWrapper>
464
+ <Notification
465
+ type={notification.type}
466
+ text={notification.text}
467
+ btnText={notification.btnText}
468
+ onClick={notification.onClick}
469
+ resetError={() => setNotification(null)}
470
+ />
471
+ </S.NotificationWrapper>
472
+ )}
473
+ <ErrorToast size="l" />
474
+ <S.Content>
475
+ <Editor
476
+ isGlobal={true}
477
+ isEditable={isEditable}
478
+ isReadOnly={isReadOnly}
479
+ theme={theme}
480
+ browserRef={browserRef}
481
+ setNotification={setNotification}
482
+ />
483
+ </S.Content>
484
+ </>
483
485
  ) : (
484
486
  <Preview theme={theme} />
485
487
  )}
@@ -496,45 +496,47 @@ const PageEditor = (props: IProps) => {
496
496
  isFromEditor={true}
497
497
  tabs={tabsPreview}
498
498
  >
499
- {(!isTemplateActivated || hasDeactivatedModules) && !isGlobal && (
500
- <S.NotificationWrapper>
501
- <Notification
502
- type="error"
503
- text={packNotificationText}
504
- btnText="Activate package"
505
- onClick={handleClickNotification}
506
- />
507
- </S.NotificationWrapper>
508
- )}
509
- {isLivePageChanged && (
510
- <S.NotificationWrapper>
511
- <Notification type="warning" text={modifiedNotificationText} />
512
- </S.NotificationWrapper>
513
- )}
514
- {notification && (
515
- <S.NotificationWrapper>
516
- <Notification
517
- type={notification.type}
518
- text={notification.text}
519
- btnText={notification.btnText}
520
- onClick={notification.onClick}
521
- resetError={() => setNotification(null)}
522
- />
523
- </S.NotificationWrapper>
524
- )}
525
- <ErrorToast size="l" />
526
499
  {selectedTab === "edit" ? (
527
- <S.Content>
528
- <Editor
529
- isTemplateActivated={isTemplateActivated}
530
- isGlobal={isGlobal}
531
- isEditable={isEditable}
532
- pageTitle={pageName}
533
- isReadOnly={isReadOnly}
534
- browserRef={browserRef}
535
- setNotification={setNotification}
536
- />
537
- </S.Content>
500
+ <>
501
+ {(!isTemplateActivated || hasDeactivatedModules) && !isGlobal && (
502
+ <S.NotificationWrapper>
503
+ <Notification
504
+ type="error"
505
+ text={packNotificationText}
506
+ btnText="Activate package"
507
+ onClick={handleClickNotification}
508
+ />
509
+ </S.NotificationWrapper>
510
+ )}
511
+ {isLivePageChanged && (
512
+ <S.NotificationWrapper>
513
+ <Notification type="warning" text={modifiedNotificationText} />
514
+ </S.NotificationWrapper>
515
+ )}
516
+ {notification && (
517
+ <S.NotificationWrapper>
518
+ <Notification
519
+ type={notification.type}
520
+ text={notification.text}
521
+ btnText={notification.btnText}
522
+ onClick={notification.onClick}
523
+ resetError={() => setNotification(null)}
524
+ />
525
+ </S.NotificationWrapper>
526
+ )}
527
+ <ErrorToast size="l" />
528
+ <S.Content>
529
+ <Editor
530
+ isTemplateActivated={isTemplateActivated}
531
+ isGlobal={isGlobal}
532
+ isEditable={isEditable}
533
+ pageTitle={pageName}
534
+ isReadOnly={isReadOnly}
535
+ browserRef={browserRef}
536
+ setNotification={setNotification}
537
+ />
538
+ </S.Content>
539
+ </>
538
540
  ) : (
539
541
  <Preview />
540
542
  )}