@kitconcept/volto-light-theme 1.0.0-rc.8 → 1.0.0-rc.9

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.
@@ -1,803 +0,0 @@
1
- /**
2
- * OVERRIDE Form.jsx
3
- * REASON: This version enables a custom container for the form
4
- * DEVELOPER: @sneridagh
5
- * REMOVE: when https://github.com/plone/volto/pull/4849 is merged
6
- */
7
- import { BlocksForm, Field, Icon, Toast } from '@plone/volto/components';
8
- import {
9
- difference,
10
- FormValidation,
11
- getBlocksFieldname,
12
- getBlocksLayoutFieldname,
13
- messages,
14
- } from '@plone/volto/helpers';
15
- import aheadSVG from '@plone/volto/icons/ahead.svg';
16
- import clearSVG from '@plone/volto/icons/clear.svg';
17
- import {
18
- findIndex,
19
- isEmpty,
20
- keys,
21
- map,
22
- mapValues,
23
- pickBy,
24
- without,
25
- cloneDeep,
26
- } from 'lodash';
27
- import isBoolean from 'lodash/isBoolean';
28
- import PropTypes from 'prop-types';
29
- import React, { Component } from 'react';
30
- import { injectIntl } from 'react-intl';
31
- import { Portal } from 'react-portal';
32
- import { connect } from 'react-redux';
33
- import {
34
- Button,
35
- Container as SemanticContainer,
36
- Form as UiForm,
37
- Message,
38
- Segment,
39
- Tab,
40
- } from 'semantic-ui-react';
41
- import { v4 as uuid } from 'uuid';
42
- import { toast } from 'react-toastify';
43
- import { BlocksToolbar, UndoToolbar } from '@plone/volto/components';
44
- import { setSidebarTab } from '@plone/volto/actions';
45
- import { compose } from 'redux';
46
- import config from '@plone/volto/registry';
47
-
48
- /**
49
- * Form container class.
50
- * @class Form
51
- * @extends Component
52
- */
53
- class Form extends Component {
54
- /**
55
- * Property types.
56
- * @property {Object} propTypes Property types.
57
- * @static
58
- */
59
- static propTypes = {
60
- schema: PropTypes.shape({
61
- fieldsets: PropTypes.arrayOf(
62
- PropTypes.shape({
63
- fields: PropTypes.arrayOf(PropTypes.string),
64
- id: PropTypes.string,
65
- title: PropTypes.string,
66
- }),
67
- ),
68
- properties: PropTypes.objectOf(PropTypes.any),
69
- definitions: PropTypes.objectOf(PropTypes.any),
70
- required: PropTypes.arrayOf(PropTypes.string),
71
- }),
72
- formData: PropTypes.objectOf(PropTypes.any),
73
- pathname: PropTypes.string,
74
- onSubmit: PropTypes.func,
75
- onCancel: PropTypes.func,
76
- submitLabel: PropTypes.string,
77
- resetAfterSubmit: PropTypes.bool,
78
- resetOnCancel: PropTypes.bool,
79
- isEditForm: PropTypes.bool,
80
- isAdminForm: PropTypes.bool,
81
- title: PropTypes.string,
82
- error: PropTypes.shape({
83
- message: PropTypes.string,
84
- }),
85
- loading: PropTypes.bool,
86
- hideActions: PropTypes.bool,
87
- description: PropTypes.string,
88
- visual: PropTypes.bool,
89
- blocks: PropTypes.arrayOf(PropTypes.object),
90
- isFormSelected: PropTypes.bool,
91
- onSelectForm: PropTypes.func,
92
- editable: PropTypes.bool,
93
- onChangeFormData: PropTypes.func,
94
- requestError: PropTypes.string,
95
- allowedBlocks: PropTypes.arrayOf(PropTypes.string),
96
- showRestricted: PropTypes.bool,
97
- };
98
-
99
- /**
100
- * Default properties.
101
- * @property {Object} defaultProps Default properties.
102
- * @static
103
- */
104
- static defaultProps = {
105
- formData: null,
106
- onSubmit: null,
107
- onCancel: null,
108
- submitLabel: null,
109
- resetAfterSubmit: false,
110
- resetOnCancel: false,
111
- isEditForm: false,
112
- isAdminForm: false,
113
- title: null,
114
- description: null,
115
- error: null,
116
- loading: null,
117
- hideActions: false,
118
- visual: false,
119
- blocks: [],
120
- pathname: '',
121
- schema: {},
122
- isFormSelected: true,
123
- onSelectForm: null,
124
- editable: true,
125
- requestError: null,
126
- allowedBlocks: null,
127
- };
128
-
129
- /**
130
- * Constructor
131
- * @method constructor
132
- * @param {Object} props Component properties
133
- * @constructs Form
134
- */
135
- constructor(props) {
136
- super(props);
137
- const ids = {
138
- title: uuid(),
139
- text: uuid(),
140
- };
141
- let { formData } = props;
142
- const blocksFieldname = getBlocksFieldname(formData);
143
- const blocksLayoutFieldname = getBlocksLayoutFieldname(formData);
144
-
145
- if (!props.isEditForm) {
146
- // It's a normal (add form), get defaults from schema
147
- formData = {
148
- ...mapValues(props.schema.properties, 'default'),
149
- ...formData,
150
- };
151
- }
152
- // defaults for block editor; should be moved to schema on server side
153
- // Adding fallback in case the fields are empty, so we are sure that the edit form
154
- // shows at least the default blocks
155
- if (
156
- formData.hasOwnProperty(blocksFieldname) &&
157
- formData.hasOwnProperty(blocksLayoutFieldname)
158
- ) {
159
- if (
160
- !formData[blocksLayoutFieldname] ||
161
- isEmpty(formData[blocksLayoutFieldname].items)
162
- ) {
163
- formData[blocksLayoutFieldname] = {
164
- items: [ids.title, ids.text],
165
- };
166
- }
167
- if (!formData[blocksFieldname] || isEmpty(formData[blocksFieldname])) {
168
- formData[blocksFieldname] = {
169
- [ids.title]: {
170
- '@type': 'title',
171
- },
172
- [ids.text]: {
173
- '@type': config.settings.defaultBlockType,
174
- },
175
- };
176
- }
177
- }
178
-
179
- let selectedBlock = null;
180
- if (
181
- formData.hasOwnProperty(blocksLayoutFieldname) &&
182
- formData[blocksLayoutFieldname].items.length > 0
183
- ) {
184
- selectedBlock = formData[blocksLayoutFieldname].items[0];
185
-
186
- if (config.blocks?.initialBlocksFocus?.[this.props.type]) {
187
- //Default selected is not the first block, but the one from config.
188
- Object.keys(formData[blocksFieldname]).forEach((b_key) => {
189
- if (
190
- formData[blocksFieldname][b_key]['@type'] ===
191
- config.blocks?.initialBlocksFocus?.[this.props.type]
192
- ) {
193
- selectedBlock = b_key;
194
- }
195
- });
196
- }
197
- }
198
- this.state = {
199
- formData,
200
- initialFormData: cloneDeep(formData),
201
- errors: {},
202
- selected: selectedBlock,
203
- multiSelected: [],
204
- isClient: false,
205
- // Ensure focus remain in field after change
206
- inFocus: {},
207
- };
208
- this.onChangeField = this.onChangeField.bind(this);
209
- this.onSelectBlock = this.onSelectBlock.bind(this);
210
- this.onSubmit = this.onSubmit.bind(this);
211
- this.onCancel = this.onCancel.bind(this);
212
- this.onTabChange = this.onTabChange.bind(this);
213
- this.onBlurField = this.onBlurField.bind(this);
214
- this.onClickInput = this.onClickInput.bind(this);
215
- }
216
-
217
- /**
218
- * On updates caused by props change
219
- * if errors from Backend come, these will be shown to their corresponding Fields
220
- * also the first Tab to have any errors will be selected
221
- * @param {Object} prevProps
222
- */
223
- async componentDidUpdate(prevProps, prevState) {
224
- let { requestError } = this.props;
225
- let errors = {};
226
- let activeIndex = 0;
227
-
228
- if (requestError && prevProps.requestError !== requestError) {
229
- errors = FormValidation.giveServerErrorsToCorrespondingFields(
230
- requestError,
231
- );
232
- activeIndex = FormValidation.showFirstTabWithErrors({
233
- errors,
234
- schema: this.props.schema,
235
- });
236
-
237
- this.setState({
238
- errors,
239
- activeIndex,
240
- });
241
- }
242
-
243
- if (this.props.onChangeFormData) {
244
- if (
245
- // TODO: use fast-deep-equal
246
- JSON.stringify(prevState?.formData) !==
247
- JSON.stringify(this.state.formData)
248
- ) {
249
- this.props.onChangeFormData(this.state.formData);
250
- }
251
- }
252
- }
253
-
254
- /**
255
- * Tab selection is done only by setting activeIndex in state
256
- */
257
- onTabChange(e, { activeIndex }) {
258
- this.setState({ activeIndex });
259
- }
260
-
261
- /**
262
- * If user clicks on input, the form will be not considered pristine
263
- * this will avoid onBlur effects without interraction with the form
264
- * @param {Object} e event
265
- */
266
- onClickInput(e) {
267
- this.setState({ isFormPristine: false });
268
- }
269
-
270
- /**
271
- * Validate fields on blur
272
- * @method onBlurField
273
- * @param {string} id Id of the field
274
- * @param {*} value Value of the field
275
- * @returns {undefined}
276
- */
277
- onBlurField(id, value) {
278
- if (!this.state.isFormPristine) {
279
- const errors = FormValidation.validateFieldsPerFieldset({
280
- schema: this.props.schema,
281
- formData: this.state.formData,
282
- formatMessage: this.props.intl.formatMessage,
283
- touchedField: { [id]: value },
284
- });
285
-
286
- this.setState({
287
- errors,
288
- });
289
- }
290
- }
291
-
292
- /**
293
- * Component did mount
294
- * @method componentDidMount
295
- * @returns {undefined}
296
- */
297
- componentDidMount() {
298
- this.setState({ isClient: true });
299
- }
300
-
301
- static getDerivedStateFromProps(props, state) {
302
- let newState = { ...state };
303
- if (!props.isFormSelected) {
304
- newState.selected = null;
305
- }
306
-
307
- return newState;
308
- }
309
-
310
- /**
311
- * Change field handler
312
- * Remove errors for changed field
313
- * @method onChangeField
314
- * @param {string} id Id of the field
315
- * @param {*} value Value of the field
316
- * @returns {undefined}
317
- */
318
- onChangeField(id, value) {
319
- this.setState((prevState) => {
320
- const { errors, formData } = prevState;
321
- delete errors[id];
322
- return {
323
- errors,
324
- formData: {
325
- ...formData,
326
- // We need to catch also when the value equals false this fixes #888
327
- [id]:
328
- value || (value !== undefined && isBoolean(value)) ? value : null,
329
- },
330
- // Changing the form data re-renders the select widget which causes the
331
- // focus to get lost. To circumvent this, we set the focus back to
332
- // the input.
333
- // This could fix other widgets too but currently targeted
334
- // against the select widget only.
335
- // Ensure field to be in focus after the change
336
- inFocus: { [id]: true },
337
- };
338
- });
339
- }
340
-
341
- /**
342
- * Select block handler
343
- * @method onSelectBlock
344
- * @param {string} id Id of the field
345
- * @param {string} isMultipleSelection true if multiple blocks are selected
346
- * @returns {undefined}
347
- */
348
- onSelectBlock(id, isMultipleSelection, event) {
349
- let multiSelected = [];
350
- let selected = id;
351
-
352
- if (isMultipleSelection) {
353
- selected = null;
354
- const blocksLayoutFieldname = getBlocksLayoutFieldname(
355
- this.state.formData,
356
- );
357
-
358
- const blocks_layout = this.state.formData[blocksLayoutFieldname].items;
359
-
360
- if (event.shiftKey) {
361
- const anchor =
362
- this.state.multiSelected.length > 0
363
- ? blocks_layout.indexOf(this.state.multiSelected[0])
364
- : blocks_layout.indexOf(this.state.selected);
365
- const focus = blocks_layout.indexOf(id);
366
-
367
- if (anchor === focus) {
368
- multiSelected = [id];
369
- } else if (focus > anchor) {
370
- multiSelected = [...blocks_layout.slice(anchor, focus + 1)];
371
- } else {
372
- multiSelected = [...blocks_layout.slice(focus, anchor + 1)];
373
- }
374
- }
375
-
376
- if ((event.ctrlKey || event.metaKey) && !event.shiftKey) {
377
- multiSelected = this.state.multiSelected || [];
378
- if (!this.state.multiSelected.includes(this.state.selected)) {
379
- multiSelected = [...multiSelected, this.state.selected];
380
- selected = null;
381
- }
382
- if (this.state.multiSelected.includes(id)) {
383
- selected = null;
384
- multiSelected = without(multiSelected, id);
385
- } else {
386
- multiSelected = [...multiSelected, id];
387
- }
388
- }
389
- }
390
-
391
- this.setState({
392
- selected,
393
- multiSelected,
394
- });
395
-
396
- if (this.props.onSelectForm) {
397
- if (event) event.nativeEvent.stopImmediatePropagation();
398
- this.props.onSelectForm();
399
- }
400
- }
401
-
402
- /**
403
- * Cancel handler
404
- * It prevents event from triggering submit, reset form if props.resetAfterSubmit
405
- * and calls this.props.onCancel
406
- * @method onCancel
407
- * @param {Object} event Event object.
408
- * @returns {undefined}
409
- */
410
- onCancel(event) {
411
- if (event) {
412
- event.preventDefault();
413
- }
414
- if (this.props.resetOnCancel || this.props.resetAfterSubmit) {
415
- this.setState({
416
- formData: this.props.formData,
417
- });
418
- }
419
- this.props.onCancel(event);
420
- }
421
-
422
- /**
423
- * Submit handler also validate form and collect errors
424
- * @method onSubmit
425
- * @param {Object} event Event object.
426
- * @returns {undefined}
427
- */
428
- onSubmit(event) {
429
- if (event) {
430
- event.preventDefault();
431
- }
432
-
433
- const errors = this.props.schema
434
- ? FormValidation.validateFieldsPerFieldset({
435
- schema: this.props.schema,
436
- formData: this.state.formData,
437
- formatMessage: this.props.intl.formatMessage,
438
- })
439
- : {};
440
-
441
- if (keys(errors).length > 0) {
442
- const activeIndex = FormValidation.showFirstTabWithErrors({
443
- errors,
444
- schema: this.props.schema,
445
- });
446
- this.setState(
447
- {
448
- errors,
449
- activeIndex,
450
- },
451
- () => {
452
- Object.keys(errors).forEach((err) =>
453
- toast.error(
454
- <Toast
455
- error
456
- title={this.props.schema.properties[err].title || err}
457
- content={errors[err].join(', ')}
458
- />,
459
- ),
460
- );
461
- },
462
- );
463
- // Changes the focus to the metadata tab in the sidebar if error
464
- this.props.setSidebarTab(0);
465
- } else {
466
- // Get only the values that have been modified (Edit forms), send all in case that
467
- // it's an add form
468
- if (this.props.isEditForm) {
469
- this.props.onSubmit(this.getOnlyFormModifiedValues());
470
- } else {
471
- this.props.onSubmit(this.state.formData);
472
- }
473
- if (this.props.resetAfterSubmit) {
474
- this.setState({
475
- formData: this.props.formData,
476
- });
477
- }
478
- }
479
- }
480
-
481
- /**
482
- * getOnlyFormModifiedValues handler
483
- * It returns only the values of the fields that are have really changed since the
484
- * form was loaded. Useful for edit forms and PATCH operations, when we only want to
485
- * send the changed data.
486
- * @method getOnlyFormModifiedValues
487
- * @param {Object} event Event object.
488
- * @returns {undefined}
489
- */
490
- getOnlyFormModifiedValues = () => {
491
- const fieldsModified = Object.keys(
492
- difference(this.state.formData, this.state.initialFormData),
493
- );
494
- return {
495
- ...pickBy(this.state.formData, (value, key) =>
496
- fieldsModified.includes(key),
497
- ),
498
- ...(this.state.formData['@static_behaviors'] && {
499
- '@static_behaviors': this.state.formData['@static_behaviors'],
500
- }),
501
- };
502
- };
503
-
504
- /**
505
- * Removed blocks and blocks_layout fields from the form.
506
- * @method removeBlocksLayoutFields
507
- * @param {object} schema The schema definition of the form.
508
- * @returns A modified copy of the given schema.
509
- */
510
- removeBlocksLayoutFields = (schema) => {
511
- const newSchema = { ...schema };
512
- const layoutFieldsetIndex = findIndex(
513
- newSchema.fieldsets,
514
- (fieldset) => fieldset.id === 'layout',
515
- );
516
- if (layoutFieldsetIndex > -1) {
517
- const layoutFields = newSchema.fieldsets[layoutFieldsetIndex].fields;
518
- newSchema.fieldsets[layoutFieldsetIndex].fields = layoutFields.filter(
519
- (field) => field !== 'blocks' && field !== 'blocks_layout',
520
- );
521
- if (newSchema.fieldsets[layoutFieldsetIndex].fields.length === 0) {
522
- newSchema.fieldsets = [
523
- ...newSchema.fieldsets.slice(0, layoutFieldsetIndex),
524
- ...newSchema.fieldsets.slice(layoutFieldsetIndex + 1),
525
- ];
526
- }
527
- }
528
- return newSchema;
529
- };
530
-
531
- /**
532
- * Render method.
533
- * @method render
534
- * @returns {string} Markup for the component.
535
- */
536
- render() {
537
- const { settings } = config;
538
- const { schema: originalSchema, onCancel, onSubmit } = this.props;
539
- const { formData } = this.state;
540
- const schema = this.removeBlocksLayoutFields(originalSchema);
541
-
542
- // START CUSTOMIZATION
543
- const Container =
544
- config.getComponent({ name: 'Container' }).component || SemanticContainer;
545
- // STOP CUSTOMIZATION
546
-
547
- return this.props.visual ? (
548
- // Removing this from SSR is important, since react-beautiful-dnd supports SSR,
549
- // but draftJS don't like it much and the hydration gets messed up
550
- this.state.isClient && (
551
- // START CUSTOMIZATION
552
- <Container layout>
553
- {/* STOP CUSTOMIZATION */}
554
- <BlocksToolbar
555
- formData={this.state.formData}
556
- selectedBlock={this.state.selected}
557
- selectedBlocks={this.state.multiSelected}
558
- onChangeBlocks={(newBlockData) =>
559
- this.setState({
560
- formData: {
561
- ...formData,
562
- ...newBlockData,
563
- },
564
- })
565
- }
566
- onSetSelectedBlocks={(blockIds) =>
567
- this.setState({ multiSelected: blockIds })
568
- }
569
- onSelectBlock={this.onSelectBlock}
570
- />
571
- <UndoToolbar
572
- state={{
573
- formData: this.state.formData,
574
- selected: this.state.selected,
575
- multiSelected: this.state.multiSelected,
576
- }}
577
- enableHotKeys
578
- onUndoRedo={({ state }) => this.setState(state)}
579
- />
580
- <BlocksForm
581
- onChangeFormData={(newFormData) =>
582
- this.setState({
583
- formData: {
584
- ...formData,
585
- ...newFormData,
586
- },
587
- })
588
- }
589
- onChangeField={this.onChangeField}
590
- onSelectBlock={this.onSelectBlock}
591
- properties={formData}
592
- pathname={this.props.pathname}
593
- selectedBlock={this.state.selected}
594
- multiSelected={this.state.multiSelected}
595
- manage={this.props.isAdminForm}
596
- allowedBlocks={this.props.allowedBlocks}
597
- showRestricted={this.props.showRestricted}
598
- editable={this.props.editable}
599
- isMainForm={this.props.editable}
600
- />
601
- {this.state.isClient && this.props.editable && (
602
- <Portal
603
- node={__CLIENT__ && document.getElementById('sidebar-metadata')}
604
- >
605
- <UiForm
606
- method="post"
607
- onSubmit={this.onSubmit}
608
- error={keys(this.state.errors).length > 0}
609
- >
610
- {schema &&
611
- map(schema.fieldsets, (item) => [
612
- <Segment
613
- secondary
614
- attached
615
- className={`fieldset-${item.id}`}
616
- key={item.title}
617
- >
618
- {item.title}
619
- </Segment>,
620
- <Segment attached key={`fieldset-contents-${item.title}`}>
621
- {map(item.fields, (field, index) => (
622
- <Field
623
- {...schema.properties[field]}
624
- id={field}
625
- fieldSet={item.title.toLowerCase()}
626
- formData={this.state.formData}
627
- focus={this.state.inFocus[field]}
628
- value={this.state.formData?.[field]}
629
- required={schema.required.indexOf(field) !== -1}
630
- onChange={this.onChangeField}
631
- onBlur={this.onBlurField}
632
- onClick={this.onClickInput}
633
- key={field}
634
- error={this.state.errors[field]}
635
- />
636
- ))}
637
- </Segment>,
638
- ])}
639
- </UiForm>
640
- </Portal>
641
- )}
642
- </Container>
643
- )
644
- ) : (
645
- <Container>
646
- <UiForm
647
- method="post"
648
- onSubmit={this.onSubmit}
649
- error={keys(this.state.errors).length > 0}
650
- className={settings.verticalFormTabs ? 'vertical-form' : ''}
651
- >
652
- <fieldset className="invisible" disabled={!this.props.editable}>
653
- <Segment.Group raised>
654
- {schema && schema.fieldsets.length > 1 && (
655
- <>
656
- {settings.verticalFormTabs && this.props.title && (
657
- <Segment secondary attached key={this.props.title}>
658
- {this.props.title}
659
- </Segment>
660
- )}
661
- <Tab
662
- menu={{
663
- secondary: true,
664
- pointing: true,
665
- attached: true,
666
- tabular: true,
667
- className: 'formtabs',
668
- vertical: settings.verticalFormTabs,
669
- }}
670
- grid={{ paneWidth: 9, tabWidth: 3, stackable: true }}
671
- onTabChange={this.onTabChange}
672
- activeIndex={this.state.activeIndex}
673
- panes={map(schema.fieldsets, (item) => ({
674
- menuItem: item.title,
675
- render: () => [
676
- !settings.verticalFormTabs && this.props.title && (
677
- <Segment secondary attached key={this.props.title}>
678
- {this.props.title}
679
- </Segment>
680
- ),
681
- item.description && (
682
- <Message attached="bottom">
683
- {item.description}
684
- </Message>
685
- ),
686
- ...map(item.fields, (field, index) => (
687
- <Field
688
- {...schema.properties[field]}
689
- id={field}
690
- formData={this.state.formData}
691
- fieldSet={item.title.toLowerCase()}
692
- focus={index === 0}
693
- value={this.state.formData?.[field]}
694
- required={schema.required.indexOf(field) !== -1}
695
- onChange={this.onChangeField}
696
- onBlur={this.onBlurField}
697
- onClick={this.onClickInput}
698
- key={field}
699
- error={this.state.errors[field]}
700
- />
701
- )),
702
- ],
703
- }))}
704
- />
705
- </>
706
- )}
707
- {schema && schema.fieldsets.length === 1 && (
708
- <Segment>
709
- {this.props.title && (
710
- <Segment className="primary">
711
- <h1 style={{ fontSize: '16px' }}> {this.props.title}</h1>
712
- </Segment>
713
- )}
714
- {this.props.description && (
715
- <Segment secondary>{this.props.description}</Segment>
716
- )}
717
- {keys(this.state.errors).length > 0 && (
718
- <Message
719
- icon="warning"
720
- negative
721
- attached
722
- header={this.props.intl.formatMessage(messages.error)}
723
- content={this.props.intl.formatMessage(
724
- messages.thereWereSomeErrors,
725
- )}
726
- />
727
- )}
728
- {this.props.error && (
729
- <Message
730
- icon="warning"
731
- negative
732
- attached
733
- header={this.props.intl.formatMessage(messages.error)}
734
- content={this.props.error.message}
735
- />
736
- )}
737
- {map(schema.fieldsets[0].fields, (field) => (
738
- <Field
739
- {...schema.properties[field]}
740
- id={field}
741
- value={this.state.formData?.[field]}
742
- required={schema.required.indexOf(field) !== -1}
743
- onChange={this.onChangeField}
744
- onBlur={this.onBlurField}
745
- onClick={this.onClickInput}
746
- key={field}
747
- error={this.state.errors[field]}
748
- />
749
- ))}
750
- </Segment>
751
- )}
752
- {!this.props.hideActions && (
753
- <Segment className="actions" clearing>
754
- {onSubmit && (
755
- <Button
756
- basic
757
- primary
758
- floated="right"
759
- type="submit"
760
- aria-label={
761
- this.props.submitLabel
762
- ? this.props.submitLabel
763
- : this.props.intl.formatMessage(messages.save)
764
- }
765
- title={
766
- this.props.submitLabel
767
- ? this.props.submitLabel
768
- : this.props.intl.formatMessage(messages.save)
769
- }
770
- loading={this.props.loading}
771
- >
772
- <Icon className="circled" name={aheadSVG} size="30px" />
773
- </Button>
774
- )}
775
- {onCancel && (
776
- <Button
777
- basic
778
- secondary
779
- aria-label={this.props.intl.formatMessage(
780
- messages.cancel,
781
- )}
782
- title={this.props.intl.formatMessage(messages.cancel)}
783
- floated="right"
784
- onClick={this.onCancel}
785
- >
786
- <Icon className="circled" name={clearSVG} size="30px" />
787
- </Button>
788
- )}
789
- </Segment>
790
- )}
791
- </Segment.Group>
792
- </fieldset>
793
- </UiForm>
794
- </Container>
795
- );
796
- }
797
- }
798
-
799
- const FormIntl = injectIntl(Form, { forwardRef: true });
800
-
801
- export default compose(
802
- connect(null, { setSidebarTab }, null, { forwardRef: true }),
803
- )(FormIntl);