@griddo/ax 1.59.7 → 1.59.11
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 +2 -2
- package/src/components/Fields/ReferenceField/Context/index.tsx +1 -1
- package/src/components/Fields/ReferenceField/ManualPanel/Item/index.tsx +4 -3
- package/src/components/Fields/ReferenceField/ManualPanel/index.tsx +4 -2
- package/src/components/Fields/ReferenceField/index.tsx +2 -2
- package/src/helpers/environment.tsx +5 -0
- package/src/helpers/index.tsx +3 -0
- package/src/modules/Sites/SitesList/SiteItem/index.tsx +6 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griddo/ax",
|
|
3
3
|
"description": "Griddo Author Experience",
|
|
4
|
-
"version": "1.59.
|
|
4
|
+
"version": "1.59.11",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -241,5 +241,5 @@
|
|
|
241
241
|
"publishConfig": {
|
|
242
242
|
"access": "public"
|
|
243
243
|
},
|
|
244
|
-
"gitHead": "
|
|
244
|
+
"gitHead": "f36fe6e77608ca067d10df476a6c6f954063e756"
|
|
245
245
|
}
|
|
@@ -7,16 +7,16 @@ import { CheckField } from "@ax/components";
|
|
|
7
7
|
import * as S from "./style";
|
|
8
8
|
|
|
9
9
|
const Item = (props: IProps) => {
|
|
10
|
-
const { handleOnClick, item, isChecked, source } = props;
|
|
10
|
+
const { handleOnClick, item, isChecked, source, disabled } = props;
|
|
11
11
|
|
|
12
12
|
const handleItemClick = (e: any) => {
|
|
13
13
|
e.preventDefault();
|
|
14
|
-
|
|
14
|
+
if (!disabled) handleOnClick(item);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
18
|
<S.Item onClick={handleItemClick}>
|
|
19
|
-
<CheckField name="check" value={item.id} checked={isChecked} />
|
|
19
|
+
<CheckField name="check" value={item.id} checked={isChecked} disabled={disabled} />
|
|
20
20
|
<S.TextWrapper>
|
|
21
21
|
<S.Header>
|
|
22
22
|
<S.Type>{source.title.toUpperCase()}</S.Type>
|
|
@@ -33,6 +33,7 @@ interface IProps {
|
|
|
33
33
|
item: any;
|
|
34
34
|
isChecked: boolean;
|
|
35
35
|
source: IDataSource;
|
|
36
|
+
disabled: boolean;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
export default Item;
|
|
@@ -13,7 +13,7 @@ import Item from "./Item";
|
|
|
13
13
|
import * as S from "./style";
|
|
14
14
|
|
|
15
15
|
const ManualPanel = (props: IProps) => {
|
|
16
|
-
const { onChange, currentSite } = props;
|
|
16
|
+
const { onChange, currentSite, hasMaxItems } = props;
|
|
17
17
|
|
|
18
18
|
const { state, setState } = useReference();
|
|
19
19
|
|
|
@@ -132,8 +132,9 @@ const ManualPanel = (props: IProps) => {
|
|
|
132
132
|
showedItems.map((item: IStructuredDataContent) => {
|
|
133
133
|
const isChecked = state.fixed.includes(item.id);
|
|
134
134
|
const source = state.sourceTitles.find((el: IDataSource) => el.id === item.structuredData);
|
|
135
|
+
const disabled = hasMaxItems && !isChecked;
|
|
135
136
|
return (
|
|
136
|
-
<Item key={item.id} isChecked={isChecked} handleOnClick={handleOnClick} item={item} source={source} />
|
|
137
|
+
<Item key={item.id} isChecked={isChecked} handleOnClick={handleOnClick} item={item} source={source} disabled={disabled} />
|
|
137
138
|
);
|
|
138
139
|
})}
|
|
139
140
|
</S.ItemList>
|
|
@@ -153,6 +154,7 @@ const ManualPanel = (props: IProps) => {
|
|
|
153
154
|
interface IProps {
|
|
154
155
|
currentSite: number;
|
|
155
156
|
onChange: (value: any) => void;
|
|
157
|
+
hasMaxItems: boolean;
|
|
156
158
|
}
|
|
157
159
|
|
|
158
160
|
const mapStateToProps = (state: IRootState) => ({
|
|
@@ -28,7 +28,7 @@ const ReferenceField = (props: IProps) => {
|
|
|
28
28
|
const { mode } = state;
|
|
29
29
|
const singleMode = selectionType && selectionType.length === 1;
|
|
30
30
|
const isAuto = mode === "auto";
|
|
31
|
-
const hasMaxItems = value && value.fixed && maxItems && !isAuto && value.fixed.length >= maxItems;
|
|
31
|
+
const hasMaxItems = !!(value && value.fixed && maxItems && !isAuto && value.fixed.length >= maxItems);
|
|
32
32
|
|
|
33
33
|
const handleMode = (mode: string) => {
|
|
34
34
|
const { fixed, order, quantity, filter } = state;
|
|
@@ -157,7 +157,7 @@ const ReferenceField = (props: IProps) => {
|
|
|
157
157
|
validators={validators}
|
|
158
158
|
/>
|
|
159
159
|
) : (
|
|
160
|
-
<ManualPanel onChange={handleOnChange} />
|
|
160
|
+
<ManualPanel onChange={handleOnChange} hasMaxItems={hasMaxItems} />
|
|
161
161
|
);
|
|
162
162
|
|
|
163
163
|
const manualItems = !isAuto && value && Array.isArray(value.fixed) ? value.fixed.length : 0;
|
package/src/helpers/index.tsx
CHANGED
|
@@ -83,6 +83,8 @@ import { isEmptyArray, moveArrayElement } from "./arrays";
|
|
|
83
83
|
|
|
84
84
|
import { getActivatedDataPacksIds, isModuleDisabled } from "./dataPacks";
|
|
85
85
|
|
|
86
|
+
import { isDevelopment } from "./environment";
|
|
87
|
+
|
|
86
88
|
export {
|
|
87
89
|
isComponentEmpty,
|
|
88
90
|
setAsContainedComponent,
|
|
@@ -149,4 +151,5 @@ export {
|
|
|
149
151
|
isNumber,
|
|
150
152
|
getFileExtension,
|
|
151
153
|
moveArrayElement,
|
|
154
|
+
isDevelopment,
|
|
152
155
|
};
|
|
@@ -2,7 +2,7 @@ import React, { useState } from "react";
|
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
3
|
|
|
4
4
|
import { useModal } from "@ax/hooks";
|
|
5
|
-
import { trimText } from "@ax/helpers";
|
|
5
|
+
import { trimText, isDevelopment } from "@ax/helpers";
|
|
6
6
|
import { ISite } from "@ax/types";
|
|
7
7
|
import { appActions } from "@ax/containers/App";
|
|
8
8
|
import { sitesActions } from "@ax/containers/Sites";
|
|
@@ -122,10 +122,14 @@ const SiteItem = (props: ISiteItemProps): JSX.Element => {
|
|
|
122
122
|
site.name
|
|
123
123
|
);
|
|
124
124
|
|
|
125
|
+
const siteTooltip = isDevelopment() && `Site id: ${site.id}`;
|
|
126
|
+
|
|
125
127
|
return (
|
|
126
128
|
<>
|
|
127
129
|
<S.SiteWrapper key={site.id} onClick={setSite}>
|
|
128
|
-
<
|
|
130
|
+
<Tooltip content={siteTooltip}>
|
|
131
|
+
<S.Thumbnail backgroundUrl={thumbnail} />
|
|
132
|
+
</Tooltip>
|
|
129
133
|
<S.Wrapper>
|
|
130
134
|
<S.Title>{siteName}</S.Title>
|
|
131
135
|
<S.IconsWrapper>
|