@griddo/ax 11.4.25-rc.2 → 11.5.1-rc.0

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": "11.4.25-rc.2",
4
+ "version": "11.5.1-rc.0",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Diego M. Béjar <diego.bejar@secuoyas.com>",
@@ -224,5 +224,5 @@
224
224
  "publishConfig": {
225
225
  "access": "public"
226
226
  },
227
- "gitHead": "3aff84e04046c963e37fb947c60f99a593b38027"
227
+ "gitHead": "1e296bcff6948ff5fa145ad0a2fc0529f9c5ad58"
228
228
  }
@@ -2,12 +2,25 @@ import React, { memo } from "react";
2
2
 
3
3
  import { FieldsBehavior } from "@ax/components";
4
4
  import { ILinkField, IUrlField } from "@ax/types";
5
+ import { getNullValue } from "@ax/helpers";
5
6
 
6
7
  const LinkField = (props: ILinkFieldProps): JSX.Element => {
7
8
  const { value, onChange, disabled, whiteList, goTo, theme, actions, selectedContent, objKey } = props;
8
9
 
9
10
  const handleTextChange = (newValue: string) => onChange({ ...value, text: newValue });
10
- const handleLinkTypeChange = (newValue: string) => onChange({ ...value, linkType: newValue });
11
+ const handleLinkTypeChange = (newValue: string) => {
12
+ let newObjValue: ILinkField = { ...value, linkType: newValue };
13
+
14
+ if (newValue === "url") {
15
+ newObjValue = { ...newObjValue, modal: getNullValue(newObjValue.modal, true) };
16
+ }
17
+
18
+ if (newValue === "modal") {
19
+ newObjValue = { ...newObjValue, url: null };
20
+ }
21
+
22
+ onChange(newObjValue);
23
+ };
11
24
  const handleUrlChange = (newValue: IUrlField) => onChange({ ...value, url: newValue });
12
25
  const handleModalChange = (newValue: any) => onChange({ ...value, modal: newValue });
13
26
 
@@ -79,20 +79,20 @@ const FileGallery = (props: IProps): JSX.Element => {
79
79
  const allowedToAddSiteFile = usePermission("mediaGallery.addFiles");
80
80
  const allowedToAddGlobalFile = usePermission("global.mediaGallery.addGlobalFiles");
81
81
  const allowedToAddGlobalFileFromSite = usePermission("mediaGallery.addGlobalFilesFromSite");
82
- const allowedToAddFile = isTabGlobal
83
- ? allowedToAddGlobalFileFromSite
84
- : isSiteView
85
- ? allowedToAddSiteFile
86
- : allowedToAddGlobalFile;
82
+ const allowedToAddFile = !isSiteView
83
+ ? allowedToAddGlobalFile
84
+ : isTabGlobal
85
+ ? allowedToAddGlobalFileFromSite
86
+ : allowedToAddSiteFile;
87
87
 
88
88
  const allowedToEditSiteFile = usePermission("mediaGallery.editFilesss");
89
89
  const allowedToEditGlobalFile = usePermission("global.mediaGallery.editGlobalFiles");
90
90
  const allowedToEditGlobalFileFromSite = usePermission("mediaGallery.editGlobalFilesInSite");
91
- const allowedToEditFile = isTabGlobal
92
- ? allowedToEditGlobalFileFromSite
93
- : isSiteView
94
- ? allowedToEditSiteFile
95
- : allowedToEditGlobalFile;
91
+ const allowedToEditFile = !isSiteView
92
+ ? allowedToEditGlobalFile
93
+ : isTabGlobal
94
+ ? allowedToEditGlobalFileFromSite
95
+ : allowedToEditSiteFile;
96
96
 
97
97
  const tabs: string[] = [];
98
98
  if (isSiteView && allowedToAccessGlobalFromSite) {
@@ -193,6 +193,13 @@ const FileGallery = (props: IProps): JSX.Element => {
193
193
  message: "No documents found in this folder.",
194
194
  };
195
195
 
196
+ const filters = (
197
+ <>
198
+ <Type filterItems={filterItems} value={filterValues["filterType"]} />
199
+ <SortBy sortItems={sortItems} sortedState={sortedListStatus} />
200
+ </>
201
+ );
202
+
196
203
  return (
197
204
  <S.Wrapper data-testid="file-gallery-wrapper">
198
205
  <S.FolderPanel isOpen={isPanelOpen} ref={ref}>
@@ -209,13 +216,11 @@ const FileGallery = (props: IProps): JSX.Element => {
209
216
  <Tabs tabs={tabs} active={selectedTab} setSelectedTab={handleSelectedTab} noMargins />
210
217
  </S.TabsWrapper>
211
218
  )}
212
- <S.Filters>
213
- <Type filterItems={filterItems} value={filterValues["filterType"]} />
214
- <SortBy sortItems={sortItems} sortedState={sortedListStatus} />
215
- </S.Filters>
219
+ <S.Filters>{filters}</S.Filters>
216
220
  </S.Header>
217
221
  )}
218
222
  <S.Search>
223
+ {!isSiteView && <S.FiltersGlobal>{filters}</S.FiltersGlobal>}
219
224
  <SearchField
220
225
  onChange={setSearchQuery}
221
226
  value={searchQuery}
@@ -45,6 +45,7 @@ const Header = styled.div`
45
45
  `;
46
46
 
47
47
  const Search = styled.div`
48
+ display: flex;
48
49
  padding: ${(p) => p.theme.spacing.s} ${(p) => p.theme.spacing.m};
49
50
  border-right: 1px solid ${(p) => p.theme.color.uiLine};
50
51
  background-color: ${(p) => p.theme.color.uiBackground02};
@@ -62,15 +63,27 @@ const Filters = styled.div`
62
63
  }
