Skip to content

Commit b2ebb03

Browse files
committed
add undomodifications parameter to get the Undo Modifications button optional
1 parent 2250b88 commit b2ebb03

File tree

1 file changed

+36
-25
lines changed

1 file changed

+36
-25
lines changed

src/components/Widgets/ReactTableWidget.jsx

+36-25
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,16 @@ const messages = defineMessages({
4747
});
4848

4949
const ReactDataTableWidget = (props) => {
50-
let { schema, value, onChange, id, csvexport, csvimport, fieldSet } = props;
50+
let {
51+
schema,
52+
value,
53+
onChange,
54+
id,
55+
csvexport,
56+
csvimport,
57+
undomodifications,
58+
fieldSet,
59+
} = props;
5160

5261
const intl = useIntl();
5362
const header_columns = schema.fieldsets[0].fields.map((field) => {
@@ -137,31 +146,33 @@ const ReactDataTableWidget = (props) => {
137146
</Grid.Row>
138147
</Grid>
139148
<Segment basic textAlign="center">
140-
<Modal
141-
trigger={
142-
<Button
143-
onClick={(e) => {
144-
e.preventDefault();
145-
}}
146-
disabled={!hasModifiedData}
147-
>
148-
{intl.formatMessage(messages.undo_all_modifications)}
149-
</Button>
150-
}
151-
header={intl.formatMessage(messages.undo_header)}
152-
content={intl.formatMessage(messages.undo_message)}
153-
actions={[
154-
'Cancel',
155-
{
156-
key: 'ok',
157-
content: 'OK',
158-
positive: true,
159-
onClick: () => {
160-
resetData();
149+
{undomodifications && (
150+
<Modal
151+
trigger={
152+
<Button
153+
onClick={(e) => {
154+
e.preventDefault();
155+
}}
156+
disabled={!hasModifiedData}
157+
>
158+
{intl.formatMessage(messages.undo_all_modifications)}
159+
</Button>
160+
}
161+
header={intl.formatMessage(messages.undo_header)}
162+
content={intl.formatMessage(messages.undo_message)}
163+
actions={[
164+
'Cancel',
165+
{
166+
key: 'ok',
167+
content: 'OK',
168+
positive: true,
169+
onClick: () => {
170+
resetData();
171+
},
161172
},
162-
},
163-
]}
164-
/>
173+
]}
174+
/>
175+
)}
165176

166177
{csvexport && (
167178
<CSVLink

0 commit comments

Comments
 (0)