@griddo/ax 1.66.13 → 1.67.2
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/Fields/ConditionalField/ConditionalField.test.tsx +95 -0
- package/src/api/pages.tsx +15 -3
- package/src/api/redirects.tsx +4 -2
- package/src/api/sites.tsx +12 -4
- package/src/components/Browser/index.tsx +9 -22
- package/src/components/Browser/style.tsx +1 -6
- package/src/components/ErrorCenter/index.tsx +8 -5
- package/src/components/ErrorCenter/style.tsx +21 -8
- package/src/components/Fields/ComponentArray/MixableComponentArray/AddItemButton/index.tsx +3 -3
- package/src/components/Fields/ComponentArray/MixableComponentArray/index.tsx +60 -25
- package/src/components/Fields/ComponentContainer/index.tsx +21 -7
- package/src/components/Fields/ConditionalField/index.tsx +1 -1
- package/src/components/Fields/LinkField/index.tsx +111 -0
- package/src/components/Fields/ReferenceField/ItemList/index.tsx +4 -0
- package/src/components/Fields/ReferenceField/ManualPanel/index.tsx +12 -2
- package/src/components/Fields/ReferenceField/index.tsx +24 -12
- package/src/components/Fields/ReferenceField/style.tsx +12 -1
- package/src/components/Fields/UrlField/index.tsx +13 -1
- package/src/components/Fields/VisualUniqueSelection/utils.tsx +1 -6
- package/src/components/Fields/index.tsx +2 -0
- package/src/components/FieldsBehavior/index.tsx +14 -1
- package/src/components/Icon/components/Copy.js +14 -0
- package/src/components/Icon/components/Copy2.js +14 -0
- package/src/components/Icon/components/Duplicate.js +3 -5
- package/src/components/Icon/components/Page.js +12 -0
- package/src/components/Icon/svgs/Copy.svg +3 -0
- package/src/components/Icon/svgs/Copy2.svg +3 -0
- package/src/components/Icon/svgs/Duplicate.svg +1 -1
- package/src/components/Icon/svgs/page.svg +3 -0
- package/src/components/MainWrapper/AppBar/index.tsx +21 -10
- package/src/components/MainWrapper/AppBar/style.tsx +11 -3
- package/src/components/MainWrapper/index.tsx +2 -0
- package/src/components/Notification/index.tsx +1 -3
- package/src/components/SearchField/index.tsx +37 -4
- package/src/components/SearchField/style.tsx +23 -10
- package/src/components/index.tsx +2 -0
- package/src/containers/Navigation/Defaults/actions.tsx +2 -0
- package/src/containers/PageEditor/actions.tsx +101 -19
- package/src/containers/PageEditor/utils.tsx +2 -1
- package/src/containers/Sites/actions.tsx +53 -24
- package/src/containers/Sites/constants.tsx +2 -0
- package/src/containers/Sites/interfaces.tsx +12 -5
- package/src/containers/Sites/reducer.tsx +8 -0
- package/src/containers/StructuredData/actions.tsx +5 -8
- package/src/forms/errors.tsx +1 -0
- package/src/forms/index.tsx +13 -1
- package/src/forms/validators.tsx +181 -13
- package/src/helpers/dataPacks.tsx +8 -1
- package/src/helpers/index.tsx +4 -1
- package/src/helpers/objects.tsx +10 -2
- package/src/modules/Categories/CategoriesList/CategoryItem/index.tsx +3 -1
- package/src/modules/Categories/CategoriesList/CategoryPanel/index.tsx +15 -9
- package/src/modules/Categories/CategoriesList/index.tsx +2 -1
- package/src/modules/Content/PageItem/index.tsx +52 -2
- package/src/modules/Content/atoms.tsx +41 -3
- package/src/modules/Content/index.tsx +44 -2
- package/src/modules/Content/style.tsx +8 -1
- package/src/modules/FramePreview/index.tsx +85 -0
- package/src/modules/FramePreview/style.tsx +18 -0
- package/src/modules/GlobalEditor/Editor/index.tsx +3 -1
- package/src/modules/GlobalEditor/PageBrowser/index.tsx +3 -0
- package/src/modules/GlobalEditor/index.tsx +22 -6
- package/src/modules/PageEditor/Editor/index.tsx +5 -1
- package/src/modules/PageEditor/PageBrowser/index.tsx +4 -5
- package/src/modules/PageEditor/index.tsx +40 -12
- package/src/modules/Redirects/index.tsx +40 -10
- package/src/modules/Settings/Globals/index.tsx +1 -1
- package/src/modules/Sites/index.tsx +2 -2
- package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +1 -1
- package/src/modules/StructuredData/StructuredDataList/index.tsx +19 -2
- package/src/modules/Users/Profile/index.tsx +3 -3
- package/src/routes/multisite.tsx +12 -4
- package/src/routes/site.tsx +1 -1
- package/src/types/index.tsx +13 -4
- package/tsconfig.paths.json +2 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React, { memo } from "react";
|
|
2
|
+
|
|
3
|
+
import { FieldsBehavior } from "@ax/components";
|
|
4
|
+
import { ILinkField, IUrlField } from "@ax/types";
|
|
5
|
+
|
|
6
|
+
const LinkField = (props: ILinkFieldProps): JSX.Element => {
|
|
7
|
+
const { value, onChange, disabled, whiteList, goTo, theme, actions, selectedContent, objKey } = props;
|
|
8
|
+
|
|
9
|
+
const handleTextChange = (newValue: string) => onChange({ ...value, text: newValue });
|
|
10
|
+
const handleLinkTypeChange = (newValue: string) => onChange({ ...value, linkType: newValue });
|
|
11
|
+
const handleUrlChange = (newValue: IUrlField) => onChange({ ...value, url: newValue });
|
|
12
|
+
const handleModalChange = (newValue: any) => onChange({ ...value, modal: newValue });
|
|
13
|
+
|
|
14
|
+
const modalFieldSchema = {
|
|
15
|
+
title: "Modal",
|
|
16
|
+
type: "ComponentContainer",
|
|
17
|
+
hideable: true,
|
|
18
|
+
mandatory: true,
|
|
19
|
+
key: "modal",
|
|
20
|
+
condition: "modal",
|
|
21
|
+
whiteList,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const urlFieldSchema = {
|
|
25
|
+
title: "URL",
|
|
26
|
+
type: "UrlField",
|
|
27
|
+
key: "url",
|
|
28
|
+
advanced: true,
|
|
29
|
+
condition: "url",
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<>
|
|
34
|
+
<FieldsBehavior
|
|
35
|
+
title="Text"
|
|
36
|
+
name="text"
|
|
37
|
+
fieldType="TextField"
|
|
38
|
+
value={value.text}
|
|
39
|
+
onChange={handleTextChange}
|
|
40
|
+
disabled={disabled}
|
|
41
|
+
/>
|
|
42
|
+
<FieldsBehavior
|
|
43
|
+
title="Type of link"
|
|
44
|
+
name="linkType"
|
|
45
|
+
fieldType="ConditionalField"
|
|
46
|
+
value={value.linkType}
|
|
47
|
+
onChange={handleLinkTypeChange}
|
|
48
|
+
disabled={disabled}
|
|
49
|
+
options={[
|
|
50
|
+
{
|
|
51
|
+
value: "url",
|
|
52
|
+
title: "Link to Page",
|
|
53
|
+
name: "url",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
value: "modal",
|
|
57
|
+
title: "Open Modal",
|
|
58
|
+
name: "modal",
|
|
59
|
+
},
|
|
60
|
+
]}
|
|
61
|
+
innerFields={[
|
|
62
|
+
<FieldsBehavior
|
|
63
|
+
key="modal"
|
|
64
|
+
title="Modal"
|
|
65
|
+
name="modal"
|
|
66
|
+
fieldType="ComponentContainer"
|
|
67
|
+
value={value.modal}
|
|
68
|
+
onChange={handleModalChange}
|
|
69
|
+
disabled={disabled}
|
|
70
|
+
whiteList={whiteList}
|
|
71
|
+
selectedContent={selectedContent}
|
|
72
|
+
parentKey={objKey}
|
|
73
|
+
objKey="modal"
|
|
74
|
+
goTo={goTo}
|
|
75
|
+
theme={theme}
|
|
76
|
+
actions={actions}
|
|
77
|
+
mandatory
|
|
78
|
+
condition="modal"
|
|
79
|
+
field={modalFieldSchema}
|
|
80
|
+
/>,
|
|
81
|
+
<FieldsBehavior
|
|
82
|
+
key="url"
|
|
83
|
+
title="URL"
|
|
84
|
+
name="url"
|
|
85
|
+
fieldType="UrlField"
|
|
86
|
+
value={value.url}
|
|
87
|
+
onChange={handleUrlChange}
|
|
88
|
+
disabled={disabled}
|
|
89
|
+
mandatory
|
|
90
|
+
condition="url"
|
|
91
|
+
field={urlFieldSchema}
|
|
92
|
+
/>,
|
|
93
|
+
]}
|
|
94
|
+
/>
|
|
95
|
+
</>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
interface ILinkFieldProps {
|
|
100
|
+
value: ILinkField;
|
|
101
|
+
onChange: (value: ILinkField | null) => void;
|
|
102
|
+
disabled?: boolean;
|
|
103
|
+
whiteList: string[];
|
|
104
|
+
actions: any;
|
|
105
|
+
theme: string;
|
|
106
|
+
goTo: any;
|
|
107
|
+
selectedContent: any;
|
|
108
|
+
objKey: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export default memo(LinkField);
|
|
@@ -27,6 +27,10 @@ const ItemList = (props: IProps) => {
|
|
|
27
27
|
const response = await structuredData.getDistributorContent(siteID, params);
|
|
28
28
|
if (isReqOk(response.status)) {
|
|
29
29
|
setState((state: IReferenceState) => ({ ...state, selectedItems: response.data }));
|
|
30
|
+
if (fixed.length !== response.data.length) {
|
|
31
|
+
const itemsID = response.data.reduce((previous: any, current: any) => [...previous, current.id], []);
|
|
32
|
+
setState((state: IReferenceState) => ({ ...state, fixed: itemsID }));
|
|
33
|
+
}
|
|
30
34
|
} else {
|
|
31
35
|
console.log("Error en getItems");
|
|
32
36
|
}
|
|
@@ -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, hasMaxItems } = props;
|
|
16
|
+
const { onChange, currentSite, hasMaxItems, handleValidation, validators } = props;
|
|
17
17
|
|
|
18
18
|
const { state, setState } = useReference();
|
|
19
19
|
|
|
@@ -77,6 +77,7 @@ const ManualPanel = (props: IProps) => {
|
|
|
77
77
|
const { mode, fixed, fullRelations } = state;
|
|
78
78
|
const newValue = { mode, fixed, fullRelations };
|
|
79
79
|
onChange(newValue);
|
|
80
|
+
handleValidation && handleValidation(state.fixed, validators);
|
|
80
81
|
};
|
|
81
82
|
|
|
82
83
|
const textFieldProps = {
|
|
@@ -131,7 +132,14 @@ const ManualPanel = (props: IProps) => {
|
|
|
131
132
|
const source = state.sourceTitles.find((el: IDataSource) => el.id === item.structuredData);
|
|
132
133
|
const disabled = hasMaxItems && !isChecked;
|
|
133
134
|
return (
|
|
134
|
-
<Item
|
|
135
|
+
<Item
|
|
136
|
+
key={item.id}
|
|
137
|
+
isChecked={isChecked}
|
|
138
|
+
handleOnClick={handleOnClick}
|
|
139
|
+
item={item}
|
|
140
|
+
source={source}
|
|
141
|
+
disabled={disabled}
|
|
142
|
+
/>
|
|
135
143
|
);
|
|
136
144
|
})}
|
|
137
145
|
</S.ItemList>
|
|
@@ -152,6 +160,8 @@ interface IProps {
|
|
|
152
160
|
currentSite: number;
|
|
153
161
|
onChange: (value: any) => void;
|
|
154
162
|
hasMaxItems: boolean;
|
|
163
|
+
handleValidation?: (value: string, validators?: Record<string, unknown>) => void;
|
|
164
|
+
validators?: Record<string, unknown>;
|
|
155
165
|
}
|
|
156
166
|
|
|
157
167
|
const mapStateToProps = (state: IRootState) => ({
|
|
@@ -17,10 +17,22 @@ const ReferenceFieldWithProvider = (props: IProps) => (
|
|
|
17
17
|
<ReferenceProvider modes={props.selectionType}>
|
|
18
18
|
<ReferenceField {...props} />
|
|
19
19
|
</ReferenceProvider>
|
|
20
|
-
)
|
|
20
|
+
);
|
|
21
21
|
|
|
22
22
|
const ReferenceField = (props: IProps) => {
|
|
23
|
-
const {
|
|
23
|
+
const {
|
|
24
|
+
source,
|
|
25
|
+
value,
|
|
26
|
+
onChange,
|
|
27
|
+
disabled,
|
|
28
|
+
site,
|
|
29
|
+
selectionType,
|
|
30
|
+
structuredDataValues,
|
|
31
|
+
validators,
|
|
32
|
+
maxItems,
|
|
33
|
+
resetValidation,
|
|
34
|
+
handleValidation,
|
|
35
|
+
} = props;
|
|
24
36
|
|
|
25
37
|
const { isOpen, toggleModal } = useModal();
|
|
26
38
|
|
|
@@ -59,6 +71,7 @@ const ReferenceField = (props: IProps) => {
|
|
|
59
71
|
};
|
|
60
72
|
onChange(newValue);
|
|
61
73
|
setModeAndSource(mode, resetSource);
|
|
74
|
+
handleValidation && handleValidation(value.fixed, validators);
|
|
62
75
|
};
|
|
63
76
|
|
|
64
77
|
useEffect(() => {
|
|
@@ -110,6 +123,7 @@ const ReferenceField = (props: IProps) => {
|
|
|
110
123
|
fixed,
|
|
111
124
|
};
|
|
112
125
|
onChange(newValue);
|
|
126
|
+
resetValidation && resetValidation();
|
|
113
127
|
};
|
|
114
128
|
|
|
115
129
|
const icon = isAuto ? "edit" : "add";
|
|
@@ -152,14 +166,14 @@ const ReferenceField = (props: IProps) => {
|
|
|
152
166
|
|
|
153
167
|
const getPanel = () =>
|
|
154
168
|
isAuto ? (
|
|
155
|
-
<AutoPanel
|
|
156
|
-
|
|
169
|
+
<AutoPanel structuredData={structuredDataValues} onChange={handleOnChange} site={site} validators={validators} />
|
|
170
|
+
) : (
|
|
171
|
+
<ManualPanel
|
|
157
172
|
onChange={handleOnChange}
|
|
158
|
-
|
|
173
|
+
hasMaxItems={hasMaxItems}
|
|
174
|
+
handleValidation={handleValidation}
|
|
159
175
|
validators={validators}
|
|
160
176
|
/>
|
|
161
|
-
) : (
|
|
162
|
-
<ManualPanel onChange={handleOnChange} hasMaxItems={hasMaxItems} />
|
|
163
177
|
);
|
|
164
178
|
|
|
165
179
|
const manualItems = !isAuto && value && Array.isArray(value.fixed) ? value.fixed.length : 0;
|
|
@@ -189,11 +203,7 @@ const ReferenceField = (props: IProps) => {
|
|
|
189
203
|
{isAuto ? (
|
|
190
204
|
autoData
|
|
191
205
|
) : (
|
|
192
|
-
<ItemList
|
|
193
|
-
items={value ? value.fixed : []}
|
|
194
|
-
handleListDelete={handleListDelete}
|
|
195
|
-
handleChange={onChange}
|
|
196
|
-
/>
|
|
206
|
+
<ItemList items={value ? value.fixed : []} handleListDelete={handleListDelete} handleChange={onChange} />
|
|
197
207
|
)}
|
|
198
208
|
<FloatingPanel title="Configure elements" toggleModal={toggleModal} isOpen={isOpen}>
|
|
199
209
|
{isOpen && getPanel()}
|
|
@@ -212,6 +222,8 @@ interface IProps {
|
|
|
212
222
|
structuredDataValues: { global: IStructuredData[]; site: IStructuredData[] };
|
|
213
223
|
validators?: Record<string, unknown>;
|
|
214
224
|
maxItems?: number;
|
|
225
|
+
resetValidation?: () => void;
|
|
226
|
+
handleValidation?: (value: string, validators?: Record<string, unknown>) => void;
|
|
215
227
|
}
|
|
216
228
|
|
|
217
229
|
const mapStateToProps = (state: IRootState) => ({
|
|
@@ -52,4 +52,15 @@ const SingleModeText = styled.span`
|
|
|
52
52
|
color: ${(p) => p.theme.colors.textHighEmphasis};
|
|
53
53
|
`;
|
|
54
54
|
|
|
55
|
-
export {
|
|
55
|
+
export {
|
|
56
|
+
Wrapper,
|
|
57
|
+
Label,
|
|
58
|
+
ActionWrapper,
|
|
59
|
+
DataWrapper,
|
|
60
|
+
TypeContainer,
|
|
61
|
+
SourcesWrapper,
|
|
62
|
+
ConfigWrapper,
|
|
63
|
+
Title,
|
|
64
|
+
ModeWrapper,
|
|
65
|
+
SingleModeText,
|
|
66
|
+
};
|
|
@@ -11,7 +11,17 @@ import { findAnchorsFromPage, findAnchorsFromTab, findTabsFromPage } from "./uti
|
|
|
11
11
|
import * as S from "./style";
|
|
12
12
|
|
|
13
13
|
const UrlField = (props: IUrlFieldProps): JSX.Element => {
|
|
14
|
-
const {
|
|
14
|
+
const {
|
|
15
|
+
value,
|
|
16
|
+
onChange,
|
|
17
|
+
showAdvanced,
|
|
18
|
+
handlePanel,
|
|
19
|
+
inFloatingPanel,
|
|
20
|
+
disabled,
|
|
21
|
+
handleValidation,
|
|
22
|
+
validators,
|
|
23
|
+
resetValidation,
|
|
24
|
+
} = props;
|
|
15
25
|
const { isOpen, toggleModal } = useModal();
|
|
16
26
|
const [anchorOptions, setAnchorOptions] = useState<ISelectOption[]>([]);
|
|
17
27
|
const [tabOptions, setTabOptions] = useState<ISelectOption[]>([]);
|
|
@@ -70,6 +80,7 @@ const UrlField = (props: IUrlFieldProps): JSX.Element => {
|
|
|
70
80
|
const handleReset = () => {
|
|
71
81
|
onChange(null);
|
|
72
82
|
setInternalPageName(null);
|
|
83
|
+
resetValidation && resetValidation();
|
|
73
84
|
};
|
|
74
85
|
|
|
75
86
|
const handleSetPage = (page: IPage) => {
|
|
@@ -219,6 +230,7 @@ interface IUrlFieldProps {
|
|
|
219
230
|
inFloatingPanel?: boolean;
|
|
220
231
|
disabled?: boolean;
|
|
221
232
|
handleValidation?: (value: string, validators?: Record<string, unknown>) => void;
|
|
233
|
+
resetValidation?: () => void;
|
|
222
234
|
validators?: Record<string, unknown>;
|
|
223
235
|
}
|
|
224
236
|
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
return (
|
|
3
|
-
!!props &&
|
|
4
|
-
props.map((prop) => Object.prototype.hasOwnProperty.call(obj, prop)).filter(Boolean).length === props.length
|
|
5
|
-
);
|
|
6
|
-
};
|
|
1
|
+
import { hasProps } from "@ax/helpers";
|
|
7
2
|
|
|
8
3
|
const defaultOptions = (vusOptions: Record<string, unknown>[]) => {
|
|
9
4
|
return !vusOptions.find((entry) => entry.theme);
|
|
@@ -15,6 +15,7 @@ import FileField from "./FileField";
|
|
|
15
15
|
import HeadingField from "./HeadingField";
|
|
16
16
|
import HiddenField from "./HiddenField";
|
|
17
17
|
import ImageField from "./ImageField";
|
|
18
|
+
import LinkField from "./LinkField";
|
|
18
19
|
import MultiCheckSelect from "./MultiCheckSelect";
|
|
19
20
|
import MultiCheckSelectGroup from "./MultiCheckSelectGroup";
|
|
20
21
|
import NoteField from "./NoteField";
|
|
@@ -53,6 +54,7 @@ export {
|
|
|
53
54
|
HeadingField,
|
|
54
55
|
HiddenField,
|
|
55
56
|
ImageField,
|
|
57
|
+
LinkField,
|
|
56
58
|
MultiCheckSelect,
|
|
57
59
|
MultiCheckSelectGroup,
|
|
58
60
|
NoteField,
|
|
@@ -71,10 +71,23 @@ const FieldsBehavior = (props: any): JSX.Element => {
|
|
|
71
71
|
}
|
|
72
72
|
setErrorField(!isValid);
|
|
73
73
|
};
|
|
74
|
+
|
|
75
|
+
const resetValidation = () => {
|
|
76
|
+
setMessage(helptext);
|
|
77
|
+
error && deleteError && deleteError(error);
|
|
78
|
+
setErrorField(false);
|
|
79
|
+
};
|
|
80
|
+
|
|
74
81
|
return (
|
|
75
82
|
<S.Wrapper error={errorField} className={wrapperClass} showTitle={showTitle} id={objKey}>
|
|
76
83
|
<S.Content data-testid="contentWrapper" error={errorField}>
|
|
77
|
-
<Field
|
|
84
|
+
<Field
|
|
85
|
+
{...props}
|
|
86
|
+
showAdvanced={showAdvanced}
|
|
87
|
+
handleValidation={handleValidation}
|
|
88
|
+
resetValidation={resetValidation}
|
|
89
|
+
error={errorField}
|
|
90
|
+
/>
|
|
78
91
|
</S.Content>
|
|
79
92
|
<S.Header className="fieldHeader">
|
|
80
93
|
{showTitle && (
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
const SvgCopy = (props) => (
|
|
4
|
+
<svg width={24} height={24} fill="none" {...props}>
|
|
5
|
+
<path
|
|
6
|
+
fillRule="evenodd"
|
|
7
|
+
clipRule="evenodd"
|
|
8
|
+
d="M15.5263 2.3158H4.78947C3.80526 2.3158 3 3.12106 3 4.10527V16.6316H4.78947V4.10527H15.5263V2.3158ZM18.2105 5.89475H8.36842C7.38421 5.89475 6.57894 6.70001 6.57894 7.68422V20.2105C6.57894 21.1947 7.38421 22 8.36842 22H18.2105C19.1947 22 20 21.1947 20 20.2105V7.68422C20 6.70001 19.1947 5.89475 18.2105 5.89475ZM8.36843 20.2105H18.2105V7.68422H8.36843V20.2105Z"
|
|
9
|
+
fill="#5057FF"
|
|
10
|
+
/>
|
|
11
|
+
</svg>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
export default SvgCopy;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
const SvgCopy = (props) => (
|
|
4
|
+
<svg width={24} height={24} fill="none" {...props}>
|
|
5
|
+
<path
|
|
6
|
+
fillRule="evenodd"
|
|
7
|
+
clipRule="evenodd"
|
|
8
|
+
d="M12.5263 2.3158H3.78947C2.80526 2.3158 2 3.12106 2 4.10527V16.6316H3.78947V4.10527H12.5263V2.3158ZM15.2105 5.89475H7.36842C6.38421 5.89475 5.57894 6.70001 5.57894 7.68422V20.2105C5.57894 21.1947 6.38421 22 7.36842 22H15.2105C16.1947 22 17 21.1947 17 20.2105V18H15.2105V20.2105H7.36843V7.68422H15.2105V10H17V7.68422C17 6.70001 16.1947 5.89475 15.2105 5.89475ZM22 14L18 10V13H13V15H18V18L22 14Z"
|
|
9
|
+
fill="#5057FF"
|
|
10
|
+
/>
|
|
11
|
+
</svg>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
export default SvgCopy;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
const SvgDuplicate = props => (
|
|
3
|
+
const SvgDuplicate = (props) => (
|
|
4
4
|
<svg width={24} height={24} fill="none" {...props}>
|
|
5
5
|
<path
|
|
6
|
-
|
|
7
|
-
clipRule="evenodd"
|
|
8
|
-
d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zM8 21h11V7H8v14z"
|
|
6
|
+
d="M12.3254 13.9H14V11.8246H16.0754V10.1746H14V8.0998H12.3254V10.1746H10.2752V11.8246H12.3254V13.9ZM8.0004 19.675C7.5504 19.675 7.1586 19.5082 6.825 19.1746C6.4918 18.8414 6.3252 18.4498 6.3252 17.9998V3.6746C6.3252 3.2246 6.4918 2.833 6.825 2.4998C7.1586 2.1666 7.5504 2 8.0004 2H16.125L20.0002 5.8746V17.9998C20.0002 18.4498 19.8336 18.8414 19.5004 19.1746C19.1668 19.5082 18.775 19.675 18.325 19.675H8.0004ZM8.0004 17.9998H18.325V6.6246L15.3 3.6746H8.0004V17.9998ZM4.6752 22.9996C4.2252 22.9996 3.8336 22.833 3.5004 22.4998C3.1668 22.1666 3 21.775 3 21.325V6.3496H4.6752V21.325H15.6254V22.9996H4.6752ZM8.0004 17.9998V3.6746V7.6246V17.9998Z"
|
|
9
7
|
fill="#5057FF"
|
|
10
8
|
/>
|
|
11
9
|
</svg>
|
|
12
10
|
);
|
|
13
11
|
|
|
14
|
-
export default SvgDuplicate;
|
|
12
|
+
export default SvgDuplicate;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
const SvgPage = (props) => (
|
|
4
|
+
<svg width={24} height={24} fill="none" {...props}>
|
|
5
|
+
<path
|
|
6
|
+
d="M8 16H16V18H8V16ZM8 12H16V14H8V12ZM14 2H6C4.9 2 4 2.9 4 4V20C4 21.1 4.89 22 5.99 22H18C19.1 22 20 21.1 20 20V8L14 2ZM18 20H6V4H13V9H18V20Z"
|
|
7
|
+
fill="#5057FF"
|
|
8
|
+
/>
|
|
9
|
+
</svg>
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
export default SvgPage;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.5263 2.3158H4.78947C3.80526 2.3158 3 3.12106 3 4.10527V16.6316H4.78947V4.10527H15.5263V2.3158ZM18.2105 5.89475H8.36842C7.38421 5.89475 6.57894 6.70001 6.57894 7.68422V20.2105C6.57894 21.1947 7.38421 22 8.36842 22H18.2105C19.1947 22 20 21.1947 20 20.2105V7.68422C20 6.70001 19.1947 5.89475 18.2105 5.89475ZM8.36843 20.2105H18.2105V7.68422H8.36843V20.2105Z" fill="#5057FF"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.5263 2.3158H3.78947C2.80526 2.3158 2 3.12106 2 4.10527V16.6316H3.78947V4.10527H12.5263V2.3158ZM15.2105 5.89475H7.36842C6.38421 5.89475 5.57894 6.70001 5.57894 7.68422V20.2105C5.57894 21.1947 6.38421 22 7.36842 22H15.2105C16.1947 22 17 21.1947 17 20.2105V18H15.2105V20.2105H7.36843V7.68422H15.2105V10H17V7.68422C17 6.70001 16.1947 5.89475 15.2105 5.89475ZM22 14L18 10V13H13V15H18V18L22 14Z" fill="#5057FF"/>
|
|
3
|
+
</svg>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path
|
|
2
|
+
<path d="M12.3254 13.9H14V11.8246H16.0754V10.1746H14V8.0998H12.3254V10.1746H10.2752V11.8246H12.3254V13.9ZM8.0004 19.675C7.5504 19.675 7.1586 19.5082 6.825 19.1746C6.4918 18.8414 6.3252 18.4498 6.3252 17.9998V3.6746C6.3252 3.2246 6.4918 2.833 6.825 2.4998C7.1586 2.1666 7.5504 2 8.0004 2H16.125L20.0002 5.8746V17.9998C20.0002 18.4498 19.8336 18.8414 19.5004 19.1746C19.1668 19.5082 18.775 19.675 18.325 19.675H8.0004ZM8.0004 17.9998H18.325V6.6246L15.3 3.6746H8.0004V17.9998ZM4.6752 22.9996C4.2252 22.9996 3.8336 22.833 3.5004 22.4998C3.1668 22.1666 3 21.775 3 21.325V6.3496H4.6752V21.325H15.6254V22.9996H4.6752ZM8.0004 17.9998V3.6746V7.6246V17.9998Z" fill="#5057FF"/>
|
|
3
3
|
</svg>
|
|
@@ -43,6 +43,8 @@ const AppBar = (props: IProps): JSX.Element => {
|
|
|
43
43
|
errorActions,
|
|
44
44
|
isFromEditor,
|
|
45
45
|
pageStatusActions,
|
|
46
|
+
filterSearchAction,
|
|
47
|
+
searchFilters,
|
|
46
48
|
} = props;
|
|
47
49
|
|
|
48
50
|
const publishedTooltip: any = {
|
|
@@ -158,21 +160,28 @@ const AppBar = (props: IProps): JSX.Element => {
|
|
|
158
160
|
</S.WrapperTitle>
|
|
159
161
|
{tabs && (
|
|
160
162
|
<S.WrapperTabs>
|
|
161
|
-
<
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
163
|
+
<S.TabsContent>
|
|
164
|
+
<Tabs
|
|
165
|
+
tabs={tabs.tabSet}
|
|
166
|
+
icons={tabs.icons}
|
|
167
|
+
active={tabs.selectedTab}
|
|
168
|
+
setSelectedTab={tabs.action}
|
|
169
|
+
isInAppBar={true}
|
|
170
|
+
inversed={inversed}
|
|
171
|
+
/>
|
|
172
|
+
</S.TabsContent>
|
|
169
173
|
</S.WrapperTabs>
|
|
170
174
|
)}
|
|
171
175
|
<S.WrapperEnd>
|
|
172
176
|
{searchAction && (
|
|
173
177
|
<>
|
|
174
|
-
<S.SearchWrapper>
|
|
175
|
-
<SearchField
|
|
178
|
+
<S.SearchWrapper length={searchFilters && searchFilters.length ? 8 : 5}>
|
|
179
|
+
<SearchField
|
|
180
|
+
onChange={searchAction}
|
|
181
|
+
onFilterChange={filterSearchAction}
|
|
182
|
+
searchFilters={searchFilters}
|
|
183
|
+
closeOnInactive
|
|
184
|
+
/>
|
|
176
185
|
</S.SearchWrapper>
|
|
177
186
|
<S.Separator />
|
|
178
187
|
</>
|
|
@@ -261,6 +270,8 @@ interface IAppBarProps {
|
|
|
261
270
|
inversed?: boolean;
|
|
262
271
|
currentPageID?: number;
|
|
263
272
|
searchAction?(query: string): void;
|
|
273
|
+
filterSearchAction?(filter: string): void;
|
|
274
|
+
searchFilters?: any;
|
|
264
275
|
errors?: IErrorItem[];
|
|
265
276
|
errorActions?: {
|
|
266
277
|
goToError(editorID: number, tab: string, template: boolean): void;
|
|
@@ -7,6 +7,14 @@ const WrapperTabs = styled.div`
|
|
|
7
7
|
flex-direction: row;
|
|
8
8
|
align-items: center;
|
|
9
9
|
margin-right: auto;
|
|
10
|
+
flex: 1 1 auto;
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
const TabsContent = styled.div`
|
|
14
|
+
position: absolute;
|
|
15
|
+
right: 50%;
|
|
16
|
+
bottom: 0;
|
|
17
|
+
transform: translateX(50%);
|
|
10
18
|
`;
|
|
11
19
|
|
|
12
20
|
const WrapperEnd = styled.div`
|
|
@@ -20,7 +28,6 @@ const WrapperTitle = styled.div`
|
|
|
20
28
|
display: flex;
|
|
21
29
|
flex-direction: row;
|
|
22
30
|
align-items: center;
|
|
23
|
-
width: 600px;
|
|
24
31
|
margin-right: ${(p) => p.theme.spacing.xl};
|
|
25
32
|
`;
|
|
26
33
|
|
|
@@ -165,8 +172,8 @@ const ErrorWrapper = styled.div`
|
|
|
165
172
|
}
|
|
166
173
|
`;
|
|
167
174
|
|
|
168
|
-
const SearchWrapper = styled.div
|
|
169
|
-
width: ${(p) => `calc(${p.theme.spacing.xl} *
|
|
175
|
+
const SearchWrapper = styled.div<{ length: number }>`
|
|
176
|
+
width: ${(p) => `calc(${p.theme.spacing.xl} * ${p.length})`};
|
|
170
177
|
display: flex;
|
|
171
178
|
justify-content: flex-end;
|
|
172
179
|
`;
|
|
@@ -191,4 +198,5 @@ export {
|
|
|
191
198
|
SearchWrapper,
|
|
192
199
|
WrapperEnd,
|
|
193
200
|
WrapperTitle,
|
|
201
|
+
TabsContent,
|
|
194
202
|
};
|
|
@@ -42,6 +42,8 @@ interface IWrapperProps {
|
|
|
42
42
|
getDataContent?(dataID?: number): void;
|
|
43
43
|
} | null;
|
|
44
44
|
searchAction?(query: string): void;
|
|
45
|
+
filterSearchAction?(filter: string): void;
|
|
46
|
+
searchFilters?: any;
|
|
45
47
|
errors?: IErrorItem[];
|
|
46
48
|
errorActions?: {
|
|
47
49
|
goToError(editorID: number, tab: string, template: boolean): void;
|
|
@@ -4,7 +4,7 @@ import { Icon } from "@ax/components";
|
|
|
4
4
|
import * as S from "./style";
|
|
5
5
|
|
|
6
6
|
const Notification = (props: IProps) => {
|
|
7
|
-
const { text, type, btnText, resetError, onClick, closeButton = true, actionsBelow
|
|
7
|
+
const { text, type, btnText, resetError, onClick, closeButton = true, actionsBelow } = props;
|
|
8
8
|
|
|
9
9
|
const [isOpen, setIsOpen] = useState(true);
|
|
10
10
|
|
|
@@ -40,7 +40,6 @@ const Notification = (props: IProps) => {
|
|
|
40
40
|
|
|
41
41
|
const handleClose = () => {
|
|
42
42
|
resetError && resetError();
|
|
43
|
-
onClose && onClose();
|
|
44
43
|
setIsOpen(false);
|
|
45
44
|
};
|
|
46
45
|
|
|
@@ -79,7 +78,6 @@ interface IProps {
|
|
|
79
78
|
onClick?: () => void;
|
|
80
79
|
closeButton?: boolean;
|
|
81
80
|
actionsBelow?: boolean;
|
|
82
|
-
onClose?: () => void;
|
|
83
81
|
}
|
|
84
82
|
|
|
85
83
|
export default Notification;
|
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
import { Icon } from "@ax/components";
|
|
2
2
|
import React, { useState } from "react";
|
|
3
|
+
import { Select } from "../Fields";
|
|
3
4
|
|
|
4
5
|
import * as S from "./style";
|
|
5
6
|
|
|
6
7
|
const SearchField = (props: IProps): JSX.Element => {
|
|
7
|
-
const {
|
|
8
|
+
const {
|
|
9
|
+
onChange,
|
|
10
|
+
placeholder,
|
|
11
|
+
closeOnInactive = false,
|
|
12
|
+
searchOnEnter = true,
|
|
13
|
+
disabled = false,
|
|
14
|
+
searchFilters,
|
|
15
|
+
onFilterChange,
|
|
16
|
+
} = props;
|
|
8
17
|
|
|
9
18
|
const [isOpen, setIsOpen] = useState(false);
|
|
10
19
|
const [inputValue, setInputValue] = useState("");
|
|
20
|
+
const initState = searchFilters && searchFilters[0] ? searchFilters[0].value : "";
|
|
21
|
+
const [selectValue, setSelectValue] = useState<string>(initState);
|
|
11
22
|
|
|
12
23
|
const toggleField = () => setIsOpen(!isOpen);
|
|
13
24
|
|
|
@@ -19,6 +30,7 @@ const SearchField = (props: IProps): JSX.Element => {
|
|
|
19
30
|
const handleClear = () => {
|
|
20
31
|
setInputValue("");
|
|
21
32
|
onChange("");
|
|
33
|
+
setSelectValue(initState);
|
|
22
34
|
};
|
|
23
35
|
|
|
24
36
|
const handleClose = () => {
|
|
@@ -36,12 +48,32 @@ const SearchField = (props: IProps): JSX.Element => {
|
|
|
36
48
|
}
|
|
37
49
|
};
|
|
38
50
|
|
|
51
|
+
const handleSelectChange = (value: string) => {
|
|
52
|
+
setSelectValue(value);
|
|
53
|
+
onFilterChange && onFilterChange(value);
|
|
54
|
+
};
|
|
55
|
+
|
|
39
56
|
const showField = isOpen || !closeOnInactive;
|
|
40
57
|
|
|
41
58
|
return (
|
|
42
59
|
<S.Wrapper>
|
|
43
60
|
{showField ? (
|
|
44
|
-
<S.FieldWrapper>
|
|
61
|
+
<S.FieldWrapper closeOnInactive={closeOnInactive} disabled={disabled}>
|
|
62
|
+
{searchFilters && searchFilters.length && (
|
|
63
|
+
<>
|
|
64
|
+
<S.FilterWrapper>
|
|
65
|
+
<Select
|
|
66
|
+
name="filterSelect"
|
|
67
|
+
value={selectValue}
|
|
68
|
+
options={searchFilters}
|
|
69
|
+
onChange={handleSelectChange}
|
|
70
|
+
type="inline"
|
|
71
|
+
placeholder="Filter by"
|
|
72
|
+
/>
|
|
73
|
+
</S.FilterWrapper>
|
|
74
|
+
<S.Separator />
|
|
75
|
+
</>
|
|
76
|
+
)}
|
|
45
77
|
<S.Input
|
|
46
78
|
type="text"
|
|
47
79
|
value={inputValue}
|
|
@@ -50,7 +82,6 @@ const SearchField = (props: IProps): JSX.Element => {
|
|
|
50
82
|
placeholder={placeholder}
|
|
51
83
|
closeOnInactive={closeOnInactive}
|
|
52
84
|
disabled={disabled}
|
|
53
|
-
autoFocus
|
|
54
85
|
/>
|
|
55
86
|
{inputValue.trim() !== "" && searchOnEnter && <S.HelpText>Press ENTER</S.HelpText>}
|
|
56
87
|
{closeOnInactive || inputValue.length > 0 ? (
|
|
@@ -78,6 +109,8 @@ interface IProps {
|
|
|
78
109
|
closeOnInactive?: boolean;
|
|
79
110
|
searchOnEnter?: boolean;
|
|
80
111
|
disabled?: boolean;
|
|
112
|
+
searchFilters?: any;
|
|
113
|
+
onFilterChange?(filter: string): void;
|
|
81
114
|
}
|
|
82
115
|
|
|
83
|
-
export default SearchField;
|
|
116
|
+
export default SearchField;
|