63
64
  `;
64
65
 
66
+ const FiltersGlobal = styled.div`
67
+ display: flex;
68
+ align-items: center;
69
+ margin-right: ${(p) => p.theme.spacing.l};
70
+ & > * {
71
+ margin-right: ${(p) => p.theme.spacing.xs};
72
+ }
73
+ `;
74
+
65
75
  const TabsWrapper = styled.div`
66
76
  width: ${(p) => `calc(${p.theme.spacing.xl} * 3)`};
67
77
  `;
68
78
 
69
79
  const GalleryWrapper = styled.div`
80
+ display: flex;
81
+ flex-direction: column;
70
82
  position: relative;
71
83
  background-color: ${(p) => p.theme.color.uiBackground01};
72
84
  overflow: auto;
73
85
  padding: ${(p) => `0 ${p.theme.spacing.m} ${p.theme.spacing.m} ${p.theme.spacing.m}`};
86
+ height: 100%;
74
87
  `;
75
88
 
76
89
  const Grid = styled.div`
@@ -167,11 +180,11 @@ const ResizeHandle = styled.div`
167
180
  `;
168
181
 
169
182
  const SearchTags = styled.div`
170
- & > div:nth-child(1){
171
- margin-top: ${p => p.theme.spacing.m};
183
+ & > div:nth-child(1) {
184
+ margin-top: ${(p) => p.theme.spacing.m};
172
185
  }
173
- & > div:nth-child(2){
174
- margin-top: ${p => p.theme.spacing.xs};
186
+ & > div:nth-child(2) {
187
+ margin-top: ${(p) => p.theme.spacing.xs};
175
188
  }
176
189
  `;
177
190
 
@@ -197,4 +210,5 @@ export {
197
210
  FoldersIconWrapper,
198
211
  ResizeHandle,
199
212
  SearchTags,
213
+ FiltersGlobal,
200
214
  };
@@ -87,20 +87,21 @@ const Gallery = (props: IProps): JSX.Element => {
87
87
  const allowedToAddSiteFile = usePermission("mediaGallery.addImages");
88
88
  const allowedToAddGlobalFile = usePermission("global.mediaGallery.addGlobalImages");
89
89
  const allowedToAddGlobalFileFromSite = false;
90
- const allowedToAddFile = isTabGlobal
91
- ? allowedToAddGlobalFileFromSite
92
- : isSiteView
93
- ? allowedToAddSiteFile
94
- : allowedToAddGlobalFile;
90
+ const allowedToAddFile = !isSiteView
91
+ ? allowedToAddGlobalFile
92
+ : isTabGlobal
93
+ ? allowedToAddGlobalFileFromSite
94
+ : allowedToAddSiteFile;
95
95
 
96
96
  const allowedToEditSiteFile = usePermission("mediaGallery.editImages");
97
97
  const allowedToEditGlobalFile = usePermission("global.mediaGallery.editGlobalImages");
98
98
  const allowedToEditGlobalFileFromSite = false;
99
- const allowedToEditFile = isTabGlobal
100
- ? allowedToEditGlobalFileFromSite
101
- : isSiteView
102
- ? allowedToEditSiteFile
103
- : allowedToEditGlobalFile;
99
+
100
+ const allowedToEditFile = !isSiteView
101
+ ? allowedToEditGlobalFile
102
+ : isTabGlobal
103
+ ? allowedToEditGlobalFileFromSite
104
+ : allowedToEditSiteFile;
104
105
 
105
106
  const tabs: string[] = [];
106
107
  if (isSiteView && allowedToAccessGlobalFromSite) {
@@ -212,6 +213,14 @@ const Gallery = (props: IProps): JSX.Element => {
212
213
  message: "No images found in this folder.",
213
214
  };
214
215
 
216
+ const filters = (
217
+ <>
218
+ <Orientation filterItems={filterItems} />
219
+ <Type filterItems={filterItems} />
220
+ <SortBy sortItems={sortItems} sortedState={sortedListStatus} />
221
+ </>
222
+ );
223
+
215
224
  return (
216
225
  <S.Wrapper data-testid="image-gallery-wrapper">
217
226
  <S.FolderPanel isOpen={isPanelOpen} ref={ref}>
@@ -228,14 +237,11 @@ const Gallery = (props: IProps): JSX.Element => {
228
237
  <Tabs tabs={tabs} active={selectedTab} setSelectedTab={handleSelectedTab} noMargins />
229
238
  </S.TabsWrapper>
230
239
  )}
231
- <S.Filters>
232
- <Orientation filterItems={filterItems} />
233
- <Type filterItems={filterItems} />
234
- <SortBy sortItems={sortItems} sortedState={sortedListStatus} />
235
- </S.Filters>
240
+ <S.Filters>{filters}</S.Filters>
236
241
  </S.Header>
237
242
  )}
