@capillarytech/creatives-library 2.0.82 → 2.0.83
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/components/CapTagList/index.js +24 -21
- package/components/CardGrid/index.js +10 -16
- package/components/Ckeditor/index.js +1 -2
- package/components/CustomPopOver/index.js +1 -1
- package/components/EmailPreview/index.js +2 -3
- package/components/FormBuilder/_formBuilder.scss +15 -8
- package/components/FormBuilder/index.js +194 -260
- package/components/Header/index.js +1 -4
- package/components/PreviewSideBar/_previewsidebar.scss +1 -1
- package/components/PreviewSideBar/index.js +5 -3
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +3 -2
- package/components/TemplatePreview/_templatePreview.scss +1 -1
- package/components/TemplatePreview/index.js +47 -47
- package/components/TemplatePreview/messages.js +1 -9
- package/containers/Assets/Gallery/index.js +1 -1
- package/containers/Email/index.js +1 -1
- package/containers/Login/components/LoginForm/index.js +1 -1
- package/containers/Templates/index.js +1 -1
- package/containers/WeChat/RichmediaTemplates/Create/index.js +1 -1
- package/package.json +2 -1
- package/v2Components/BreadCrumbs/index.js +65 -0
- package/v2Components/BreadCrumbs/messages.js +13 -0
- package/v2Components/BreadCrumbs/tests/index.test.js +10 -0
- package/v2Components/CallTaskPreview/_callTaskPreview.scss +17 -0
- package/v2Components/CallTaskPreview/images/Footer.png +0 -0
- package/v2Components/CallTaskPreview/images/Header.png +0 -0
- package/v2Components/CallTaskPreview/index.js +37 -0
- package/v2Components/CallTaskPreview/messages.js +13 -0
- package/v2Components/CallTaskPreview/tests/index.test.js +15 -0
- package/v2Components/CapTagList/index.js +232 -0
- package/v2Components/CapTagList/messages.js +25 -0
- package/v2Components/CapTagList/tests/index.test.js +10 -0
- package/v2Components/Card/_customCard.scss +27 -0
- package/v2Components/Card/index.js +78 -0
- package/{containers/WeChat → v2Components/Card}/tests/index.test.js +2 -2
- package/v2Components/CardGrid/index.js +77 -0
- package/v2Components/CardGrid/tests/index.test.js +10 -0
- package/v2Components/Ckeditor/index.js +234 -0
- package/v2Components/Ckeditor/messages.js +13 -0
- package/v2Components/Ckeditor/tests/index.test.js +10 -0
- package/v2Components/CmsTemplatesComponent/index.js +33 -0
- package/v2Components/CmsTemplatesComponent/messages.js +17 -0
- package/v2Components/CmsTemplatesComponent/tests/index.test.js +10 -0
- package/v2Components/Component/index.js +29 -0
- package/v2Components/Component/tests/index.test.js +10 -0
- package/v2Components/CustomPopOver/index.js +82 -0
- package/v2Components/CustomPopOver/messages.js +13 -0
- package/v2Components/CustomPopOver/tests/index.test.js +10 -0
- package/v2Components/DateFilter/index.js +349 -0
- package/v2Components/DateFilter/messages.js +17 -0
- package/v2Components/DateFilter/tests/index.test.js +15 -0
- package/v2Components/DateRange/index.js +113 -0
- package/v2Components/DateRange/messages.js +13 -0
- package/v2Components/DateRange/tests/index.test.js +10 -0
- package/v2Components/Edmeditor/index.js +65 -0
- package/v2Components/Edmeditor/messages.js +13 -0
- package/v2Components/Edmeditor/tests/index.test.js +10 -0
- package/v2Components/EmailMobilePreview/index.js +129 -0
- package/v2Components/EmailMobilePreview/index.scss +55 -0
- package/v2Components/EmailPreview/_emailPreview.scss +119 -0
- package/v2Components/EmailPreview/index.js +106 -0
- package/v2Components/EmailPreview/messages.js +17 -0
- package/v2Components/EmailPreview/tests/index.test.js +10 -0
- package/v2Components/EmailPreviewV2/_emailPreviewV2.scss +69 -0
- package/v2Components/EmailPreviewV2/index.js +132 -0
- package/v2Components/EmailPreviewV2/messages.js +41 -0
- package/v2Components/EmailPreviewV2/tests/index.test.js +10 -0
- package/v2Components/Footer/index.js +27 -0
- package/v2Components/Footer/messages.js +13 -0
- package/v2Components/Footer/tests/index.test.js +10 -0
- package/v2Components/FormBuilder/_formBuilder.scss +78 -0
- package/v2Components/FormBuilder/index.js +3309 -0
- package/v2Components/FormBuilder/messages.js +13 -0
- package/v2Components/FormBuilder/tests/index.test.js +10 -0
- package/v2Components/Header/index.js +46 -0
- package/v2Components/Header/messages.js +25 -0
- package/v2Components/Header/tests/index.test.js +10 -0
- package/v2Components/ImagePreview/_imagePreview.scss +63 -0
- package/v2Components/ImagePreview/index.js +52 -0
- package/v2Components/ImagePreview/messages.js +13 -0
- package/v2Components/ImagePreview/tests/index.test.js +10 -0
- package/v2Components/MobilePushPreviewV2/index.js +120 -0
- package/v2Components/MobilePushPreviewV2/messages.js +13 -0
- package/v2Components/MobilePushPreviewV2/tests/index.test.js +10 -0
- package/v2Components/NewCallTask/_newCallTask.scss +9 -0
- package/v2Components/NewCallTask/index.js +152 -0
- package/v2Components/NewCallTask/messages.js +29 -0
- package/v2Components/NewCallTask/tests/index.test.js +10 -0
- package/v2Components/PageHeader/_pageHeader.scss +22 -0
- package/v2Components/PageHeader/index.js +37 -0
- package/v2Components/PageHeader/messages.js +13 -0
- package/v2Components/PageHeader/tests/index.test.js +10 -0
- package/v2Components/Pagination/_pagination.scss +5 -0
- package/v2Components/Pagination/index.js +49 -0
- package/v2Components/Pagination/tests/index.test.js +10 -0
- package/v2Components/PreviewSideBar/_previewsidebar.scss +28 -0
- package/v2Components/PreviewSideBar/index.js +150 -0
- package/v2Components/PreviewSideBar/messages.js +33 -0
- package/v2Components/PreviewSideBar/tests/index.test.js +10 -0
- package/v2Components/Sidebar/_sidebar.scss +115 -0
- package/v2Components/Sidebar/index.js +208 -0
- package/v2Components/Sidebar/messages.js +21 -0
- package/v2Components/Sidebar/tests/index.test.js +10 -0
- package/v2Components/SlideBox/_slideBox.scss +63 -0
- package/v2Components/SlideBox/index.js +48 -0
- package/v2Components/SlideBox/tests/index.test.js +103 -0
- package/v2Components/SmsEditor/index.js +55 -0
- package/v2Components/SmsEditor/tests/index.test.js +10 -0
- package/v2Components/SmsTest/index.js +115 -0
- package/v2Components/SmsTest/messages.js +13 -0
- package/v2Components/SmsTest/tests/index.test.js +10 -0
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +42 -0
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +139 -0
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +21 -0
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/tests/index.test.js +10 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +352 -0
- package/v2Components/TemplatePreview/assets/images/WECHAT_5x.png +0 -0
- package/v2Components/TemplatePreview/assets/images/androidPushMessage.svg +45 -0
- package/v2Components/TemplatePreview/assets/images/iPhonePushMessage.svg +135 -0
- package/v2Components/TemplatePreview/assets/images/mobile.svg +24 -0
- package/v2Components/TemplatePreview/assets/images/sms-body.png +0 -0
- package/v2Components/TemplatePreview/assets/images/sms-icon.png +0 -0
- package/v2Components/TemplatePreview/assets/images/sms_mobile.png +0 -0
- package/v2Components/TemplatePreview/assets/images/user-icon.svg +19 -0
- package/v2Components/TemplatePreview/assets/images/wechat-mobile.svg +78 -0
- package/v2Components/TemplatePreview/index.js +175 -0
- package/v2Components/TemplatePreview/messages.js +37 -0
- package/v2Components/TemplatePreview/tests/index.test.js +10 -0
- package/v2Components/Toastr/index.js +60 -0
- package/v2Components/Toastr/messages.js +13 -0
- package/v2Components/Toastr/tests/index.test.js +10 -0
- package/v2Components/ToastrMessage/index.js +110 -0
- package/v2Components/ToastrMessage/messages.js +13 -0
- package/v2Components/ToastrMessage/tests/index.test.js +10 -0
- package/v2Components/TopBar/_topbar.scss +46 -0
- package/v2Components/TopBar/assets/images/capillary_logo.png +0 -0
- package/v2Components/TopBar/index.js +113 -0
- package/v2Components/TopBar/messages.js +29 -0
- package/v2Components/TopBar/tests/index.test.js +10 -0
- package/v2Containers/Assets/Gallery/index.js +1 -1
- package/v2Containers/CallTask/index.js +1 -1
- package/v2Containers/Cap/index.js +2 -2
- package/v2Containers/CreativesContainer/SlideBoxContent.js +3 -3
- package/v2Containers/CreativesContainer/index.js +1 -0
- package/v2Containers/Dashboard/index.js +2 -2
- package/v2Containers/Ebill/index.js +2 -2
- package/v2Containers/Email/index.js +4 -4
- package/v2Containers/EmailWrapper/index.js +1 -1
- package/v2Containers/Line/Create/index.js +1 -1
- package/v2Containers/Line/Edit/index.js +1 -1
- package/v2Containers/Login/index.js +1 -1
- package/v2Containers/MobilePush/Create/index.js +1 -1
- package/v2Containers/MobilePush/Edit/index.js +1 -1
- package/v2Containers/Sms/Create/index.js +1 -1
- package/v2Containers/Sms/Edit/index.js +1 -1
- package/v2Containers/TagList/index.js +1 -1
- package/v2Containers/Templates/index.js +4 -4
- package/v2Containers/TestPage/index.js +1 -1
- package/v2Containers/WeChat/MapTemplates/index.js +3 -3
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +3 -3
- package/containers/WeChat/_wechat.scss +0 -8
- package/containers/WeChat/actions.js +0 -46
- package/containers/WeChat/constants.js +0 -28
- package/containers/WeChat/index.js +0 -1617
- package/containers/WeChat/messages.js +0 -73
- package/containers/WeChat/reducer.js +0 -74
- package/containers/WeChat/sagas.js +0 -86
- package/containers/WeChat/selectors.js +0 -25
- package/containers/WeChat/tests/actions.test.js +0 -18
- package/containers/WeChat/tests/reducer.test.js +0 -9
- package/containers/WeChat/tests/sagas.test.js +0 -15
- package/containers/WeChat/tests/selectors.test.js +0 -10
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-case-declarations */
|
|
2
1
|
|
|
3
2
|
/**
|
|
4
3
|
*
|
|
@@ -11,10 +10,10 @@ import PropTypes from 'prop-types';
|
|
|
11
10
|
import React from 'react';
|
|
12
11
|
import { Label } from 'semantic-ui-react';
|
|
13
12
|
import _ from 'lodash';
|
|
14
|
-
import { Tabs, Table, Modal} from 'antd';
|
|
15
|
-
import { CapButton, CapInput, CapPopover, CapCheckbox, CapRadio, CapSelect, CapTable,
|
|
16
|
-
import LabelHOC from '@capillarytech/cap-ui-library/assets/HOCs/ComponentWithLabelHOC';
|
|
13
|
+
import { Tabs, Row, Col, Table, Modal, notification} from 'antd';
|
|
14
|
+
import { CapButton, CapInput, CapPopover, CapTextArea, CapCheckbox, CapRadio, CapRadioGroup, CapSelect, CapTable, CapColumn} from '@capillarytech/cap-react-ui-library';
|
|
17
15
|
import TemplatePreview from '../../components/TemplatePreview';
|
|
16
|
+
// import { CapCheckbox } from '@capillarytech/cap-react-ui-library/basic/checkbox';
|
|
18
17
|
import TagList from '../../containers/TagList';
|
|
19
18
|
import SmsEditor from '../SmsEditor';
|
|
20
19
|
import SlideBox from '../SlideBox';
|
|
@@ -26,17 +25,11 @@ import './_formBuilder.scss';
|
|
|
26
25
|
import {updateCharCount, checkUnicode} from "../../utils/smsCharCountV2";
|
|
27
26
|
const TabPane = Tabs.TabPane;
|
|
28
27
|
const {Column} = Table;
|
|
29
|
-
const {TextArea} = CapInput;
|
|
30
|
-
const {CapRadioGroup} = CapRadio;
|
|
31
28
|
// import styled from 'styled-components';
|
|
32
29
|
|
|
33
30
|
// import { FormattedMessage } from 'react-intl';
|
|
34
31
|
// import messages from './messages';
|
|
35
|
-
|
|
36
|
-
// eslint-disable-next-line no-useless-escape
|
|
37
|
-
const res = str.match(/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g);
|
|
38
|
-
return res;
|
|
39
|
-
};
|
|
32
|
+
|
|
40
33
|
class FormBuilder extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
41
34
|
constructor(props) {
|
|
42
35
|
super(props);
|
|
@@ -104,7 +97,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
104
97
|
|
|
105
98
|
componentWillReceiveProps(nextProps) {
|
|
106
99
|
const type = this.props.location.query.type;
|
|
107
|
-
const isLibraryModule = this.props.location.query.module === "library";
|
|
108
100
|
if (this.state.usingTabContainer && nextProps.tabCount !== this.props.tabCount) {
|
|
109
101
|
this.setState({tabCount: nextProps.tabCount});
|
|
110
102
|
}
|
|
@@ -123,7 +115,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
123
115
|
// }
|
|
124
116
|
if (nextProps.isEdit) {
|
|
125
117
|
if (!_.isEqual(nextProps.formData, this.state.formData) && !_.isEmpty(nextProps.formData)) {
|
|
126
|
-
if (type === 'embedded'
|
|
118
|
+
if (type === 'embedded') { //TODO: has to be checked and changed.
|
|
127
119
|
this.setState({checkValidation: true, formData: nextProps.formData}, () => {
|
|
128
120
|
this.validateForm();
|
|
129
121
|
});
|
|
@@ -255,7 +247,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
255
247
|
}
|
|
256
248
|
}
|
|
257
249
|
|
|
258
|
-
onEdit() {
|
|
250
|
+
onEdit(data, e) {
|
|
259
251
|
|
|
260
252
|
}
|
|
261
253
|
|
|
@@ -306,15 +298,16 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
306
298
|
return modal;
|
|
307
299
|
};
|
|
308
300
|
|
|
309
|
-
openNotificationWithIcon = (type, message
|
|
310
|
-
|
|
311
|
-
|
|
301
|
+
openNotificationWithIcon = (type, message) => {
|
|
302
|
+
const dur = (type === 'error' || type === 'warning') ? null : 5;
|
|
303
|
+
notification[type]({
|
|
312
304
|
message: (`${type.toUpperCase()} ! ! ! `),
|
|
313
305
|
description: message, //'This is the content of the notification. This is the content of the notification. This is the content of the notification.',
|
|
306
|
+
duration: dur,
|
|
314
307
|
});
|
|
315
308
|
}
|
|
316
309
|
|
|
317
|
-
handleCloseModal = () => {
|
|
310
|
+
handleCloseModal = (data, e) => {
|
|
318
311
|
const event = this.state.currentEvent;
|
|
319
312
|
if (!_.isEmpty(this.state.currentEvent)) {
|
|
320
313
|
switch (event) {
|
|
@@ -414,13 +407,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
414
407
|
});
|
|
415
408
|
}
|
|
416
409
|
}
|
|
417
|
-
|
|
418
|
-
if (key in obj) {
|
|
419
|
-
const url = _.get(obj, key);
|
|
420
|
-
return (url && url !== "" && isUrl(url));
|
|
421
|
-
}
|
|
422
|
-
return true;
|
|
423
|
-
}
|
|
410
|
+
|
|
424
411
|
/* eslint-disable */
|
|
425
412
|
validateForm(tags, injectedTags, isSave, showMessages) {
|
|
426
413
|
|
|
@@ -443,10 +430,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
443
430
|
const unicodeCheck = this.state.formData[count][`unicode-validity${index > 1 ? index : ''}`];
|
|
444
431
|
const ifUnicode = content && content !== '' ? checkUnicode(content) : false;
|
|
445
432
|
|
|
446
|
-
|
|
447
|
-
if (content) {
|
|
448
|
-
tagValidationResponse = this.validateTags(content, tags, injectedTags);
|
|
449
|
-
}
|
|
433
|
+
const tagValidationResponse = this.validateTags(content, tags, injectedTags);
|
|
450
434
|
|
|
451
435
|
if (tagValidationResponse.valid) {
|
|
452
436
|
errorData[count][`sms-editor${index > 1 ? index : ''}`] = false;
|
|
@@ -571,66 +555,50 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
571
555
|
_.forEach(this.state.formData, (tab, index) => {
|
|
572
556
|
let isCurrentTabValid = true;
|
|
573
557
|
let skipValidation = false;
|
|
574
|
-
if (type.toLowerCase() === 'embedded' && ((isOnlyAndroid && parseInt(index) === 1) || (isOnlyIos && parseInt(index) === 0))
|
|
575
|
-
// skip validation of the tab which is not open in embedded mode
|
|
558
|
+
if (type.toLowerCase() === 'embedded' && ((isOnlyAndroid && parseInt(index) === 1) || (isOnlyIos && parseInt(index) === 0))) {
|
|
576
559
|
skipValidation = true;
|
|
577
560
|
}
|
|
578
561
|
if (!isNaN(index) && tab && !skipValidation) {
|
|
579
562
|
const selector = index > 0 ? `${Number(index) + 1}` : '';
|
|
580
563
|
let message = tab[`message-editor${selector}`];
|
|
581
564
|
|
|
582
|
-
|
|
583
|
-
if (message) {
|
|
584
|
-
message = message.trim();
|
|
585
|
-
|
|
586
|
-
if (message === "") {
|
|
587
|
-
errorData[parseInt(index)][`message-editor${selector}`] = true;
|
|
588
|
-
isValid = false;
|
|
589
|
-
isCurrentTabValid = false;
|
|
590
|
-
} else {
|
|
591
|
-
errorData[parseInt(index)][`message-editor${selector}`] = false;
|
|
592
|
-
const tagValidationResponse = this.validateTags(message, tags, injectedTags);
|
|
593
|
-
|
|
594
|
-
if (tagValidationResponse.valid) {
|
|
595
|
-
errorData[parseInt(index)][`message-editor${selector}`] = false;
|
|
596
|
-
} else {
|
|
597
|
-
errorData[parseInt(index)][`message-editor${selector}`] = true;
|
|
598
|
-
errorData[parseInt(index)]['invalid-tags'] = tagValidationResponse.unsupportedTags;
|
|
599
|
-
isValid = false;
|
|
600
|
-
}
|
|
601
|
-
}
|
|
565
|
+
message = message.trim();
|
|
602
566
|
|
|
567
|
+
if (errorData[parseInt(index)]) {
|
|
568
|
+
if (message === "") {
|
|
569
|
+
errorData[parseInt(index)][`message-editor${selector}`] = true;
|
|
570
|
+
isValid = false;
|
|
571
|
+
isCurrentTabValid = false;
|
|
603
572
|
} else {
|
|
573
|
+
errorData[parseInt(index)][`message-editor${selector}`] = false;
|
|
574
|
+
const tagValidationResponse = this.validateTags(message, tags, injectedTags);
|
|
575
|
+
|
|
576
|
+
if (tagValidationResponse.valid) {
|
|
577
|
+
errorData[parseInt(index)][`message-editor${selector}`] = false;
|
|
578
|
+
} else {
|
|
604
579
|
errorData[parseInt(index)][`message-editor${selector}`] = true;
|
|
605
580
|
isValid = false;
|
|
606
|
-
|
|
581
|
+
}
|
|
607
582
|
}
|
|
608
|
-
|
|
609
|
-
|
|
610
583
|
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
if (title === "") {
|
|
615
|
-
errorData[parseInt(index)][`message-title${selector}`] = true;
|
|
616
|
-
isValid = false;
|
|
617
|
-
isCurrentTabValid = false;
|
|
618
|
-
} else {
|
|
619
|
-
errorData[parseInt(index)][`message-title${selector}`] = false;
|
|
620
|
-
const tagValidationResponse = this.validateTags(title, tags, injectedTags);
|
|
621
|
-
|
|
622
|
-
if (tagValidationResponse.valid) {
|
|
623
|
-
errorData[parseInt(index)][`message-title${selector}`] = false;
|
|
624
|
-
} else {
|
|
625
|
-
errorData[parseInt(index)][`message-title${selector}`] = true;
|
|
626
|
-
isValid = false;
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
} else {
|
|
584
|
+
|
|
585
|
+
const title = tab[`message-title${selector}`].trim();
|
|
586
|
+
if (title === "") {
|
|
630
587
|
errorData[parseInt(index)][`message-title${selector}`] = true;
|
|
631
588
|
isValid = false;
|
|
632
589
|
isCurrentTabValid = false;
|
|
590
|
+
} else {
|
|
591
|
+
errorData[parseInt(index)][`message-title${selector}`] = false;
|
|
592
|
+
const tagValidationResponse = this.validateTags(title, tags, injectedTags);
|
|
593
|
+
|
|
594
|
+
if (tagValidationResponse.valid) {
|
|
595
|
+
errorData[parseInt(index)][`message-title${selector}`] = false;
|
|
596
|
+
} else {
|
|
597
|
+
errorData[parseInt(index)][`message-title${selector}`] = true;
|
|
598
|
+
isValid = false;
|
|
599
|
+
}
|
|
633
600
|
}
|
|
601
|
+
|
|
634
602
|
// if(tab['primary-cta-link'].trim() === ""){
|
|
635
603
|
// errorData[parseInt(index)][`primary-cta-link`] = true;
|
|
636
604
|
// isValid = false;
|
|
@@ -652,15 +620,15 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
652
620
|
errorData[parseInt(index)]['cta-deeplink2-select'] = false;
|
|
653
621
|
}
|
|
654
622
|
// }
|
|
655
|
-
if(
|
|
623
|
+
if(tab[`cta-deeplink-text`] === ""){
|
|
656
624
|
errorData[parseInt(index)][`cta-deeplink-text`] = true;
|
|
657
625
|
isValid = false;
|
|
658
626
|
isCurrentTabValid = false;
|
|
659
627
|
}else {
|
|
660
628
|
errorData[parseInt(index)]['cta-deeplink-text'] = false;
|
|
661
629
|
}
|
|
662
|
-
|
|
663
|
-
if(
|
|
630
|
+
|
|
631
|
+
if(tab['cta-deeplink2-text'] === ""){
|
|
664
632
|
errorData[parseInt(index)][`cta-deeplink2-text`] = true;
|
|
665
633
|
isValid = false;
|
|
666
634
|
isCurrentTabValid = false;
|
|
@@ -683,9 +651,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
683
651
|
}else {
|
|
684
652
|
errorData[parseInt(index)]['secondary-cta-0-label'] = false;
|
|
685
653
|
}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
if(!this.isValidExternalLink({obj: tab, key: 'cta-deeplink-secondary-cta-0-text'})){
|
|
654
|
+
if(tab['cta-deeplink-secondary-cta-0-text'] === ""){
|
|
689
655
|
errorData[parseInt(index)][`cta-deeplink-secondary-cta-0-text`] = true;
|
|
690
656
|
isValid = false;
|
|
691
657
|
isCurrentTabValid = false;
|
|
@@ -706,8 +672,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
706
672
|
}else {
|
|
707
673
|
errorData[parseInt(index)]['secondary-cta-1-label'] = false;
|
|
708
674
|
}
|
|
709
|
-
|
|
710
|
-
if(!this.isValidExternalLink({obj: tab, key: 'cta-deeplink-secondary-cta-1-text'})){
|
|
675
|
+
if(tab['cta-deeplink-secondary-cta-1-text'] === ""){
|
|
711
676
|
errorData[parseInt(index)][`cta-deeplink-secondary-cta-1-text`] = true;
|
|
712
677
|
isValid = false;
|
|
713
678
|
isCurrentTabValid = false;
|
|
@@ -721,8 +686,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
721
686
|
}else {
|
|
722
687
|
errorData[parseInt(index)]['cta-deeplink-secondary-cta-1-select'] = false;
|
|
723
688
|
}
|
|
724
|
-
|
|
725
|
-
if(!this.isValidExternalLink({obj: tab, key: 'cta-deeplink-secondary-cta-1-text2'})){
|
|
689
|
+
if(tab['cta-deeplink-secondary-cta-1-text2'] === ""){
|
|
726
690
|
errorData[parseInt(index)][`cta-deeplink-secondary-cta-1-text2`] = true;
|
|
727
691
|
isValid = false;
|
|
728
692
|
isCurrentTabValid = false;
|
|
@@ -829,7 +793,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
829
793
|
}
|
|
830
794
|
// Check if template subject present in form data from Loyalty, DVS, Timeline
|
|
831
795
|
if (index === 'template-subject' && type.toLowerCase() === 'embedded' && (currentModule.toLowerCase() === 'loyalty' || currentModule.toLowerCase() === 'dvs' || currentModule.toLowerCase() === 'timeline' || currentModule.toLowerCase() === 'library')) {
|
|
832
|
-
if (data
|
|
796
|
+
if (data.trim() === '') {
|
|
833
797
|
errorData[index] = true;
|
|
834
798
|
isValid = false;
|
|
835
799
|
} else {
|
|
@@ -886,7 +850,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
886
850
|
}
|
|
887
851
|
}
|
|
888
852
|
if (errorString !== "") {
|
|
889
|
-
this.openNotificationWithIcon('error', errorString
|
|
853
|
+
this.openNotificationWithIcon('error', errorString);
|
|
890
854
|
}
|
|
891
855
|
_.forEach(errorData[index], (versionData, key) => {
|
|
892
856
|
if (data.selectedLanguages.indexOf(key) === -1) {
|
|
@@ -922,7 +886,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
922
886
|
}
|
|
923
887
|
this.setState({isFormValid : isValid, errorData});
|
|
924
888
|
|
|
925
|
-
this.props.onFormValidityChange(isValid
|
|
889
|
+
this.props.onFormValidityChange(isValid);
|
|
926
890
|
return isValid;
|
|
927
891
|
}
|
|
928
892
|
|
|
@@ -1104,7 +1068,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1104
1068
|
this.setState({errorData});
|
|
1105
1069
|
}
|
|
1106
1070
|
|
|
1107
|
-
initializeMultiColSection(section, formDataObj, isContainer, index, ifError) {
|
|
1071
|
+
initializeMultiColSection(section, formDataObj, isContainer, index, ifError, paneIndex) {
|
|
1108
1072
|
const formData = _.cloneDeep(formDataObj);
|
|
1109
1073
|
const newFormData = {};
|
|
1110
1074
|
newFormData[index] = {};
|
|
@@ -1166,7 +1130,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1166
1130
|
}
|
|
1167
1131
|
}
|
|
1168
1132
|
if (col.type === 'checkbox') {
|
|
1169
|
-
if (isContainer
|
|
1133
|
+
if (isContainer) {
|
|
1170
1134
|
formData[index][col.id] = false;
|
|
1171
1135
|
} else if (!isContainer && formData[col.id] === undefined) {
|
|
1172
1136
|
formData[col.id] = false;
|
|
@@ -1618,10 +1582,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1618
1582
|
}
|
|
1619
1583
|
|
|
1620
1584
|
deleteLanguage = () => {
|
|
1621
|
-
|
|
1585
|
+
if (this.state.formData[`${this.state.currentTab - 1}`].activeTab === this.props.baseLanguage) {
|
|
1622
1586
|
|
|
1623
|
-
|
|
1624
|
-
if (this.state.formData[`${this.state.currentTab - 1}`].activeTab !== this.props.baseLanguage) {
|
|
1587
|
+
} else {
|
|
1625
1588
|
const formData = _.cloneDeep(this.state.formData);
|
|
1626
1589
|
const currentTab = `${this.state.currentTab - 1}`;
|
|
1627
1590
|
const currentLang = formData[`${this.state.currentTab - 1}`].activeTab;
|
|
@@ -1781,9 +1744,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1781
1744
|
|
|
1782
1745
|
|
|
1783
1746
|
this.setState({formData}, () => {
|
|
1784
|
-
|
|
1785
|
-
this.validateForm();
|
|
1786
|
-
}
|
|
1747
|
+
this.validateForm();
|
|
1787
1748
|
});
|
|
1788
1749
|
if (event && val.injectedEvents[event]) {
|
|
1789
1750
|
if (event === "onRowClick") {
|
|
@@ -1803,7 +1764,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1803
1764
|
}
|
|
1804
1765
|
|
|
1805
1766
|
if (!((event === 'onSelect' && data === 'New Version') || event === 'onContentChange')) {
|
|
1806
|
-
this.props.onChange(formData, this.state.tabCount, currentTab
|
|
1767
|
+
this.props.onChange(formData, this.state.tabCount, currentTab);
|
|
1807
1768
|
}
|
|
1808
1769
|
}
|
|
1809
1770
|
|
|
@@ -1841,7 +1802,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1841
1802
|
}
|
|
1842
1803
|
return true;
|
|
1843
1804
|
};
|
|
1844
|
-
callChildEvent(data, val, event) {
|
|
1805
|
+
callChildEvent(data, val, event, e) {
|
|
1845
1806
|
if (!event) {
|
|
1846
1807
|
return;
|
|
1847
1808
|
}
|
|
@@ -1854,7 +1815,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1854
1815
|
if (this.props.isNewVersionFlow) {
|
|
1855
1816
|
const formData = _.cloneDeep(this.state.formData);
|
|
1856
1817
|
let activeTabIndex = '1';
|
|
1857
|
-
const elems = document.
|
|
1818
|
+
const elems = document.getElementsByClassName("ant-tabs-tab");
|
|
1858
1819
|
|
|
1859
1820
|
for (let i = 0; i < elems.length; i += 1) {
|
|
1860
1821
|
if (elems.item(i).classList.contains("ant-tabs-tab-active")) {
|
|
@@ -1874,7 +1835,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1874
1835
|
});
|
|
1875
1836
|
} else {
|
|
1876
1837
|
let activeTabIndex = '1';
|
|
1877
|
-
const elems = document.
|
|
1838
|
+
const elems = document.getElementsByClassName("ant-tabs-tab");
|
|
1878
1839
|
|
|
1879
1840
|
for (let i = 0; i < elems.length; i += 1) {
|
|
1880
1841
|
if (elems.item(i).classList.contains("ant-tabs-tab-active")) {
|
|
@@ -1993,12 +1954,11 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1993
1954
|
// }
|
|
1994
1955
|
return;
|
|
1995
1956
|
}
|
|
1996
|
-
|
|
1957
|
+
|
|
1997
1958
|
// val.injectedEvents[event].call(this.props.parent, data);
|
|
1998
1959
|
val.injectedEvents[event].call(this.props.parent, data, val.id);
|
|
1999
1960
|
}
|
|
2000
1961
|
openFileDialog = (e, parentID) => {
|
|
2001
|
-
console.log("filedialog: ");
|
|
2002
1962
|
document.querySelector(`#${parentID} #fileName`).click();
|
|
2003
1963
|
};
|
|
2004
1964
|
handleOk = (ev) => {
|
|
@@ -2079,7 +2039,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2079
2039
|
const fileParams = {
|
|
2080
2040
|
width: this.width,
|
|
2081
2041
|
height: this.height,
|
|
2082
|
-
error: file.size / (1e+6) >
|
|
2042
|
+
error: file.size / (1e+6) > 5,
|
|
2083
2043
|
};
|
|
2084
2044
|
this.callChildEvent({file, type: 'image', fileParams}, val, val.submitAction);
|
|
2085
2045
|
};
|
|
@@ -2124,7 +2084,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2124
2084
|
if (this.props.schema.channel.toLowerCase() === 'email') {
|
|
2125
2085
|
//
|
|
2126
2086
|
const imgSrc = template && template.versions && template.versions.base ? template.versions.base.preview_http_url : '';
|
|
2127
|
-
|
|
2087
|
+
const ifPreviewGenerated = template && template.versions && template.versions.base ? template.versions.base.isPreviewGenerated : 0;
|
|
2128
2088
|
const content = <img src={imgSrc || ''} alt="" />;
|
|
2129
2089
|
|
|
2130
2090
|
temp.content = (
|
|
@@ -2178,9 +2138,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2178
2138
|
}
|
|
2179
2139
|
//
|
|
2180
2140
|
columns.push(
|
|
2181
|
-
<
|
|
2141
|
+
<Col key="label" span={4}>
|
|
2182
2142
|
<Label style={val.labelStyle ? val.labelStyle : {}}>{val.label}</Label>
|
|
2183
|
-
</
|
|
2143
|
+
</Col>
|
|
2184
2144
|
);
|
|
2185
2145
|
let ifError = false;
|
|
2186
2146
|
const isVersionEnable = (this.state.usingTabContainer && !val.standalone);
|
|
@@ -2192,9 +2152,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2192
2152
|
}
|
|
2193
2153
|
}
|
|
2194
2154
|
columns.push(
|
|
2195
|
-
<
|
|
2155
|
+
<Col key={val.id} span={val.width}>
|
|
2196
2156
|
{this.renderPrimitiveElement(val, childIndex)}
|
|
2197
|
-
</
|
|
2157
|
+
</Col>
|
|
2198
2158
|
);
|
|
2199
2159
|
return true;
|
|
2200
2160
|
}
|
|
@@ -2204,57 +2164,55 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2204
2164
|
case "input":
|
|
2205
2165
|
if (styling === 'semantic') {
|
|
2206
2166
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2207
|
-
|
|
2167
|
+
|
|
2208
2168
|
columns.push(
|
|
2209
|
-
<
|
|
2169
|
+
<Col key={val.id} span={val.width}>
|
|
2210
2170
|
<CapInput
|
|
2211
2171
|
id={val.id}
|
|
2212
|
-
errorMessage={val.errorMessage
|
|
2172
|
+
errorMessage={val.errorMessage ? val.errorMessage : ''}
|
|
2213
2173
|
className={`input-primary chart-name-input${ifError ? ' error' : ''}`}
|
|
2214
2174
|
// fluid={val.fluid}
|
|
2215
2175
|
style={val.style ? val.style : {}}
|
|
2216
2176
|
placeholder={val.placeholder}
|
|
2217
2177
|
onChange={(e) => this.updateFormData(e.target.value, val)}
|
|
2218
2178
|
defaultValue={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2219
|
-
value={
|
|
2179
|
+
value={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2220
2180
|
disabled={val.disabled}
|
|
2221
2181
|
/>
|
|
2222
|
-
</
|
|
2182
|
+
</Col>
|
|
2223
2183
|
);
|
|
2224
2184
|
}
|
|
2225
2185
|
break;
|
|
2226
2186
|
case "SmsEditor":
|
|
2227
2187
|
columns.push(
|
|
2228
|
-
<
|
|
2188
|
+
<Col span={5} key="input">
|
|
2229
2189
|
<SmsEditor
|
|
2230
2190
|
id={val.id}
|
|
2231
2191
|
content={this.state.formData[val.id]}
|
|
2232
2192
|
onDataChange={(data) => this.updateFormData(data.value, val)}
|
|
2233
2193
|
/>
|
|
2234
|
-
</
|
|
2194
|
+
</Col>
|
|
2235
2195
|
);
|
|
2236
2196
|
break;
|
|
2237
2197
|
case "textarea":
|
|
2238
2198
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2239
|
-
const value = isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id];
|
|
2240
2199
|
if (styling === 'semantic') {
|
|
2241
2200
|
columns.push(
|
|
2242
|
-
<
|
|
2243
|
-
<
|
|
2201
|
+
<Col key="input" span={val.width}>
|
|
2202
|
+
<CapTextArea
|
|
2244
2203
|
id={val.id}
|
|
2245
2204
|
className={`${ifError ? 'error' : ''}`}
|
|
2246
|
-
errorMessage={val.errorMessage
|
|
2247
|
-
label={val.label}
|
|
2205
|
+
errorMessage={val.errorMessage ? val.errorMessage : ''}
|
|
2248
2206
|
autosize={val.autosize ? val.autosizeParams : false}
|
|
2249
2207
|
onChange={(e) => this.updateFormData(e.target.value, val)}
|
|
2250
2208
|
style={val.style ? val.style : {}}
|
|
2251
2209
|
defaultValue={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2252
|
-
value={
|
|
2210
|
+
value={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2253
2211
|
rows={20}
|
|
2254
2212
|
disabled={val.disabled}
|
|
2255
2213
|
cols={20}
|
|
2256
2214
|
/>
|
|
2257
|
-
</
|
|
2215
|
+
</Col>
|
|
2258
2216
|
);
|
|
2259
2217
|
}
|
|
2260
2218
|
break;
|
|
@@ -2269,23 +2227,23 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2269
2227
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2270
2228
|
if (styling === 'semantic') {
|
|
2271
2229
|
columns.push(
|
|
2272
|
-
<
|
|
2230
|
+
<Col key="input" span={val.width} offset={val.offset}>
|
|
2273
2231
|
<CapCheckbox
|
|
2274
2232
|
className={`${ifError ? 'error' : ''}`}
|
|
2275
|
-
errorMessage={val.errorMessage
|
|
2233
|
+
errorMessage={val.errorMessage ? val.errorMessage : ''}
|
|
2276
2234
|
style={val.style ? val.style : {}}
|
|
2277
2235
|
onChange={(e) => this.updateFormData(e, val)}
|
|
2278
2236
|
checked={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2279
2237
|
defaultChecked={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2280
2238
|
disabled={val.disabled}
|
|
2281
2239
|
/>
|
|
2282
|
-
</
|
|
2240
|
+
</Col>
|
|
2283
2241
|
);
|
|
2284
2242
|
}
|
|
2285
2243
|
break;
|
|
2286
2244
|
case "tag-list":
|
|
2287
2245
|
columns.push(
|
|
2288
|
-
<
|
|
2246
|
+
<Col key={`input-${val.id}`} span={10} offset={val.offset}>
|
|
2289
2247
|
<TagList
|
|
2290
2248
|
key={`input-${val.id}`}
|
|
2291
2249
|
moduleFilterEnabled={this.props.location && this.props.location.query && this.props.location.query.type !== 'embedded'}
|
|
@@ -2299,16 +2257,16 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2299
2257
|
id={val.id}
|
|
2300
2258
|
userLocale={this.props.userLocale}
|
|
2301
2259
|
/>
|
|
2302
|
-
</
|
|
2260
|
+
</Col>
|
|
2303
2261
|
);
|
|
2304
2262
|
break;
|
|
2305
2263
|
case "tabs":
|
|
2306
2264
|
columns.push(
|
|
2307
|
-
<
|
|
2265
|
+
<Col key="input" span={10}>
|
|
2308
2266
|
<TagList
|
|
2309
2267
|
onTagSelect={(data) => this.callChildEvent(data, val, 'onTagSelect')}
|
|
2310
2268
|
/>
|
|
2311
|
-
</
|
|
2269
|
+
</Col>
|
|
2312
2270
|
);
|
|
2313
2271
|
break;
|
|
2314
2272
|
case "sms-preview": {
|
|
@@ -2318,7 +2276,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2318
2276
|
content = isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][`sms-editor${this.state.currentTab > 1 ? this.state.currentTab : ''}`] : this.state.formData[val.id];
|
|
2319
2277
|
const unicodeEnabled = isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][`unicode-validity${this.state.currentTab > 1 ? this.state.currentTab : ''}`] : this.state.formData['unicode-validity'];
|
|
2320
2278
|
columns.push(
|
|
2321
|
-
<
|
|
2279
|
+
<Col key="input" span={10}>
|
|
2322
2280
|
<TemplatePreview
|
|
2323
2281
|
channel={val.channel ? val.channel : 'SMS'}
|
|
2324
2282
|
content={content}
|
|
@@ -2326,7 +2284,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2326
2284
|
unicodeEnabled={unicodeEnabled}
|
|
2327
2285
|
>
|
|
2328
2286
|
</TemplatePreview>
|
|
2329
|
-
</
|
|
2287
|
+
</Col>
|
|
2330
2288
|
);
|
|
2331
2289
|
break;
|
|
2332
2290
|
}
|
|
@@ -2354,7 +2312,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2354
2312
|
case "select": {
|
|
2355
2313
|
const options = (this.state.formData[`${val.id}-options`]) ? (this.state.formData[`${val.id}-options`]) : val.options;
|
|
2356
2314
|
columns.push(
|
|
2357
|
-
<
|
|
2315
|
+
<Col style={val.colStyle ? val.colStyle : {}} span={val.width}>
|
|
2358
2316
|
<CapSelect
|
|
2359
2317
|
id={val.id}
|
|
2360
2318
|
placeholder={val.placeholder ? val.placeholder : ''}
|
|
@@ -2364,14 +2322,14 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2364
2322
|
value={(this.state.formData[val.id] && this.state.formData[val.id] !== '' ? this.state.formData[val.id] : undefined)}
|
|
2365
2323
|
disabled={val.disabled}
|
|
2366
2324
|
/>
|
|
2367
|
-
</
|
|
2325
|
+
</Col>
|
|
2368
2326
|
);
|
|
2369
2327
|
}
|
|
2370
2328
|
break;
|
|
2371
2329
|
case "ckeditor":
|
|
2372
2330
|
|
|
2373
2331
|
columns.push(
|
|
2374
|
-
<
|
|
2332
|
+
<Col style={val.colStyle ? val.colStyle : {}} span={val.width}>
|
|
2375
2333
|
<CKEditor
|
|
2376
2334
|
id={val.id}
|
|
2377
2335
|
content={(this.state.formData[`${this.state.currentTab - 1}`][val.id] ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : '')}
|
|
@@ -2380,7 +2338,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2380
2338
|
// this.callChildEvent(data, val, 'addVersion', event);
|
|
2381
2339
|
handleContentChange={(event) => this.callChildEvent(event, val, 'onContentChange')}
|
|
2382
2340
|
/>
|
|
2383
|
-
</
|
|
2341
|
+
</Col>
|
|
2384
2342
|
);
|
|
2385
2343
|
break;
|
|
2386
2344
|
case "edmeditor": {
|
|
@@ -2400,13 +2358,13 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2400
2358
|
}
|
|
2401
2359
|
|
|
2402
2360
|
columns.push(
|
|
2403
|
-
<
|
|
2361
|
+
<Col style={val.colStyle ? val.colStyle : {}} span={val.width}>
|
|
2404
2362
|
<EDMEditor
|
|
2405
2363
|
id={val.id}
|
|
2406
2364
|
getEditorInstanse={this.getEditorInstanse}
|
|
2407
2365
|
edmSrc={edmSrc}
|
|
2408
2366
|
/>
|
|
2409
|
-
</
|
|
2367
|
+
</Col>
|
|
2410
2368
|
);
|
|
2411
2369
|
}
|
|
2412
2370
|
break;
|
|
@@ -2414,7 +2372,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2414
2372
|
break;
|
|
2415
2373
|
}
|
|
2416
2374
|
row.push(
|
|
2417
|
-
<
|
|
2375
|
+
<Row>
|
|
2418
2376
|
{
|
|
2419
2377
|
_.forEach(columns, (value) => {
|
|
2420
2378
|
if (value) {
|
|
@@ -2423,7 +2381,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2423
2381
|
return value;
|
|
2424
2382
|
})
|
|
2425
2383
|
}
|
|
2426
|
-
</
|
|
2384
|
+
</Row>
|
|
2427
2385
|
);
|
|
2428
2386
|
|
|
2429
2387
|
fields.push(row);
|
|
@@ -2438,12 +2396,12 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2438
2396
|
case "button":
|
|
2439
2397
|
if (styling === 'semantic' && val.metaType === 'submit-button') {
|
|
2440
2398
|
columns.push(
|
|
2441
|
-
<
|
|
2399
|
+
<Col>
|
|
2442
2400
|
<CapButton
|
|
2443
|
-
onClick={(data) => this.callChildEvent(data, val, val.submitAction)}>
|
|
2401
|
+
onClick={(data) => val.id === 'save-button' ? this.saveForm() : this.callChildEvent(data, val, val.submitAction)}>
|
|
2444
2402
|
{val.value}
|
|
2445
2403
|
</CapButton>
|
|
2446
|
-
</
|
|
2404
|
+
</Col>
|
|
2447
2405
|
);
|
|
2448
2406
|
}
|
|
2449
2407
|
break;
|
|
@@ -2460,10 +2418,10 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2460
2418
|
const cols = [];
|
|
2461
2419
|
section.childSections.map( (childSection) => {
|
|
2462
2420
|
const renderedChildSection = this.renderSection(childSection, childIndex);
|
|
2463
|
-
cols.push(<
|
|
2421
|
+
cols.push(<Col style={childSection.colStyle ? childSection.colStyle : {}}offset={childSection.offset} span={childSection.width}>{renderedChildSection}</Col>);
|
|
2464
2422
|
return true;
|
|
2465
2423
|
});
|
|
2466
|
-
const row = (<
|
|
2424
|
+
const row = (<Row style={section.rowStyle ? section.rowStyle : {}}>
|
|
2467
2425
|
{
|
|
2468
2426
|
_.forEach(cols, (value) => {
|
|
2469
2427
|
if (value) {
|
|
@@ -2472,7 +2430,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2472
2430
|
return value;
|
|
2473
2431
|
})
|
|
2474
2432
|
}
|
|
2475
|
-
</
|
|
2433
|
+
</Row>);
|
|
2476
2434
|
return row;
|
|
2477
2435
|
}
|
|
2478
2436
|
|
|
@@ -2493,24 +2451,21 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2493
2451
|
renderPrimitiveElement(val, childIndex) {
|
|
2494
2452
|
const type = val.type;
|
|
2495
2453
|
const tabName = this.state.formData[childIndex - 1] && this.state.formData[childIndex - 1].name ? this.state.formData[childIndex - 1].name : `${val.value} ${childIndex}`;
|
|
2496
|
-
|
|
2454
|
+
let value = val.dynamicTab ? tabName : val.value;
|
|
2497
2455
|
switch (type) {
|
|
2498
2456
|
case "span":
|
|
2499
2457
|
return <span id={`${val.id}${childIndex > 1 ? childIndex : ''}`}>{val.dynamicTab ? tabName : val.value}</span>;
|
|
2500
2458
|
case "div":
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
children = val.value;
|
|
2459
|
+
if (this.state.formData[`${this.state.currentTab - 1}`] && this.state.formData[`${this.state.currentTab - 1}`][val.id] && this.state.formData[`${this.state.currentTab - 1}`][val.id].trim() !== "") {
|
|
2460
|
+
value = this.state.formData[`${this.state.currentTab - 1}`][val.id];
|
|
2504
2461
|
}
|
|
2505
|
-
const ref = _.get(this, `props.refs[${val.id}]`);
|
|
2506
2462
|
return (<div
|
|
2507
|
-
ref={ref}
|
|
2508
2463
|
className={val.className ? val.className : ''}
|
|
2509
2464
|
id={`${val.id}${childIndex > 1 ? childIndex : ''}`}
|
|
2510
2465
|
onClick={(data) => this.callChildEvent(data, val, val.submitAction)}
|
|
2511
2466
|
style={val.style ? val.style : {}}
|
|
2512
2467
|
onInput={(e) => { e.stopPropagation(); this.callChildEvent(e.target.textContent, val, 'onChange'); }}
|
|
2513
|
-
>{
|
|
2468
|
+
>{value}</div>);
|
|
2514
2469
|
default:
|
|
2515
2470
|
return '';
|
|
2516
2471
|
}
|
|
@@ -2527,6 +2482,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2527
2482
|
const type = val.type;
|
|
2528
2483
|
const styling = val.styling;
|
|
2529
2484
|
const isVersionEnable = (this.state.usingTabContainer && !val.standalone);
|
|
2485
|
+
if (val.id.match(/edmeditor/g)) {
|
|
2486
|
+
|
|
2487
|
+
}
|
|
2530
2488
|
|
|
2531
2489
|
|
|
2532
2490
|
if (!this.props.isNewVersionFlow && !val.standalone && !val.onlyDisplay && isVersionEnable && !this.state.formData[`${this.state.currentTab - 1}`]) {
|
|
@@ -2556,9 +2514,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2556
2514
|
}
|
|
2557
2515
|
}
|
|
2558
2516
|
columns.push(
|
|
2559
|
-
<
|
|
2517
|
+
<Col style={val.colStyle ? val.colStyle : {}} offset={val.offset} key={val.id} span={val.width}>
|
|
2560
2518
|
{this.renderPrimitiveElement(val, childIndex)}
|
|
2561
|
-
</
|
|
2519
|
+
</Col>
|
|
2562
2520
|
);
|
|
2563
2521
|
return true;
|
|
2564
2522
|
}
|
|
@@ -2566,60 +2524,57 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2566
2524
|
switch (type) {
|
|
2567
2525
|
case "input":
|
|
2568
2526
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2569
|
-
|
|
2527
|
+
|
|
2570
2528
|
if (styling === 'semantic') {
|
|
2571
2529
|
columns.push(
|
|
2572
|
-
<
|
|
2530
|
+
<Col key={val.id} span={val.width}>
|
|
2573
2531
|
<CapInput
|
|
2574
2532
|
id={val.id}
|
|
2575
|
-
errorMessage={val.errorMessage
|
|
2576
|
-
label={val.label}
|
|
2533
|
+
errorMessage={val.errorMessage ? val.errorMessage : ''}
|
|
2577
2534
|
className={`input-primary chart-name-input${ifError ? ' error' : ''}`}
|
|
2578
2535
|
// fluid={val.fluid}
|
|
2579
2536
|
style={val.style ? val.style : {}}
|
|
2580
2537
|
placeholder={val.placeholder}
|
|
2581
2538
|
onChange={(e) => this.updateFormData(e.target.value, val)}
|
|
2582
|
-
value={
|
|
2539
|
+
value={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2583
2540
|
defaultValue={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2584
2541
|
disabled={val.disabled}
|
|
2585
2542
|
/>
|
|
2586
|
-
</
|
|
2543
|
+
</Col>
|
|
2587
2544
|
);
|
|
2588
2545
|
}
|
|
2589
2546
|
break;
|
|
2590
2547
|
case "SmsEditor":
|
|
2591
2548
|
columns.push(
|
|
2592
|
-
<
|
|
2549
|
+
<Col span={5} key="input">
|
|
2593
2550
|
<SmsEditor
|
|
2594
2551
|
id={val.id}
|
|
2595
2552
|
content={this.state.formData[val.id]}
|
|
2596
2553
|
onDataChange={(data) => this.updateFormData(data.value, val)}
|
|
2597
2554
|
/>
|
|
2598
|
-
</
|
|
2555
|
+
</Col>
|
|
2599
2556
|
);
|
|
2600
2557
|
break;
|
|
2601
2558
|
case "textarea":
|
|
2602
2559
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2603
|
-
const textValue = isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id];
|
|
2604
2560
|
if (styling === 'semantic') {
|
|
2605
2561
|
columns.push(
|
|
2606
|
-
<
|
|
2607
|
-
<
|
|
2562
|
+
<Col key="input" span={val.width} offset={val.offset}>
|
|
2563
|
+
<CapTextArea
|
|
2608
2564
|
id={val.id}
|
|
2609
2565
|
placeholder={val.placeholder ? val.placeholder : ''}
|
|
2610
2566
|
disabled={val.disabled}
|
|
2611
2567
|
className={`${ifError ? 'error' : ''}`}
|
|
2612
|
-
errorMessage={val.errorMessage
|
|
2613
|
-
label={val.label}
|
|
2568
|
+
errorMessage={val.errorMessage ? val.errorMessage : ''}
|
|
2614
2569
|
autosize={val.autosize ? val.autosizeParams : false}
|
|
2615
2570
|
onChange={(e) => this.updateFormData(e.target.value, val)}
|
|
2616
2571
|
style={val.style ? val.style : {}}
|
|
2617
2572
|
defaultValue={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2618
|
-
value={
|
|
2573
|
+
value={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2619
2574
|
rows={10}
|
|
2620
2575
|
cols={2}
|
|
2621
2576
|
/>
|
|
2622
|
-
</
|
|
2577
|
+
</Col>
|
|
2623
2578
|
);
|
|
2624
2579
|
}
|
|
2625
2580
|
break;
|
|
@@ -2627,21 +2582,19 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2627
2582
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2628
2583
|
if (styling === 'semantic') {
|
|
2629
2584
|
columns.push(
|
|
2630
|
-
<
|
|
2585
|
+
<Col key="input" span={val.width} offset={val.offset}>
|
|
2631
2586
|
<CapCheckbox
|
|
2632
|
-
key={val.id}
|
|
2633
2587
|
className={`${ifError ? 'error' : ''}`}
|
|
2634
|
-
errorMessage={val.errorMessage
|
|
2635
|
-
onChange={(e) => this.updateFormData(e.target.checked, val
|
|
2588
|
+
errorMessage={val.errorMessage ? val.errorMessage : ''}
|
|
2589
|
+
onChange={(e) => this.updateFormData(e.target.checked, val)}
|
|
2636
2590
|
checked={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2637
2591
|
defaultChecked={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2638
2592
|
style={val.style ? val.style : {}}
|
|
2639
2593
|
disabled={val.disabled}
|
|
2640
|
-
inductiveText={val.inductiveText}
|
|
2641
2594
|
>
|
|
2642
2595
|
{val.label}
|
|
2643
2596
|
</CapCheckbox>
|
|
2644
|
-
</
|
|
2597
|
+
</Col>
|
|
2645
2598
|
);
|
|
2646
2599
|
}
|
|
2647
2600
|
break;
|
|
@@ -2649,10 +2602,10 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2649
2602
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2650
2603
|
if (styling === 'semantic') {
|
|
2651
2604
|
columns.push(
|
|
2652
|
-
<
|
|
2605
|
+
<Col key={`input-${val.id}`} span={val.width} offset={val.offset}>
|
|
2653
2606
|
<CapRadio
|
|
2654
2607
|
className={`${ifError ? 'error' : ''}`}
|
|
2655
|
-
errorMessage={val.errorMessage
|
|
2608
|
+
errorMessage={val.errorMessage ? val.errorMessage : ''}
|
|
2656
2609
|
onChange={(e) => this.updateFormData(e.target.checked, val)}
|
|
2657
2610
|
checked={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2658
2611
|
defaultChecked={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
@@ -2660,7 +2613,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2660
2613
|
>
|
|
2661
2614
|
{val.label}
|
|
2662
2615
|
</CapRadio>
|
|
2663
|
-
</
|
|
2616
|
+
</Col>
|
|
2664
2617
|
);
|
|
2665
2618
|
}
|
|
2666
2619
|
break;
|
|
@@ -2668,33 +2621,32 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2668
2621
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2669
2622
|
if (styling === 'semantic') {
|
|
2670
2623
|
columns.push(
|
|
2671
|
-
<
|
|
2624
|
+
<Col key={`input-${val.id}`} span={val.width} offset={val.offset}>
|
|
2672
2625
|
<CapRadioGroup
|
|
2673
2626
|
key={`${val.id}-radio-group`}
|
|
2674
|
-
className={
|
|
2675
|
-
errorMessage={val.errorMessage
|
|
2627
|
+
className={`${ifError ? 'error' : ''}`}
|
|
2628
|
+
errorMessage={val.errorMessage ? val.errorMessage : ''}
|
|
2676
2629
|
onChange={(e) => this.updateFormData(e.target.value, val)}
|
|
2677
2630
|
style={val.style ? val.style : {}}
|
|
2678
2631
|
value={this.handleSetRadioValue(this.state.formData, self.state.currentTab, val)}
|
|
2679
2632
|
name={val.name ? val.name : `${val.id}-name`}
|
|
2633
|
+
options={val.options}
|
|
2680
2634
|
disabled={val.disabled}
|
|
2681
2635
|
>
|
|
2682
|
-
{val.options.map((option, index) => <CapRadio value={option} inductiveText={val.inductiveText && val.inductiveText[index]}>{option}</CapRadio>) }
|
|
2683
|
-
|
|
2684
2636
|
</CapRadioGroup>
|
|
2685
2637
|
{/*{ifError ?*/}
|
|
2686
2638
|
{/*<div className="error"> {val.errorMessage}</div>*/}
|
|
2687
2639
|
{/*:*/}
|
|
2688
2640
|
{/*""*/}
|
|
2689
2641
|
{/*}*/}
|
|
2690
|
-
</
|
|
2642
|
+
</Col>
|
|
2691
2643
|
);
|
|
2692
2644
|
}
|
|
2693
2645
|
break;
|
|
2694
2646
|
case 'image':
|
|
2695
2647
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2696
2648
|
columns.push(
|
|
2697
|
-
<
|
|
2649
|
+
<Col key={`input-${val.id}${self.state.currentTab - 1}`} style={val.style} span={val.width} offset={val.offset}>
|
|
2698
2650
|
<div>
|
|
2699
2651
|
<div className={`image-container ${ifError ? 'error' : ''}`}>
|
|
2700
2652
|
{self.state && !!self.state.formData[`${self.state.currentTab - 1}`].image ?
|
|
@@ -2705,37 +2657,21 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2705
2657
|
</div>
|
|
2706
2658
|
{ifError && <span className="error">{val.errorMessage}</span>}
|
|
2707
2659
|
</div>
|
|
2708
|
-
</
|
|
2660
|
+
</Col>
|
|
2709
2661
|
);
|
|
2710
2662
|
break;
|
|
2711
2663
|
case 'upload':
|
|
2712
|
-
ifError = (this.state.checkValidation || this.props.startValidation) && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2713
|
-
const ImageComponent = (props) => (
|
|
2714
|
-
<div key={`${val.id}-${this.state.currentTab}`}>
|
|
2715
|
-
<div className={`image-container ${props.ifError ? 'error' : ''}`}>
|
|
2716
|
-
{self.state && !!self.state.formData[`${self.state.currentTab - 1}`].image ?
|
|
2717
|
-
<img src={self.state.formData[`${self.state.currentTab - 1}`].image} alt={props.alt} style={props.style}/>
|
|
2718
|
-
:
|
|
2719
|
-
<div style={{width: "100%", textAlign: "center"}}><span className="image-placeholder">{props.placeholder}</span></div>
|
|
2720
|
-
}
|
|
2721
|
-
</div>
|
|
2722
|
-
</div>
|
|
2723
|
-
);
|
|
2724
|
-
const WithLabel = LabelHOC(ImageComponent);
|
|
2725
|
-
const {errorMessage, ...rest} = val.previewProps || {};
|
|
2726
2664
|
columns.push(
|
|
2727
|
-
<
|
|
2728
|
-
{val.showPreview && <WithLabel key={`${val.id}-with-label`} {...rest} errorMessage={ifError && errorMessage} ifError={ifError}/>}
|
|
2665
|
+
<Col span={val.width} offset={val.offset} style={val.style}>
|
|
2729
2666
|
<form encType="multipart/form-data" id={val.id}>
|
|
2730
2667
|
<input key={val.id} style={{ display: 'none'}} id="fileName" type="file" onChange={(e) => this.uploadImages(e, {files: e.target.files}, val)} accept={val.supportedExtensions ? val.supportedExtensions : "image/*"} />
|
|
2731
2668
|
<CapButton disabled={val.disabled ? val.disabled : false} type="secondary" onClick={(e) => this.openFileDialog(e, val.id)} style={{float: 'right'}}>
|
|
2732
2669
|
{val.label}
|
|
2733
2670
|
</CapButton>
|
|
2734
2671
|
</form>
|
|
2735
|
-
</
|
|
2736
|
-
|
|
2672
|
+
</Col>
|
|
2673
|
+
);
|
|
2737
2674
|
break;
|
|
2738
|
-
|
|
2739
2675
|
case "table":
|
|
2740
2676
|
columns.push(
|
|
2741
2677
|
<CapTable dataSource={self.props.iosCtasData} loading={self.props.iosCtasData ? !self.props.iosCtasData.length : true} onRowClick={(row) => this.updateFormData(row, val, "onRowClick" )} pagination={val.pagination}>
|
|
@@ -2745,7 +2681,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2745
2681
|
break;
|
|
2746
2682
|
case "tag-list":
|
|
2747
2683
|
columns.push(
|
|
2748
|
-
<
|
|
2684
|
+
<Col key={`input-${val.id}`} offset={val.offset} span={val.width ? val.width : ''} style={val.style ? val.style : {marginBottom: '16px'}}>
|
|
2749
2685
|
<TagList
|
|
2750
2686
|
key={`input-${val.id}`}
|
|
2751
2687
|
moduleFilterEnabled={this.props.location && this.props.location.query && this.props.location.query.type !== 'embedded'}
|
|
@@ -2759,21 +2695,21 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2759
2695
|
id={val.id}
|
|
2760
2696
|
userLocale={this.props.userLocale}
|
|
2761
2697
|
/>
|
|
2762
|
-
</
|
|
2698
|
+
</Col>
|
|
2763
2699
|
);
|
|
2764
2700
|
break;
|
|
2765
2701
|
case "button":
|
|
2766
2702
|
if (styling === 'semantic' && val.metaType === 'submit-button') {
|
|
2767
2703
|
columns.push(
|
|
2768
|
-
<
|
|
2704
|
+
<Col style={val.colStyle ? val.colStyle : {}} span={val.width} offset={val.offset}>
|
|
2769
2705
|
<CapButton
|
|
2770
2706
|
type={val.buttonType}
|
|
2771
2707
|
icon={val.icon}
|
|
2772
2708
|
disabled={val.disabled ? val.disabled : false}
|
|
2773
|
-
onClick={(data) => this.callChildEvent(data, val, val.submitAction)}>
|
|
2709
|
+
onClick={(data) => val.id === 'save-button' ? this.saveForm() : this.callChildEvent(data, val, val.submitAction)}>
|
|
2774
2710
|
{val.value}
|
|
2775
2711
|
</CapButton>
|
|
2776
|
-
</
|
|
2712
|
+
</Col>
|
|
2777
2713
|
);
|
|
2778
2714
|
}
|
|
2779
2715
|
break;
|
|
@@ -2786,7 +2722,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2786
2722
|
content = isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][`sms-editor${this.state.currentTab > 1 ? this.state.currentTab : ''}`] : this.state.formData[val.id];
|
|
2787
2723
|
const unicodeEnabled = isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][`unicode-validity${this.state.currentTab > 1 ? this.state.currentTab : ''}`] : this.state.formData['unicode-validity'];
|
|
2788
2724
|
columns.push(
|
|
2789
|
-
<
|
|
2725
|
+
<Col key="input" span={23} offset={1}>
|
|
2790
2726
|
<TemplatePreview
|
|
2791
2727
|
key={val.id}
|
|
2792
2728
|
style={val.customStyling ? val.customStyling : {}}
|
|
@@ -2796,7 +2732,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2796
2732
|
unicodeEnabled={unicodeEnabled}
|
|
2797
2733
|
>
|
|
2798
2734
|
</TemplatePreview>
|
|
2799
|
-
</
|
|
2735
|
+
</Col>
|
|
2800
2736
|
);
|
|
2801
2737
|
}
|
|
2802
2738
|
break;
|
|
@@ -2810,7 +2746,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2810
2746
|
}
|
|
2811
2747
|
|
|
2812
2748
|
columns.push(
|
|
2813
|
-
<
|
|
2749
|
+
<Col key="input" span={23} offset={1}>
|
|
2814
2750
|
<TemplatePreview
|
|
2815
2751
|
key={val.id}
|
|
2816
2752
|
style={val.customStyling ? val.customStyling : {}}
|
|
@@ -2818,7 +2754,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2818
2754
|
content={content}
|
|
2819
2755
|
>
|
|
2820
2756
|
</TemplatePreview>
|
|
2821
|
-
</
|
|
2757
|
+
</Col>
|
|
2822
2758
|
);
|
|
2823
2759
|
}
|
|
2824
2760
|
break;
|
|
@@ -2827,7 +2763,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2827
2763
|
return true;
|
|
2828
2764
|
}
|
|
2829
2765
|
columns.push(
|
|
2830
|
-
<
|
|
2766
|
+
<Col key="input" span={23} offset={1}>
|
|
2831
2767
|
<TemplatePreview
|
|
2832
2768
|
key={val.id}
|
|
2833
2769
|
device={val.device ? val.device : 'android'}
|
|
@@ -2845,7 +2781,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2845
2781
|
}}
|
|
2846
2782
|
>
|
|
2847
2783
|
</TemplatePreview>
|
|
2848
|
-
</
|
|
2784
|
+
</Col>
|
|
2849
2785
|
);
|
|
2850
2786
|
break;
|
|
2851
2787
|
case "popover":
|
|
@@ -2858,7 +2794,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2858
2794
|
return result;
|
|
2859
2795
|
});
|
|
2860
2796
|
columns.push(
|
|
2861
|
-
<
|
|
2797
|
+
<Col style={val.colStyle ? val.colStyle : {}} span={val.width} offset={val.offset}>
|
|
2862
2798
|
<CapPopover
|
|
2863
2799
|
trigger={val.trigger}
|
|
2864
2800
|
placement={val.placement}
|
|
@@ -2882,7 +2818,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2882
2818
|
})
|
|
2883
2819
|
}
|
|
2884
2820
|
</CapPopover>
|
|
2885
|
-
</
|
|
2821
|
+
</Col>
|
|
2886
2822
|
);
|
|
2887
2823
|
break;
|
|
2888
2824
|
|
|
@@ -2894,7 +2830,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2894
2830
|
}
|
|
2895
2831
|
}
|
|
2896
2832
|
columns.push(
|
|
2897
|
-
<
|
|
2833
|
+
<Col
|
|
2898
2834
|
key={`icon-${val.id}`}
|
|
2899
2835
|
id={val.id}
|
|
2900
2836
|
offset={val.offset}
|
|
@@ -2904,14 +2840,14 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2904
2840
|
style={val.colStyle ? val.colStyle : {}}
|
|
2905
2841
|
>
|
|
2906
2842
|
<i style={val.style ? val.style : {}} className="material-icons">{val.value ? val.value : ''}</i>
|
|
2907
|
-
</
|
|
2843
|
+
</Col>
|
|
2908
2844
|
);
|
|
2909
2845
|
break;
|
|
2910
2846
|
case "select": {
|
|
2911
2847
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2912
2848
|
const options = (this.state.formData[`${val.id}-options`]) ? (this.state.formData[`${val.id}-options`]) : val.options;
|
|
2913
2849
|
columns.push(
|
|
2914
|
-
<
|
|
2850
|
+
<Col style={val.colStyle ? val.colStyle : {}} span={val.width}>
|
|
2915
2851
|
<CapSelect
|
|
2916
2852
|
id={val.id}
|
|
2917
2853
|
options={options}
|
|
@@ -2924,7 +2860,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2924
2860
|
{ifError && val.errorMessage &&
|
|
2925
2861
|
<span className={'error'}>{val.errorMessage}</span>
|
|
2926
2862
|
}
|
|
2927
|
-
</
|
|
2863
|
+
</Col>
|
|
2928
2864
|
);
|
|
2929
2865
|
}
|
|
2930
2866
|
break;
|
|
@@ -2950,15 +2886,15 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2950
2886
|
if (val.id.indexOf('template-content') > -1 && val.id !== 'template-content') {
|
|
2951
2887
|
langIndex = parseInt(val.id.replace('template-content', ''), 10) - 1;
|
|
2952
2888
|
}
|
|
2953
|
-
|
|
2889
|
+
|
|
2954
2890
|
const currentLang = (!_.isEmpty(this.state.formData) && !_.isEmpty(this.state.formData[`${this.state.currentTab - 1}`]) && !_.isEmpty(this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages) && this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages[langIndex]) ? this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages[langIndex] : this.props.baseLanguage;
|
|
2955
2891
|
const content = (!_.isEmpty(this.state.formData) && this.state.formData[`${this.state.currentTab - 1}`][currentLang]['template-content'] ? this.state.formData[`${this.state.currentTab - 1}`][currentLang]['template-content'] : '');
|
|
2956
|
-
|
|
2892
|
+
|
|
2957
2893
|
if (this.state.formData[`${this.state.currentTab - 1}`][currentLang].is_drag_drop) {
|
|
2958
2894
|
// content = "";
|
|
2959
2895
|
}
|
|
2960
2896
|
columns.push(
|
|
2961
|
-
<
|
|
2897
|
+
<Col style={val.colStyle ? val.colStyle : {}} span={val.width}>
|
|
2962
2898
|
<CKEditor
|
|
2963
2899
|
id={val.id}
|
|
2964
2900
|
content={content}
|
|
@@ -2966,7 +2902,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2966
2902
|
getEditorInstanse={(evt, id) => val.injectedEvents.getEditorInstanse.call(this, evt, id)}
|
|
2967
2903
|
handleContentChange={(event) => this.callChildEvent(event, val, 'onContentChange')}
|
|
2968
2904
|
/>
|
|
2969
|
-
</
|
|
2905
|
+
</Col>
|
|
2970
2906
|
);
|
|
2971
2907
|
}
|
|
2972
2908
|
}
|
|
@@ -2998,13 +2934,13 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2998
2934
|
|
|
2999
2935
|
|
|
3000
2936
|
columns.push(
|
|
3001
|
-
<
|
|
2937
|
+
<Col style={val.colStyle ? val.colStyle : {}} span={val.width}>
|
|
3002
2938
|
<EDMEditor
|
|
3003
2939
|
id={val.id}
|
|
3004
2940
|
getEditorInstanse={this.getEditorInstanse}
|
|
3005
2941
|
edmSrc={edmSrc}
|
|
3006
2942
|
/>
|
|
3007
|
-
</
|
|
2943
|
+
</Col>
|
|
3008
2944
|
);
|
|
3009
2945
|
}
|
|
3010
2946
|
break;
|
|
@@ -3013,7 +2949,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3013
2949
|
return true;
|
|
3014
2950
|
}
|
|
3015
2951
|
columns.push(
|
|
3016
|
-
<
|
|
2952
|
+
<Col style={val.colStyle ? val.colStyle : {}} span={val.width}>
|
|
3017
2953
|
<CustomPopOver
|
|
3018
2954
|
id={val.id}
|
|
3019
2955
|
popOverList={this.props.supportedLanguages}
|
|
@@ -3022,7 +2958,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3022
2958
|
visible={this.state.customPopoverVisible}
|
|
3023
2959
|
onVisibleChange={this.handleCustomPopoverVisibleChange}
|
|
3024
2960
|
/>
|
|
3025
|
-
</
|
|
2961
|
+
</Col>
|
|
3026
2962
|
);
|
|
3027
2963
|
}
|
|
3028
2964
|
break;
|
|
@@ -3032,7 +2968,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3032
2968
|
return true;
|
|
3033
2969
|
});
|
|
3034
2970
|
const row = (
|
|
3035
|
-
<
|
|
2971
|
+
<Row style={field.rowStyle ? field.rowStyle : {}} className={field.rowClassName ? field.rowClassName : ''}>
|
|
3036
2972
|
{
|
|
3037
2973
|
_.forEach(columns, (value) => {
|
|
3038
2974
|
if (value) {
|
|
@@ -3041,7 +2977,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3041
2977
|
return value;
|
|
3042
2978
|
})
|
|
3043
2979
|
}
|
|
3044
|
-
</
|
|
2980
|
+
</Row>
|
|
3045
2981
|
);
|
|
3046
2982
|
fields.push(row);
|
|
3047
2983
|
});
|
|
@@ -3055,7 +2991,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3055
2991
|
case "button":
|
|
3056
2992
|
if (styling === 'semantic' && val.metaType === 'submit-button') {
|
|
3057
2993
|
columns.push(
|
|
3058
|
-
<
|
|
2994
|
+
<Col span={3}>
|
|
3059
2995
|
<CapButton
|
|
3060
2996
|
type={val.buttonType}
|
|
3061
2997
|
icon={val.icon}
|
|
@@ -3063,7 +2999,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3063
2999
|
onClick={(data) => val.id === 'save-button' ? this.saveForm() : this.callChildEvent(data, val, val.submitAction)}>
|
|
3064
3000
|
{val.value}
|
|
3065
3001
|
</CapButton>
|
|
3066
|
-
</
|
|
3002
|
+
</Col>
|
|
3067
3003
|
);
|
|
3068
3004
|
}
|
|
3069
3005
|
break;
|
|
@@ -3072,7 +3008,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3072
3008
|
}
|
|
3073
3009
|
});
|
|
3074
3010
|
const row = (
|
|
3075
|
-
<
|
|
3011
|
+
<Row>
|
|
3076
3012
|
{
|
|
3077
3013
|
_.forEach(columns, (value) => {
|
|
3078
3014
|
if (value) {
|
|
@@ -3081,7 +3017,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3081
3017
|
return value;
|
|
3082
3018
|
})
|
|
3083
3019
|
}
|
|
3084
|
-
</
|
|
3020
|
+
</Row>
|
|
3085
3021
|
);
|
|
3086
3022
|
fields.push(row);
|
|
3087
3023
|
});
|
|
@@ -3127,35 +3063,33 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3127
3063
|
const currentLang = this.state.formData[this.state.currentTab - 1].selectedLanguages[index];
|
|
3128
3064
|
paneTabKey = this.state.formData[this.state.currentTab - 1] && this.state.formData[this.state.currentTab - 1][currentLang] && this.state.formData[this.state.currentTab - 1][currentLang].tabKey;
|
|
3129
3065
|
}
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
tab={
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
_.forEach(renderedContentSections, (value) => {
|
|
3139
|
-
if (value) {
|
|
3140
|
-
return value;
|
|
3141
|
-
}
|
|
3142
|
-
return value;
|
|
3143
|
-
})
|
|
3144
|
-
}
|
|
3145
|
-
</div>
|
|
3146
|
-
}
|
|
3147
|
-
key={paneTabKey && paneTabKey !== '' ? `${paneTabKey}` : index}>
|
|
3148
|
-
{
|
|
3149
|
-
_.forEach(renderedSections, (value) => {
|
|
3066
|
+
|
|
3067
|
+
renderedPanes.push(
|
|
3068
|
+
<TabPane
|
|
3069
|
+
forceRender
|
|
3070
|
+
tab={
|
|
3071
|
+
<div className="form-tab-header" onInput={(e) => e.stopPropagation()}>
|
|
3072
|
+
{
|
|
3073
|
+
_.forEach(renderedContentSections, (value) => {
|
|
3150
3074
|
if (value) {
|
|
3151
3075
|
return value;
|
|
3152
3076
|
}
|
|
3153
3077
|
return value;
|
|
3154
3078
|
})
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3079
|
+
}
|
|
3080
|
+
</div>
|
|
3081
|
+
}
|
|
3082
|
+
key={paneTabKey && paneTabKey !== '' ? `${paneTabKey}` : index}>
|
|
3083
|
+
{
|
|
3084
|
+
_.forEach(renderedSections, (value) => {
|
|
3085
|
+
if (value) {
|
|
3086
|
+
return value;
|
|
3087
|
+
}
|
|
3088
|
+
return value;
|
|
3089
|
+
})
|
|
3090
|
+
}
|
|
3091
|
+
</TabPane>);
|
|
3092
|
+
paneIndex += 1;
|
|
3159
3093
|
});
|
|
3160
3094
|
extraActionSections = container.tabBarExtraContent && container.tabBarExtraContent.sections ? container.tabBarExtraContent.sections.map((section) => {
|
|
3161
3095
|
result = this.renderSection(section);
|
|
@@ -3242,7 +3176,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3242
3176
|
|
|
3243
3177
|
|
|
3244
3178
|
return (
|
|
3245
|
-
<
|
|
3179
|
+
<Row>
|
|
3246
3180
|
{
|
|
3247
3181
|
this.props.schema ? this.renderForm() : ''
|
|
3248
3182
|
}
|
|
@@ -3255,7 +3189,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3255
3189
|
loadingText={"Loading EDM Templates"}
|
|
3256
3190
|
isLoading={this.props.getCmsTemplatesInProgress}
|
|
3257
3191
|
/>
|
|
3258
|
-
</
|
|
3192
|
+
</Row>
|
|
3259
3193
|
);
|
|
3260
3194
|
}
|
|
3261
3195
|
}
|