@eeacms/volto-eea-website-theme 2.4.0 → 3.1.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/CHANGELOG.md +18 -0
- package/README.md +6 -0
- package/package.json +2 -2
- package/src/customizations/volto/components/manage/Blocks/Grid/View.jsx +1 -1
- package/src/customizations/volto/components/manage/Blocks/Block/BlocksForm.diff +0 -12
- package/src/customizations/volto/components/manage/Blocks/Block/BlocksForm.jsx +0 -289
- package/src/customizations/volto/components/manage/Blocks/Block/BlocksForm.txt +0 -2
- package/src/customizations/volto/components/manage/Diff/DiffField.jsx +0 -351
- package/src/customizations/volto/components/manage/Form/Form.diff +0 -2
- package/src/customizations/volto/components/manage/Form/Form.jsx +0 -952
- package/src/customizations/volto/components/manage/Form/Form.txt +0 -2
- package/src/customizations/volto/components/manage/Widgets/InternalUrlWidget.jsx +0 -189
@@ -1,189 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* UrlWidget component.
|
3
|
-
* @module components/manage/Widgets/UrlWidget
|
4
|
-
* Volto pr: https://github.com/plone/volto/pull/6036
|
5
|
-
* Remove after the pr has been merged and put in the right version
|
6
|
-
*/
|
7
|
-
|
8
|
-
import React, { useState, useEffect } from 'react';
|
9
|
-
import PropTypes from 'prop-types';
|
10
|
-
import { Input, Button } from 'semantic-ui-react';
|
11
|
-
import { Icon } from '@plone/volto/components';
|
12
|
-
import FormFieldWrapper from '@plone/volto/components/manage/Widgets/FormFieldWrapper';
|
13
|
-
import { isInternalURL, flattenToAppURL, URLUtils } from '@plone/volto/helpers';
|
14
|
-
import withObjectBrowser from '@plone/volto/components/manage/Sidebar/ObjectBrowser';
|
15
|
-
import clearSVG from '@plone/volto/icons/clear.svg';
|
16
|
-
import navTreeSVG from '@plone/volto/icons/nav.svg';
|
17
|
-
|
18
|
-
/** Widget to edit urls
|
19
|
-
*
|
20
|
-
* This is the default widget used for the `remoteUrl` field. You can also use
|
21
|
-
* it by declaring a field like:
|
22
|
-
*
|
23
|
-
* ```jsx
|
24
|
-
* {
|
25
|
-
* title: "URL",
|
26
|
-
* widget: 'url',
|
27
|
-
* }
|
28
|
-
* ```
|
29
|
-
*/
|
30
|
-
export const InternalUrlWidget = (props) => {
|
31
|
-
const {
|
32
|
-
id,
|
33
|
-
onChange,
|
34
|
-
onBlur,
|
35
|
-
onClick,
|
36
|
-
minLength,
|
37
|
-
maxLength,
|
38
|
-
placeholder,
|
39
|
-
isDisabled,
|
40
|
-
value: propValue,
|
41
|
-
} = props;
|
42
|
-
const inputId = `field-${id}`;
|
43
|
-
|
44
|
-
const [value, setValue] = useState(flattenToAppURL(propValue));
|
45
|
-
const [isInvalid, setIsInvalid] = useState(false);
|
46
|
-
|
47
|
-
useEffect(() => {
|
48
|
-
if (propValue !== value) {
|
49
|
-
setValue(flattenToAppURL(propValue));
|
50
|
-
}
|
51
|
-
}, [propValue, value]);
|
52
|
-
/**
|
53
|
-
* Clear handler
|
54
|
-
* @method clear
|
55
|
-
* @param {Object} value Value
|
56
|
-
* @returns {undefined}
|
57
|
-
*/
|
58
|
-
const clear = () => {
|
59
|
-
setValue('');
|
60
|
-
onChange(id, undefined);
|
61
|
-
};
|
62
|
-
|
63
|
-
const onChangeValue = (_value) => {
|
64
|
-
let newValue = _value;
|
65
|
-
if (newValue?.length > 0) {
|
66
|
-
if (isInvalid && URLUtils.isUrl(URLUtils.normalizeUrl(newValue))) {
|
67
|
-
setIsInvalid(false);
|
68
|
-
}
|
69
|
-
|
70
|
-
if (isInternalURL(newValue)) {
|
71
|
-
newValue = flattenToAppURL(newValue);
|
72
|
-
}
|
73
|
-
}
|
74
|
-
|
75
|
-
setValue(newValue);
|
76
|
-
|
77
|
-
newValue = isInternalURL(newValue) ? flattenToAppURL(newValue) : newValue;
|
78
|
-
|
79
|
-
if (!isInternalURL(newValue) && newValue.length > 0) {
|
80
|
-
const checkedURL = URLUtils.checkAndNormalizeUrl(newValue);
|
81
|
-
newValue = checkedURL.url;
|
82
|
-
if (!checkedURL.isValid) {
|
83
|
-
setIsInvalid(true);
|
84
|
-
}
|
85
|
-
}
|
86
|
-
|
87
|
-
onChange(id, newValue === '' ? undefined : newValue);
|
88
|
-
};
|
89
|
-
|
90
|
-
return (
|
91
|
-
<FormFieldWrapper {...props} className="url wide">
|
92
|
-
<div className="wrapper">
|
93
|
-
<Input
|
94
|
-
id={inputId}
|
95
|
-
name={id}
|
96
|
-
type="url"
|
97
|
-
value={value || ''}
|
98
|
-
disabled={isDisabled}
|
99
|
-
placeholder={placeholder}
|
100
|
-
onChange={({ target }) => onChangeValue(target.value)}
|
101
|
-
onBlur={({ target }) =>
|
102
|
-
onBlur(id, target.value === '' ? undefined : target.value)
|
103
|
-
}
|
104
|
-
onClick={() => onClick()}
|
105
|
-
minLength={minLength || null}
|
106
|
-
maxLength={maxLength || null}
|
107
|
-
error={isInvalid}
|
108
|
-
/>
|
109
|
-
{value?.length > 0 ? (
|
110
|
-
<Button.Group>
|
111
|
-
<Button
|
112
|
-
basic
|
113
|
-
className="cancel"
|
114
|
-
aria-label="clearUrlBrowser"
|
115
|
-
onClick={(e) => {
|
116
|
-
e.preventDefault();
|
117
|
-
e.stopPropagation();
|
118
|
-
clear();
|
119
|
-
}}
|
120
|
-
>
|
121
|
-
<Icon name={clearSVG} size="30px" />
|
122
|
-
</Button>
|
123
|
-
</Button.Group>
|
124
|
-
) : (
|
125
|
-
<Button.Group>
|
126
|
-
<Button
|
127
|
-
basic
|
128
|
-
icon
|
129
|
-
aria-label="openUrlBrowser"
|
130
|
-
onClick={(e) => {
|
131
|
-
e.preventDefault();
|
132
|
-
e.stopPropagation();
|
133
|
-
props.openObjectBrowser({
|
134
|
-
mode: 'link',
|
135
|
-
overlay: true,
|
136
|
-
onSelectItem: (url) => {
|
137
|
-
onChangeValue(url);
|
138
|
-
},
|
139
|
-
});
|
140
|
-
}}
|
141
|
-
>
|
142
|
-
<Icon name={navTreeSVG} size="24px" />
|
143
|
-
</Button>
|
144
|
-
</Button.Group>
|
145
|
-
)}
|
146
|
-
</div>
|
147
|
-
</FormFieldWrapper>
|
148
|
-
);
|
149
|
-
};
|
150
|
-
|
151
|
-
/**
|
152
|
-
* Property types
|
153
|
-
* @property {Object} propTypes Property types.
|
154
|
-
* @static
|
155
|
-
*/
|
156
|
-
InternalUrlWidget.propTypes = {
|
157
|
-
id: PropTypes.string.isRequired,
|
158
|
-
title: PropTypes.string.isRequired,
|
159
|
-
description: PropTypes.string,
|
160
|
-
required: PropTypes.bool,
|
161
|
-
error: PropTypes.arrayOf(PropTypes.string),
|
162
|
-
value: PropTypes.string,
|
163
|
-
onChange: PropTypes.func.isRequired,
|
164
|
-
onBlur: PropTypes.func,
|
165
|
-
onClick: PropTypes.func,
|
166
|
-
minLength: PropTypes.number,
|
167
|
-
maxLength: PropTypes.number,
|
168
|
-
openObjectBrowser: PropTypes.func.isRequired,
|
169
|
-
placeholder: PropTypes.string,
|
170
|
-
};
|
171
|
-
|
172
|
-
/**
|
173
|
-
* Default properties.
|
174
|
-
* @property {Object} defaultProps Default properties.
|
175
|
-
* @static
|
176
|
-
*/
|
177
|
-
InternalUrlWidget.defaultProps = {
|
178
|
-
description: null,
|
179
|
-
required: false,
|
180
|
-
error: [],
|
181
|
-
value: null,
|
182
|
-
onChange: () => {},
|
183
|
-
onBlur: () => {},
|
184
|
-
onClick: () => {},
|
185
|
-
minLength: null,
|
186
|
-
maxLength: null,
|
187
|
-
};
|
188
|
-
|
189
|
-
export default withObjectBrowser(InternalUrlWidget);
|