238
243
  <S.Search>
244
+ {!isSiteView && <S.FiltersGlobal>{filters}</S.FiltersGlobal>}
239
245
  <SearchField
240
246
  onChange={setSearchQuery}
241
247
  value={searchQuery}
@@ -45,6 +45,7 @@ const Header = styled.div`
45
45
  `;
46
46
 
47
47
  const Search = styled.div`
48
+ display: flex;
48
49
  padding: ${(p) => p.theme.spacing.s} ${(p) => p.theme.spacing.m};
49
50
  border-right: 1px solid ${(p) => p.theme.color.uiLine};
50
51
  background-color: ${(p) => p.theme.color.uiBackground02};
@@ -62,6 +63,16 @@ const Filters = styled.div`
62
63
  }
63
64
  `;
64
65
 
66
+ const FiltersGlobal = styled.div`
67
+ display: flex;
68
+ align-items: center;
69
+ margin-right: ${(p) => p.theme.spacing.l};
70
+ margin-left: ${(p) => `-${p.theme.spacing.s}`};
71
+ & > * {
72
+ margin-right: ${(p) => p.theme.spacing.xs};
73
+ }
74
+ `;
75
+
65
76
  const TabsWrapper = styled.div`
66
77
  width: ${(p) => `calc(${p.theme.spacing.xl} * 3)`};
67
78
  `;
@@ -258,4 +269,5 @@ export {
258
269
  SearchTags,
259
270
  ImageWrapper,
260
271
  IconWrapper,
272
+ FiltersGlobal,
261
273
  };
@@ -63,14 +63,15 @@ const getImageFromHtml = async (html: HTMLDivElement, fileName: string): Promise
63
63
 
64
64
  const getImageFromIFrame = async (html: HTMLDivElement, fileName: string): Promise<File | null> => {
65
65
  const frameOBject = html.querySelector<HTMLIFrameElement>(".frame-content");
66
- const frameContent = frameOBject?.contentWindow?.document.body;
66
+ const frameContentFirst = frameOBject?.contentWindow?.document.getElementById("___griddo")?.firstChild as HTMLElement;
67
+ const frameContentId = frameOBject?.contentWindow?.document.getElementById("griddoFormThumb") as HTMLElement;
68
+
69
+ const frameContent = frameContentId || frameContentFirst;
67
70
 
68
71
  if (!frameContent) {
69
72
  return null;
70
73
  }
71
74
 
72
- frameContent.removeChild(frameContent.childNodes[1]);
73
-
74
75
  const { height } = getComputedStyle(frameContent);
75
76
  const fullHeight = frameContent?.scrollHeight;
76
77
 
@@ -5,6 +5,9 @@ import { Header } from "@ax/components/TableList/style";
5
5
  const SortBy = styled((props) => <Header {...props} />)<{ isActive: boolean }>`
6
6
  width: 100%;
7
7
  cursor: pointer;
8
+ flex-shrink: 0;
9
+ white-space: nowrap;
10
+ flex-wrap: nowrap;
8
11
  &:hover {
9
12
  color: ${(p) => p.theme.color.interactive01};
10
13
  }
