@griddo/ax 1.75.72 → 1.75.73
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/__tests__/components/Avatar/__snapshots__/Avatar.test.tsx.snap +10 -10
- package/src/__tests__/components/Fields/ColorPicker/ColorPicker.test.tsx +1 -34
- package/src/api/structuredData.tsx +2 -0
- package/src/components/Fields/ColorPicker/Picker/index.tsx +5 -8
- package/src/components/Fields/ColorPicker/helpers.tsx +2 -2
- package/src/components/Fields/ColorPicker/index.tsx +9 -8
- package/src/components/Fields/ReferenceField/AutoPanel/AutoItem/index.tsx +2 -1
- package/src/components/ResizePanel/ResizeHandle/style.tsx +2 -1
- package/src/components/ResizePanel/index.tsx +1 -1
- package/src/components/ResizePanel/style.tsx +1 -0
- package/src/containers/PageEditor/actions.tsx +3 -1
- package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/Editor/ConfigPanel/style.tsx +6 -11
- package/src/types/index.tsx +1 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griddo/ax",
|
|
3
3
|
"description": "Griddo Author Experience",
|
|
4
|
-
"version": "1.75.
|
|
4
|
+
"version": "1.75.73",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -230,5 +230,5 @@
|
|
|
230
230
|
"publishConfig": {
|
|
231
231
|
"access": "public"
|
|
232
232
|
},
|
|
233
|
-
"gitHead": "
|
|
233
|
+
"gitHead": "5ad7cec7cf99c99fa6267c14aaac56b41908c75c"
|
|
234
234
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Avatar component rendering should render the component only with name 1`] = `
|
|
4
4
|
<div
|
|
5
|
-
className="sc-
|
|
5
|
+
className="sc-gSAPjG jRkXjC"
|
|
6
6
|
data-testid="avatar-wrapper"
|
|
7
7
|
>
|
|
8
8
|
<div
|
|
9
|
-
className="sc-
|
|
9
|
+
className="sc-lbxAil fkodDH"
|
|
10
10
|
data-testid="avatar"
|
|
11
11
|
/>
|
|
12
12
|
</div>
|
|
@@ -14,11 +14,11 @@ exports[`Avatar component rendering should render the component only with name 1
|
|
|
14
14
|
|
|
15
15
|
exports[`Avatar component rendering should render the component with a wrong image url 1`] = `
|
|
16
16
|
<div
|
|
17
|
-
className="sc-
|
|
17
|
+
className="sc-gSAPjG jRkXjC"
|
|
18
18
|
data-testid="avatar-wrapper"
|
|
19
19
|
>
|
|
20
20
|
<div
|
|
21
|
-
className="sc-
|
|
21
|
+
className="sc-lbxAil ejhcAS"
|
|
22
22
|
data-testid="avatar"
|
|
23
23
|
/>
|
|
24
24
|
</div>
|
|
@@ -26,11 +26,11 @@ exports[`Avatar component rendering should render the component with a wrong ima
|
|
|
26
26
|
|
|
27
27
|
exports[`Avatar component rendering should render the component with an empty string as name 1`] = `
|
|
28
28
|
<div
|
|
29
|
-
className="sc-
|
|
29
|
+
className="sc-gSAPjG jRkXjC"
|
|
30
30
|
data-testid="avatar-wrapper"
|
|
31
31
|
>
|
|
32
32
|
<div
|
|
33
|
-
className="sc-
|
|
33
|
+
className="sc-lbxAil hilXDA"
|
|
34
34
|
data-testid="avatar"
|
|
35
35
|
/>
|
|
36
36
|
</div>
|
|
@@ -38,11 +38,11 @@ exports[`Avatar component rendering should render the component with an empty st
|
|
|
38
38
|
|
|
39
39
|
exports[`Avatar component rendering should render the component with image null 1`] = `
|
|
40
40
|
<div
|
|
41
|
-
className="sc-
|
|
41
|
+
className="sc-gSAPjG jRkXjC"
|
|
42
42
|
data-testid="avatar-wrapper"
|
|
43
43
|
>
|
|
44
44
|
<div
|
|
45
|
-
className="sc-
|
|
45
|
+
className="sc-lbxAil jDWEnq"
|
|
46
46
|
data-testid="avatar"
|
|
47
47
|
/>
|
|
48
48
|
</div>
|
|
@@ -50,11 +50,11 @@ exports[`Avatar component rendering should render the component with image null
|
|
|
50
50
|
|
|
51
51
|
exports[`Avatar component rendering should render the component without name or image 1`] = `
|
|
52
52
|
<div
|
|
53
|
-
className="sc-
|
|
53
|
+
className="sc-gSAPjG jRkXjC"
|
|
54
54
|
data-testid="avatar-wrapper"
|
|
55
55
|
>
|
|
56
56
|
<div
|
|
57
|
-
className="sc-
|
|
57
|
+
className="sc-lbxAil hilXDA"
|
|
58
58
|
data-testid="avatar"
|
|
59
59
|
/>
|
|
60
60
|
</div>
|
|
@@ -39,39 +39,6 @@ describe("ColorPicker component rendering", () => {
|
|
|
39
39
|
expect(screen.findByTestId("picker-wrapper")).toBeTruthy();
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
test("should not render the text input field if onlyFixedColors is true", () => {
|
|
43
|
-
defaultProps.theme = "griddo-default";
|
|
44
|
-
defaultProps.error = true;
|
|
45
|
-
defaultProps.onlyFixedColors = true;
|
|
46
|
-
defaultProps.colors = [
|
|
47
|
-
{
|
|
48
|
-
theme: "griddo-default",
|
|
49
|
-
options: [
|
|
50
|
-
{ name: "chart1", hex: "#d9e3f0" },
|
|
51
|
-
{ name: "chart2", hex: "#697689" },
|
|
52
|
-
{ name: "chart2", hex: "#37d67a" },
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
theme: "griddo-alternative",
|
|
57
|
-
options: [
|
|
58
|
-
{ name: "chart1", hex: "#fffff" },
|
|
59
|
-
{ name: "chart2", hex: "#ddddd" },
|
|
60
|
-
{ name: "chart2", hex: "#00000" },
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
];
|
|
64
|
-
|
|
65
|
-
render(
|
|
66
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
67
|
-
<ColorPicker {...defaultProps} />
|
|
68
|
-
</ThemeProvider>
|
|
69
|
-
);
|
|
70
|
-
const inputActionComponent = screen.getByTestId("icon-action-component");
|
|
71
|
-
expect(inputActionComponent).toBeTruthy();
|
|
72
|
-
fireEvent.click(inputActionComponent);
|
|
73
|
-
expect(screen.queryByTestId("input-picker")).not.toBeTruthy();
|
|
74
|
-
});
|
|
75
42
|
});
|
|
76
43
|
|
|
77
44
|
describe("ColorPicker events", () => {
|
|
@@ -79,7 +46,7 @@ describe("ColorPicker events", () => {
|
|
|
79
46
|
defaultProps.value = "#000000";
|
|
80
47
|
defaultProps.theme = parseTheme(globalTheme);
|
|
81
48
|
defaultProps.colors = ["#000000", "#d9e3f0", "#f47373", "#697689"];
|
|
82
|
-
defaultProps.
|
|
49
|
+
defaultProps.isThemePalette = false;
|
|
83
50
|
const onChangeMock = defaultProps.onChange as jest.MockedFunction<(newColor: string) => void>;
|
|
84
51
|
|
|
85
52
|
render(
|
|
@@ -119,6 +119,7 @@ const getDataContents = (params: IGetStructuredDataParams, siteID?: number | nul
|
|
|
119
119
|
query,
|
|
120
120
|
filterQuery,
|
|
121
121
|
relatedFields = false,
|
|
122
|
+
order,
|
|
122
123
|
} = params;
|
|
123
124
|
|
|
124
125
|
const url = siteID ? `${host}/site/${siteID}${endpoint}` : `${host}${endpoint}`;
|
|
@@ -126,6 +127,7 @@ const getDataContents = (params: IGetStructuredDataParams, siteID?: number | nul
|
|
|
126
127
|
SERVICES.GET_DATA_CONTENTS.dynamicUrl = `${url}${dataID}?page=${page}&itemsPerPage=${itemsPerPage}&pagination=${pagination}&deleted=${deleted}&includeDraft=${include_draft}`;
|
|
127
128
|
if (relatedFields) SERVICES.GET_DATA_CONTENTS.dynamicUrl += `&relatedFields=true`;
|
|
128
129
|
if (query && query.trim() !== "") SERVICES.GET_DATA_CONTENTS.dynamicUrl += `&query=${query}`;
|
|
130
|
+
if (order) SERVICES.GET_DATA_CONTENTS.dynamicUrl += `&order=${order}`;
|
|
129
131
|
if (filterQuery) SERVICES.GET_DATA_CONTENTS.dynamicUrl += filterQuery;
|
|
130
132
|
|
|
131
133
|
return sendRequest(SERVICES.GET_DATA_CONTENTS);
|
|
@@ -4,7 +4,7 @@ import { hex3to6, defaultColors } from "./../helpers";
|
|
|
4
4
|
import * as S from "./style";
|
|
5
5
|
|
|
6
6
|
const Picker = (props: IProps): JSX.Element => {
|
|
7
|
-
const { value, onChange, colors
|
|
7
|
+
const { value, onChange, colors } = props;
|
|
8
8
|
const [color, setColor] = useState(value);
|
|
9
9
|
const [inputValue, setInputValue] = useState(value);
|
|
10
10
|
|
|
@@ -25,7 +25,7 @@ const Picker = (props: IProps): JSX.Element => {
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const handleClick = (newColor: string | any
|
|
28
|
+
const handleClick = (newColor: string | any) => () => {
|
|
29
29
|
const gridColor = typeof newColor !== "object" ? newColor : newColor.hex;
|
|
30
30
|
setInputValue(gridColor);
|
|
31
31
|
setColor(gridColor);
|
|
@@ -63,11 +63,9 @@ const Picker = (props: IProps): JSX.Element => {
|
|
|
63
63
|
);
|
|
64
64
|
})}
|
|
65
65
|
</S.Grid>
|
|
66
|
-
|
|
67
|
-
<S.
|
|
68
|
-
|
|
69
|
-
</S.InputWrapper>
|
|
70
|
-
) : null}
|
|
66
|
+
<S.InputWrapper>
|
|
67
|
+
<S.Input data-testid="input-picker" type="text" value={inputValue} onChange={handleChange} />
|
|
68
|
+
</S.InputWrapper>
|
|
71
69
|
</S.Wrapper>
|
|
72
70
|
);
|
|
73
71
|
};
|
|
@@ -76,7 +74,6 @@ export interface IProps {
|
|
|
76
74
|
value: string;
|
|
77
75
|
colors?: string[];
|
|
78
76
|
onChange: (newColor: string) => void;
|
|
79
|
-
onlyFixedColors?: boolean;
|
|
80
77
|
}
|
|
81
78
|
|
|
82
79
|
export default Picker;
|
|
@@ -19,9 +19,9 @@ const defaultColors = [
|
|
|
19
19
|
"#ba68c8",
|
|
20
20
|
];
|
|
21
21
|
|
|
22
|
-
const getOptions = (theme: string,
|
|
22
|
+
const getOptions = (theme: string, isThemePalette: boolean | undefined, colorOptions: any[] | undefined) => {
|
|
23
23
|
if (!colorOptions) return defaultColors;
|
|
24
|
-
if (
|
|
24
|
+
if (isThemePalette) return colorOptions;
|
|
25
25
|
|
|
26
26
|
const themes = colorOptions.filter((entry) => entry.theme).map((entry) => entry.theme);
|
|
27
27
|
const themeExists = themes.includes(theme);
|
|
@@ -8,10 +8,10 @@ import Picker from "./Picker";
|
|
|
8
8
|
import * as S from "./style";
|
|
9
9
|
|
|
10
10
|
const ColorPicker = (props: IProps): JSX.Element => {
|
|
11
|
-
const { value, onChange, error, colors = [], handleValidation, theme,
|
|
11
|
+
const { value, onChange, error, colors = [], handleValidation, theme, isThemePalette } = props;
|
|
12
12
|
|
|
13
13
|
const getCurrentColors = () => {
|
|
14
|
-
if (
|
|
14
|
+
if (isThemePalette) {
|
|
15
15
|
const currentOption = colors?.find((options: any) => options.theme === theme);
|
|
16
16
|
return currentOption ? currentOption?.options : defaultColors;
|
|
17
17
|
} else {
|
|
@@ -22,9 +22,12 @@ const ColorPicker = (props: IProps): JSX.Element => {
|
|
|
22
22
|
const currentColors = getCurrentColors();
|
|
23
23
|
|
|
24
24
|
const getInitialState = () => {
|
|
25
|
+
const hexRegEx = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
|
|
26
|
+
const isHexValue = hexRegEx.test(value);
|
|
27
|
+
|
|
25
28
|
const defaultColor = currentColors[0];
|
|
26
|
-
if (
|
|
27
|
-
const currentValue = currentColors.find((color: any) => color.name === value);
|
|
29
|
+
if (isThemePalette) {
|
|
30
|
+
const currentValue = isHexValue ? { hex: value } : currentColors.find((color: any) => color.name === value);
|
|
28
31
|
const isObject = typeof defaultColor === "object";
|
|
29
32
|
|
|
30
33
|
let color;
|
|
@@ -102,7 +105,6 @@ const ColorPicker = (props: IProps): JSX.Element => {
|
|
|
102
105
|
error={error}
|
|
103
106
|
placeholder="#FFFFFF"
|
|
104
107
|
onBlur={handleOnBlur}
|
|
105
|
-
readOnly={onlyFixedColors}
|
|
106
108
|
/>
|
|
107
109
|
<S.IconWrapper>
|
|
108
110
|
<IconAction icon={icon} size="s" onClick={togglePicker} />
|
|
@@ -112,8 +114,7 @@ const ColorPicker = (props: IProps): JSX.Element => {
|
|
|
112
114
|
<Picker
|
|
113
115
|
value={state.color}
|
|
114
116
|
onChange={handlePickerChange}
|
|
115
|
-
colors={getOptions(theme,
|
|
116
|
-
onlyFixedColors={onlyFixedColors}
|
|
117
|
+
colors={getOptions(theme, isThemePalette, currentColors)}
|
|
117
118
|
/>
|
|
118
119
|
)}
|
|
119
120
|
</S.Wrapper>
|
|
@@ -127,7 +128,7 @@ export interface IProps {
|
|
|
127
128
|
onChange: (newColor: string) => void;
|
|
128
129
|
handleValidation?: (value: string, validators: Record<string, unknown>) => void;
|
|
129
130
|
theme: string;
|
|
130
|
-
|
|
131
|
+
isThemePalette?: boolean;
|
|
131
132
|
}
|
|
132
133
|
|
|
133
134
|
export default memo(ColorPicker);
|
|
@@ -68,9 +68,10 @@ const AutoItem = (props: IProps) => {
|
|
|
68
68
|
dataID: newValue,
|
|
69
69
|
page: 1,
|
|
70
70
|
itemsPerPage: 50,
|
|
71
|
-
pagination:
|
|
71
|
+
pagination: false,
|
|
72
72
|
deleted: false,
|
|
73
73
|
include_draft: false,
|
|
74
|
+
order: "alpha-asc",
|
|
74
75
|
};
|
|
75
76
|
|
|
76
77
|
const siteID = getIsGlobal(newValue) ? null : site.id;
|
|
@@ -8,7 +8,8 @@ const Handler = styled.div`
|
|
|
8
8
|
background-color: ${(p) => p.theme.color.interactiveDisabled};
|
|
9
9
|
cursor: ew-resize;
|
|
10
10
|
z-index: 1;
|
|
11
|
-
transform: translateX(${(p) =>
|
|
11
|
+
transform: translateX(${(p) => p.theme.spacing.xs});
|
|
12
|
+
flex-shrink: 0;
|
|
12
13
|
&:hover {
|
|
13
14
|
background-color: ${(p) => p.theme.color.interactive01};
|
|
14
15
|
}
|
|
@@ -33,8 +33,8 @@ const ResizePanel = (props: IResizePanelProps): JSX.Element => {
|
|
|
33
33
|
leftPanel
|
|
34
34
|
)}
|
|
35
35
|
</S.LeftPanel>
|
|
36
|
+
<ResizeHandle onMouseMove={resize} />
|
|
36
37
|
<S.RightPanel width={rwidth} ref={rightPanelRef} data-testid="right-panel">
|
|
37
|
-
<ResizeHandle onMouseMove={resize} />
|
|
38
38
|
{rightPanel}
|
|
39
39
|
</S.RightPanel>
|
|
40
40
|
</>
|
|
@@ -19,6 +19,7 @@ export const RightPanel = styled.section<{ width: number }>`
|
|
|
19
19
|
width: ${(p) => p.width}px;
|
|
20
20
|
min-width: 344px;
|
|
21
21
|
max-width: ${(p) => `calc(100% - 500px - ${p.theme.spacing.m})`};
|
|
22
|
+
flex-direction: column;
|
|
22
23
|
`;
|
|
23
24
|
|
|
24
25
|
export const FixedPanel = styled.div<{ width: number }>`
|
|
@@ -974,8 +974,10 @@ function updateEditorContent(
|
|
|
974
974
|
pageEditor: { editorContent, selectedContent },
|
|
975
975
|
} = getState();
|
|
976
976
|
|
|
977
|
+
const clonedContent = deepClone(editorContent);
|
|
978
|
+
|
|
977
979
|
const updatedSelectedContent = updateByEditorID(selectedContent, selectedEditorID, key, value);
|
|
978
|
-
const updatedEditorContent = updateByEditorID(
|
|
980
|
+
const updatedEditorContent = updateByEditorID(clonedContent, selectedEditorID, key, value);
|
|
979
981
|
|
|
980
982
|
setSelectedContent(updatedSelectedContent);
|
|
981
983
|
dispatch(setEditorContent(updatedEditorContent));
|
|
@@ -12,16 +12,17 @@ const Title = styled.p`
|
|
|
12
12
|
`;
|
|
13
13
|
|
|
14
14
|
const Tab = styled.div`
|
|
15
|
-
border-bottom: ${p => `1px solid ${p.theme.color.uiLine}`};
|
|
16
|
-
margin: ${p => p.theme.spacing.s} 0;
|
|
17
|
-
padding-bottom: ${p => p.theme.spacing.s};
|
|
15
|
+
border-bottom: ${(p) => `1px solid ${p.theme.color.uiLine}`};
|
|
16
|
+
margin: ${(p) => p.theme.spacing.s} 0;
|
|
17
|
+
padding-bottom: ${(p) => p.theme.spacing.s};
|
|
18
18
|
${(p) => p.theme.textStyle.headingXS};
|
|
19
|
-
color: ${p => p.theme.color.textHighEmphasis};
|
|
19
|
+
color: ${(p) => p.theme.color.textHighEmphasis};
|
|
20
20
|
text-align: center;
|
|
21
21
|
`;
|
|
22
22
|
|
|
23
23
|
const FieldsWrapper = styled.div`
|
|
24
24
|
margin: ${(p) => `${p.theme.spacing.m} 0 ${p.theme.spacing.m} 0`};
|
|
25
|
+
height: 100%;
|
|
25
26
|
`;
|
|
26
27
|
|
|
27
28
|
const FieldsTitle = styled.div`
|
|
@@ -33,10 +34,4 @@ const FieldsTitle = styled.div`
|
|
|
33
34
|
border-bottom: 1px solid ${(p) => p.theme.color.uiLine};
|
|
34
35
|
`;
|
|
35
36
|
|
|
36
|
-
export {
|
|
37
|
-
HeaderWrapper,
|
|
38
|
-
Title,
|
|
39
|
-
Tab,
|
|
40
|
-
FieldsWrapper,
|
|
41
|
-
FieldsTitle,
|
|
42
|
-
};
|
|
37
|
+
export { HeaderWrapper, Title, Tab, FieldsWrapper, FieldsTitle };
|