@@ -146,29 +146,29 @@ const FileDrive = (props: IProps) => {
146
146
  const allowedToAddSiteFile = usePermission("mediaGallery.addFiles");
147
147
  const allowedToAddGlobalFile = usePermission("global.mediaGallery.addGlobalFiles");
148
148
  const allowedToAddGlobalFileFromSite = usePermission("mediaGallery.addGlobalFilesFromSite");
149
- const allowedToAddFile = isTabGlobal
150
- ? allowedToAddGlobalFileFromSite
151
- : isSiteView
152
- ? allowedToAddSiteFile
153
- : allowedToAddGlobalFile;
149
+ const allowedToAddFile = !isSiteView
150
+ ? allowedToAddGlobalFile
151
+ : isTabGlobal
152
+ ? allowedToAddGlobalFileFromSite
153
+ : allowedToAddSiteFile;
154
154
 
155
155
  const allowedToEditSiteFile = usePermission("mediaGallery.editFiles");
156
156
  const allowedToEditGlobalFile = usePermission("global.mediaGallery.editGlobalFiles");
157
157
  const allowedToEditGlobalFileFromSite = usePermission("mediaGallery.editGlobalFilesInSite");
158
- const allowedToEditFile = isTabGlobal
159
- ? allowedToEditGlobalFileFromSite
160
- : isSiteView
161
- ? allowedToEditSiteFile
162
- : allowedToEditGlobalFile;
158
+ const allowedToEditFile = !isSiteView
159
+ ? allowedToEditGlobalFile
160
+ : isTabGlobal
161
+ ? allowedToEditGlobalFileFromSite
162
+ : allowedToEditSiteFile;
163
163
 
164
164
  const allowedToDeleteSiteFile = usePermission("mediaGallery.deleteFiles");
165
165
  const allowedToDeleteGlobalFile = usePermission("global.mediaGallery.deleteGlobalFiles");
166
166
  const allowedToDeleteGlobalFileFromSite = usePermission("mediaGallery.deleteGlobalFilesInSite");
167
- const allowedToDeleteFile = isTabGlobal
168
- ? allowedToDeleteGlobalFileFromSite
169
- : isSiteView
170
- ? allowedToDeleteSiteFile
171
- : allowedToDeleteGlobalFile;
167
+ const allowedToDeleteFile = !isSiteView
168
+ ? allowedToDeleteGlobalFile
169
+ : isTabGlobal
170
+ ? allowedToDeleteGlobalFileFromSite
171
+ : allowedToDeleteSiteFile;
172
172
 
173
173
  const getParams = useCallback(() => {
174
174
  const params = {
@@ -128,29 +128,30 @@ const MediaGallery = (props: IProps) => {
128
128
  const allowedToAddSiteFile = usePermission("mediaGallery.addImages");
129
129
  const allowedToAddGlobalFile = usePermission("global.mediaGallery.addGlobalImages");
130
130
  const allowedToAddGlobalFileFromSite = false;
131
- const allowedToAddFile = isTabGlobal
132
- ? allowedToAddGlobalFileFromSite
133
- : isSiteView
134
- ? allowedToAddSiteFile
135
- : allowedToAddGlobalFile;
131
+ const allowedToAddFile = !isSiteView
132
+ ? allowedToAddGlobalFile
133
+ : isTabGlobal
134
+ ? allowedToAddGlobalFileFromSite
135
+ : allowedToAddSiteFile;
136
136
 
137
137
  const allowedToEditSiteFile = usePermission("mediaGallery.editImages");
138
138
  const allowedToEditGlobalFile = usePermission("global.mediaGallery.editGlobalImages");
139
139
  const allowedToEditGlobalFileFromSite = false;
140
- const allowedToEditFile = isTabGlobal
141
- ? allowedToEditGlobalFileFromSite
142
- : isSiteView
143
- ? allowedToEditSiteFile
144
- : allowedToEditGlobalFile;
140
+ const allowedToEditFile = !isSiteView
141
+ ? allowedToEditGlobalFile
142
+ : isTabGlobal
143
+ ? allowedToEditGlobalFileFromSite
144
+ : allowedToEditSiteFile;
145
145
 
146
146
  const allowedToDeleteSiteFile = usePermission("mediaGallery.deleteImages");
147
147
  const allowedToDeleteGlobalFile = usePermission("global.mediaGallery.deleteGlobalImages");
148
148
  const allowedToDeleteGlobalFileFromSite = false;
149
- const allowedToDeleteFile = isTabGlobal
150
- ? allowedToDeleteGlobalFileFromSite
151
- : isSiteView
152
- ? allowedToDeleteSiteFile
153
- : allowedToDeleteGlobalFile;
149
+
150
+ const allowedToDeleteFile = !isSiteView
151
+ ? allowedToDeleteGlobalFile
152
+ : isTabGlobal
153
+ ? allowedToDeleteGlobalFileFromSite
154
+ : allowedToDeleteSiteFile;
154
155
 
155
156
  const getParams = useCallback(() => {
156
157
  const params: IGetFolderParams = {
@@ -924,7 +924,7 @@ export interface INotification {
924
924
  export interface ILinkField {
925
925
  text: string;
926
926
  linkType: string;
927
- url: IUrlField;
927
+ url?: IUrlField | null;
928
928
  modal: any;
929
929
  }
930
930