@capillarytech/creatives-library 2.0.81 → 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 +192 -258
- 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/{containers/TemplatesV2 → v2Components/CapTagList}/tests/index.test.js +2 -2
- 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/{containers/EmailWrapper → v2Components/CardGrid}/tests/index.test.js +2 -2
- package/v2Components/Ckeditor/index.js +234 -0
- package/v2Components/Ckeditor/messages.js +13 -0
- package/{containers/ChannelTemplates → v2Components/Ckeditor}/tests/index.test.js +2 -2
- 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/{containers/MobilepushWrapper → v2Components/MobilePushPreviewV2}/tests/index.test.js +2 -2
- package/v2Components/NewCallTask/_newCallTask.scss +9 -0
- package/v2Components/NewCallTask/index.js +152 -0
- package/v2Components/NewCallTask/messages.js +29 -0
- package/{containers/CallTask → v2Components/NewCallTask}/tests/index.test.js +2 -2
- 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 +13 -13
- 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 +26 -3
- package/v2Containers/MobilePush/Edit/index.js +32 -7
- package/v2Containers/MobilePush/initialSchema.js +2 -0
- 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/components/FormBuilder/test +0 -1845
- package/containers/CallTask/_callTask.scss +0 -5
- package/containers/CallTask/actions.js +0 -15
- package/containers/CallTask/constants.js +0 -7
- package/containers/CallTask/index.js +0 -141
- package/containers/CallTask/messages.js +0 -21
- package/containers/CallTask/reducer.js +0 -23
- package/containers/CallTask/sagas.js +0 -11
- package/containers/CallTask/selectors.js +0 -25
- package/containers/CallTask/tests/actions.test.js +0 -18
- package/containers/CallTask/tests/reducer.test.js +0 -9
- package/containers/CallTask/tests/sagas.test.js +0 -15
- package/containers/CallTask/tests/selectors.test.js +0 -10
- package/containers/ChannelTemplates/actions.js +0 -20
- package/containers/ChannelTemplates/constants.js +0 -8
- package/containers/ChannelTemplates/index.js +0 -48
- package/containers/ChannelTemplates/messages.js +0 -13
- package/containers/ChannelTemplates/reducer.js +0 -34
- package/containers/ChannelTemplates/sagas.js +0 -32
- package/containers/ChannelTemplates/selectors.js +0 -25
- package/containers/ChannelTemplates/tests/actions.test.js +0 -18
- package/containers/ChannelTemplates/tests/reducer.test.js +0 -9
- package/containers/ChannelTemplates/tests/sagas.test.js +0 -15
- package/containers/ChannelTemplates/tests/selectors.test.js +0 -10
- package/containers/CreativesContainer/SlideBoxContent.js +0 -248
- package/containers/CreativesContainer/SlideBoxFooter.js +0 -38
- package/containers/CreativesContainer/SlideBoxHeader.js +0 -65
- package/containers/CreativesContainer/actions.js +0 -27
- package/containers/CreativesContainer/constants.js +0 -13
- package/containers/CreativesContainer/index.js +0 -418
- package/containers/CreativesContainer/index.scss +0 -27
- package/containers/CreativesContainer/messages.js +0 -17
- package/containers/CreativesContainer/reducer.js +0 -29
- package/containers/CreativesContainer/sagas.js +0 -11
- package/containers/CreativesContainer/selectors.js +0 -30
- package/containers/CreativesContainer/tests/actions.test.js +0 -18
- package/containers/CreativesContainer/tests/index.test.js +0 -10
- package/containers/CreativesContainer/tests/reducer.test.js +0 -9
- package/containers/CreativesContainer/tests/sagas.test.js +0 -15
- package/containers/CreativesContainer/tests/selectors.test.js +0 -10
- package/containers/EmailWrapper/actions.js +0 -15
- package/containers/EmailWrapper/constants.js +0 -7
- package/containers/EmailWrapper/index.js +0 -238
- package/containers/EmailWrapper/messages.js +0 -57
- package/containers/EmailWrapper/reducer.js +0 -23
- package/containers/EmailWrapper/sagas.js +0 -11
- package/containers/EmailWrapper/selectors.js +0 -25
- package/containers/EmailWrapper/tests/actions.test.js +0 -18
- package/containers/EmailWrapper/tests/reducer.test.js +0 -9
- package/containers/EmailWrapper/tests/sagas.test.js +0 -15
- package/containers/EmailWrapper/tests/selectors.test.js +0 -10
- package/containers/MobilePush/commonMethods.js +0 -249
- package/containers/MobilePush/eventsMap.js +0 -127
- package/containers/MobilePush/initialSchema.js +0 -1739
- package/containers/MobilepushWrapper/_mobilepushWrapper.scss +0 -18
- package/containers/MobilepushWrapper/index.js +0 -97
- package/containers/MobilepushWrapper/messages.js +0 -25
- package/containers/TemplatesV2/_templatesV2.scss +0 -5
- package/containers/TemplatesV2/actions.js +0 -16
- package/containers/TemplatesV2/constants.js +0 -10
- package/containers/TemplatesV2/index.js +0 -207
- package/containers/TemplatesV2/messages.js +0 -29
- package/containers/TemplatesV2/selectors.js +0 -25
- package/containers/TemplatesV2/tests/actions.test.js +0 -18
- package/containers/TemplatesV2/tests/reducer.test.js +0 -9
- package/containers/TemplatesV2/tests/sagas.test.js +0 -15
- package/containers/TemplatesV2/tests/selectors.test.js +0 -10
- package/containers/WeChat/RichmediaTemplates/Create/testschema.js +0 -379
- package/containers/WeChat/_wechat.scss +0 -8
- package/containers/WeChat/actions.js +0 -52
- package/containers/WeChat/constants.js +0 -28
- package/containers/WeChat/index.js +0 -1635
- 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") {
|
|
@@ -1841,11 +1802,10 @@ 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
|
}
|
|
1848
|
-
|
|
1849
1809
|
const tab = this.state.tabCount;
|
|
1850
1810
|
// const parent = this._reactInternalInstance._currentElement._owner._instance;
|
|
1851
1811
|
if (event === 'onTabChange') {
|
|
@@ -1994,12 +1954,11 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1994
1954
|
// }
|
|
1995
1955
|
return;
|
|
1996
1956
|
}
|
|
1997
|
-
|
|
1957
|
+
|
|
1998
1958
|
// val.injectedEvents[event].call(this.props.parent, data);
|
|
1999
1959
|
val.injectedEvents[event].call(this.props.parent, data, val.id);
|
|
2000
1960
|
}
|
|
2001
1961
|
openFileDialog = (e, parentID) => {
|
|
2002
|
-
console.log("filedialog: ");
|
|
2003
1962
|
document.querySelector(`#${parentID} #fileName`).click();
|
|
2004
1963
|
};
|
|
2005
1964
|
handleOk = (ev) => {
|
|
@@ -2080,7 +2039,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2080
2039
|
const fileParams = {
|
|
2081
2040
|
width: this.width,
|
|
2082
2041
|
height: this.height,
|
|
2083
|
-
error: file.size / (1e+6) >
|
|
2042
|
+
error: file.size / (1e+6) > 5,
|
|
2084
2043
|
};
|
|
2085
2044
|
this.callChildEvent({file, type: 'image', fileParams}, val, val.submitAction);
|
|
2086
2045
|
};
|
|
@@ -2125,7 +2084,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2125
2084
|
if (this.props.schema.channel.toLowerCase() === 'email') {
|
|
2126
2085
|
//
|
|
2127
2086
|
const imgSrc = template && template.versions && template.versions.base ? template.versions.base.preview_http_url : '';
|
|
2128
|
-
|
|
2087
|
+
const ifPreviewGenerated = template && template.versions && template.versions.base ? template.versions.base.isPreviewGenerated : 0;
|
|
2129
2088
|
const content = <img src={imgSrc || ''} alt="" />;
|
|
2130
2089
|
|
|
2131
2090
|
temp.content = (
|
|
@@ -2179,9 +2138,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2179
2138
|
}
|
|
2180
2139
|
//
|
|
2181
2140
|
columns.push(
|
|
2182
|
-
<
|
|
2141
|
+
<Col key="label" span={4}>
|
|
2183
2142
|
<Label style={val.labelStyle ? val.labelStyle : {}}>{val.label}</Label>
|
|
2184
|
-
</
|
|
2143
|
+
</Col>
|
|
2185
2144
|
);
|
|
2186
2145
|
let ifError = false;
|
|
2187
2146
|
const isVersionEnable = (this.state.usingTabContainer && !val.standalone);
|
|
@@ -2193,9 +2152,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2193
2152
|
}
|
|
2194
2153
|
}
|
|
2195
2154
|
columns.push(
|
|
2196
|
-
<
|
|
2155
|
+
<Col key={val.id} span={val.width}>
|
|
2197
2156
|
{this.renderPrimitiveElement(val, childIndex)}
|
|
2198
|
-
</
|
|
2157
|
+
</Col>
|
|
2199
2158
|
);
|
|
2200
2159
|
return true;
|
|
2201
2160
|
}
|
|
@@ -2205,57 +2164,55 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2205
2164
|
case "input":
|
|
2206
2165
|
if (styling === 'semantic') {
|
|
2207
2166
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2208
|
-
|
|
2167
|
+
|
|
2209
2168
|
columns.push(
|
|
2210
|
-
<
|
|
2169
|
+
<Col key={val.id} span={val.width}>
|
|
2211
2170
|
<CapInput
|
|
2212
2171
|
id={val.id}
|
|
2213
|
-
errorMessage={val.errorMessage
|
|
2172
|
+
errorMessage={val.errorMessage ? val.errorMessage : ''}
|
|
2214
2173
|
className={`input-primary chart-name-input${ifError ? ' error' : ''}`}
|
|
2215
2174
|
// fluid={val.fluid}
|
|
2216
2175
|
style={val.style ? val.style : {}}
|
|
2217
2176
|
placeholder={val.placeholder}
|
|
2218
2177
|
onChange={(e) => this.updateFormData(e.target.value, val)}
|
|
2219
2178
|
defaultValue={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2220
|
-
value={
|
|
2179
|
+
value={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2221
2180
|
disabled={val.disabled}
|
|
2222
2181
|
/>
|
|
2223
|
-
</
|
|
2182
|
+
</Col>
|
|
2224
2183
|
);
|
|
2225
2184
|
}
|
|
2226
2185
|
break;
|
|
2227
2186
|
case "SmsEditor":
|
|
2228
2187
|
columns.push(
|
|
2229
|
-
<
|
|
2188
|
+
<Col span={5} key="input">
|
|
2230
2189
|
<SmsEditor
|
|
2231
2190
|
id={val.id}
|
|
2232
2191
|
content={this.state.formData[val.id]}
|
|
2233
2192
|
onDataChange={(data) => this.updateFormData(data.value, val)}
|
|
2234
2193
|
/>
|
|
2235
|
-
</
|
|
2194
|
+
</Col>
|
|
2236
2195
|
);
|
|
2237
2196
|
break;
|
|
2238
2197
|
case "textarea":
|
|
2239
2198
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2240
|
-
const value = isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id];
|
|
2241
2199
|
if (styling === 'semantic') {
|
|
2242
2200
|
columns.push(
|
|
2243
|
-
<
|
|
2244
|
-
<
|
|
2201
|
+
<Col key="input" span={val.width}>
|
|
2202
|
+
<CapTextArea
|
|
2245
2203
|
id={val.id}
|
|
2246
2204
|
className={`${ifError ? 'error' : ''}`}
|
|
2247
|
-
errorMessage={val.errorMessage
|
|
2248
|
-
label={val.label}
|
|
2205
|
+
errorMessage={val.errorMessage ? val.errorMessage : ''}
|
|
2249
2206
|
autosize={val.autosize ? val.autosizeParams : false}
|
|
2250
2207
|
onChange={(e) => this.updateFormData(e.target.value, val)}
|
|
2251
2208
|
style={val.style ? val.style : {}}
|
|
2252
2209
|
defaultValue={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2253
|
-
value={
|
|
2210
|
+
value={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2254
2211
|
rows={20}
|
|
2255
2212
|
disabled={val.disabled}
|
|
2256
2213
|
cols={20}
|
|
2257
2214
|
/>
|
|
2258
|
-
</
|
|
2215
|
+
</Col>
|
|
2259
2216
|
);
|
|
2260
2217
|
}
|
|
2261
2218
|
break;
|
|
@@ -2270,23 +2227,23 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2270
2227
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2271
2228
|
if (styling === 'semantic') {
|
|
2272
2229
|
columns.push(
|
|
2273
|
-
<
|
|
2230
|
+
<Col key="input" span={val.width} offset={val.offset}>
|
|
2274
2231
|
<CapCheckbox
|
|
2275
2232
|
className={`${ifError ? 'error' : ''}`}
|
|
2276
|
-
errorMessage={val.errorMessage
|
|
2233
|
+
errorMessage={val.errorMessage ? val.errorMessage : ''}
|
|
2277
2234
|
style={val.style ? val.style : {}}
|
|
2278
2235
|
onChange={(e) => this.updateFormData(e, val)}
|
|
2279
2236
|
checked={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2280
2237
|
defaultChecked={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2281
2238
|
disabled={val.disabled}
|
|
2282
2239
|
/>
|
|
2283
|
-
</
|
|
2240
|
+
</Col>
|
|
2284
2241
|
);
|
|
2285
2242
|
}
|
|
2286
2243
|
break;
|
|
2287
2244
|
case "tag-list":
|
|
2288
2245
|
columns.push(
|
|
2289
|
-
<
|
|
2246
|
+
<Col key={`input-${val.id}`} span={10} offset={val.offset}>
|
|
2290
2247
|
<TagList
|
|
2291
2248
|
key={`input-${val.id}`}
|
|
2292
2249
|
moduleFilterEnabled={this.props.location && this.props.location.query && this.props.location.query.type !== 'embedded'}
|
|
@@ -2300,16 +2257,16 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2300
2257
|
id={val.id}
|
|
2301
2258
|
userLocale={this.props.userLocale}
|
|
2302
2259
|
/>
|
|
2303
|
-
</
|
|
2260
|
+
</Col>
|
|
2304
2261
|
);
|
|
2305
2262
|
break;
|
|
2306
2263
|
case "tabs":
|
|
2307
2264
|
columns.push(
|
|
2308
|
-
<
|
|
2265
|
+
<Col key="input" span={10}>
|
|
2309
2266
|
<TagList
|
|
2310
2267
|
onTagSelect={(data) => this.callChildEvent(data, val, 'onTagSelect')}
|
|
2311
2268
|
/>
|
|
2312
|
-
</
|
|
2269
|
+
</Col>
|
|
2313
2270
|
);
|
|
2314
2271
|
break;
|
|
2315
2272
|
case "sms-preview": {
|
|
@@ -2319,7 +2276,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2319
2276
|
content = isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][`sms-editor${this.state.currentTab > 1 ? this.state.currentTab : ''}`] : this.state.formData[val.id];
|
|
2320
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'];
|
|
2321
2278
|
columns.push(
|
|
2322
|
-
<
|
|
2279
|
+
<Col key="input" span={10}>
|
|
2323
2280
|
<TemplatePreview
|
|
2324
2281
|
channel={val.channel ? val.channel : 'SMS'}
|
|
2325
2282
|
content={content}
|
|
@@ -2327,7 +2284,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2327
2284
|
unicodeEnabled={unicodeEnabled}
|
|
2328
2285
|
>
|
|
2329
2286
|
</TemplatePreview>
|
|
2330
|
-
</
|
|
2287
|
+
</Col>
|
|
2331
2288
|
);
|
|
2332
2289
|
break;
|
|
2333
2290
|
}
|
|
@@ -2355,7 +2312,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2355
2312
|
case "select": {
|
|
2356
2313
|
const options = (this.state.formData[`${val.id}-options`]) ? (this.state.formData[`${val.id}-options`]) : val.options;
|
|
2357
2314
|
columns.push(
|
|
2358
|
-
<
|
|
2315
|
+
<Col style={val.colStyle ? val.colStyle : {}} span={val.width}>
|
|
2359
2316
|
<CapSelect
|
|
2360
2317
|
id={val.id}
|
|
2361
2318
|
placeholder={val.placeholder ? val.placeholder : ''}
|
|
@@ -2365,14 +2322,14 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2365
2322
|
value={(this.state.formData[val.id] && this.state.formData[val.id] !== '' ? this.state.formData[val.id] : undefined)}
|
|
2366
2323
|
disabled={val.disabled}
|
|
2367
2324
|
/>
|
|
2368
|
-
</
|
|
2325
|
+
</Col>
|
|
2369
2326
|
);
|
|
2370
2327
|
}
|
|
2371
2328
|
break;
|
|
2372
2329
|
case "ckeditor":
|
|
2373
2330
|
|
|
2374
2331
|
columns.push(
|
|
2375
|
-
<
|
|
2332
|
+
<Col style={val.colStyle ? val.colStyle : {}} span={val.width}>
|
|
2376
2333
|
<CKEditor
|
|
2377
2334
|
id={val.id}
|
|
2378
2335
|
content={(this.state.formData[`${this.state.currentTab - 1}`][val.id] ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : '')}
|
|
@@ -2381,7 +2338,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2381
2338
|
// this.callChildEvent(data, val, 'addVersion', event);
|
|
2382
2339
|
handleContentChange={(event) => this.callChildEvent(event, val, 'onContentChange')}
|
|
2383
2340
|
/>
|
|
2384
|
-
</
|
|
2341
|
+
</Col>
|
|
2385
2342
|
);
|
|
2386
2343
|
break;
|
|
2387
2344
|
case "edmeditor": {
|
|
@@ -2401,13 +2358,13 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2401
2358
|
}
|
|
2402
2359
|
|
|
2403
2360
|
columns.push(
|
|
2404
|
-
<
|
|
2361
|
+
<Col style={val.colStyle ? val.colStyle : {}} span={val.width}>
|
|
2405
2362
|
<EDMEditor
|
|
2406
2363
|
id={val.id}
|
|
2407
2364
|
getEditorInstanse={this.getEditorInstanse}
|
|
2408
2365
|
edmSrc={edmSrc}
|
|
2409
2366
|
/>
|
|
2410
|
-
</
|
|
2367
|
+
</Col>
|
|
2411
2368
|
);
|
|
2412
2369
|
}
|
|
2413
2370
|
break;
|
|
@@ -2415,7 +2372,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2415
2372
|
break;
|
|
2416
2373
|
}
|
|
2417
2374
|
row.push(
|
|
2418
|
-
<
|
|
2375
|
+
<Row>
|
|
2419
2376
|
{
|
|
2420
2377
|
_.forEach(columns, (value) => {
|
|
2421
2378
|
if (value) {
|
|
@@ -2424,7 +2381,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2424
2381
|
return value;
|
|
2425
2382
|
})
|
|
2426
2383
|
}
|
|
2427
|
-
</
|
|
2384
|
+
</Row>
|
|
2428
2385
|
);
|
|
2429
2386
|
|
|
2430
2387
|
fields.push(row);
|
|
@@ -2439,12 +2396,12 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2439
2396
|
case "button":
|
|
2440
2397
|
if (styling === 'semantic' && val.metaType === 'submit-button') {
|
|
2441
2398
|
columns.push(
|
|
2442
|
-
<
|
|
2399
|
+
<Col>
|
|
2443
2400
|
<CapButton
|
|
2444
|
-
onClick={(data) => this.callChildEvent(data, val, val.submitAction)}>
|
|
2401
|
+
onClick={(data) => val.id === 'save-button' ? this.saveForm() : this.callChildEvent(data, val, val.submitAction)}>
|
|
2445
2402
|
{val.value}
|
|
2446
2403
|
</CapButton>
|
|
2447
|
-
</
|
|
2404
|
+
</Col>
|
|
2448
2405
|
);
|
|
2449
2406
|
}
|
|
2450
2407
|
break;
|
|
@@ -2461,10 +2418,10 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2461
2418
|
const cols = [];
|
|
2462
2419
|
section.childSections.map( (childSection) => {
|
|
2463
2420
|
const renderedChildSection = this.renderSection(childSection, childIndex);
|
|
2464
|
-
cols.push(<
|
|
2421
|
+
cols.push(<Col style={childSection.colStyle ? childSection.colStyle : {}}offset={childSection.offset} span={childSection.width}>{renderedChildSection}</Col>);
|
|
2465
2422
|
return true;
|
|
2466
2423
|
});
|
|
2467
|
-
const row = (<
|
|
2424
|
+
const row = (<Row style={section.rowStyle ? section.rowStyle : {}}>
|
|
2468
2425
|
{
|
|
2469
2426
|
_.forEach(cols, (value) => {
|
|
2470
2427
|
if (value) {
|
|
@@ -2473,7 +2430,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2473
2430
|
return value;
|
|
2474
2431
|
})
|
|
2475
2432
|
}
|
|
2476
|
-
</
|
|
2433
|
+
</Row>);
|
|
2477
2434
|
return row;
|
|
2478
2435
|
}
|
|
2479
2436
|
|
|
@@ -2494,24 +2451,21 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2494
2451
|
renderPrimitiveElement(val, childIndex) {
|
|
2495
2452
|
const type = val.type;
|
|
2496
2453
|
const tabName = this.state.formData[childIndex - 1] && this.state.formData[childIndex - 1].name ? this.state.formData[childIndex - 1].name : `${val.value} ${childIndex}`;
|
|
2497
|
-
|
|
2454
|
+
let value = val.dynamicTab ? tabName : val.value;
|
|
2498
2455
|
switch (type) {
|
|
2499
2456
|
case "span":
|
|
2500
2457
|
return <span id={`${val.id}${childIndex > 1 ? childIndex : ''}`}>{val.dynamicTab ? tabName : val.value}</span>;
|
|
2501
2458
|
case "div":
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
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];
|
|
2505
2461
|
}
|
|
2506
|
-
const ref = _.get(this, `props.refs[${val.id}]`);
|
|
2507
2462
|
return (<div
|
|
2508
|
-
ref={ref}
|
|
2509
2463
|
className={val.className ? val.className : ''}
|
|
2510
2464
|
id={`${val.id}${childIndex > 1 ? childIndex : ''}`}
|
|
2511
2465
|
onClick={(data) => this.callChildEvent(data, val, val.submitAction)}
|
|
2512
2466
|
style={val.style ? val.style : {}}
|
|
2513
2467
|
onInput={(e) => { e.stopPropagation(); this.callChildEvent(e.target.textContent, val, 'onChange'); }}
|
|
2514
|
-
>{
|
|
2468
|
+
>{value}</div>);
|
|
2515
2469
|
default:
|
|
2516
2470
|
return '';
|
|
2517
2471
|
}
|
|
@@ -2528,6 +2482,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2528
2482
|
const type = val.type;
|
|
2529
2483
|
const styling = val.styling;
|
|
2530
2484
|
const isVersionEnable = (this.state.usingTabContainer && !val.standalone);
|
|
2485
|
+
if (val.id.match(/edmeditor/g)) {
|
|
2486
|
+
|
|
2487
|
+
}
|
|
2531
2488
|
|
|
2532
2489
|
|
|
2533
2490
|
if (!this.props.isNewVersionFlow && !val.standalone && !val.onlyDisplay && isVersionEnable && !this.state.formData[`${this.state.currentTab - 1}`]) {
|
|
@@ -2557,9 +2514,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2557
2514
|
}
|
|
2558
2515
|
}
|
|
2559
2516
|
columns.push(
|
|
2560
|
-
<
|
|
2517
|
+
<Col style={val.colStyle ? val.colStyle : {}} offset={val.offset} key={val.id} span={val.width}>
|
|
2561
2518
|
{this.renderPrimitiveElement(val, childIndex)}
|
|
2562
|
-
</
|
|
2519
|
+
</Col>
|
|
2563
2520
|
);
|
|
2564
2521
|
return true;
|
|
2565
2522
|
}
|
|
@@ -2567,60 +2524,57 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2567
2524
|
switch (type) {
|
|
2568
2525
|
case "input":
|
|
2569
2526
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2570
|
-
|
|
2527
|
+
|
|
2571
2528
|
if (styling === 'semantic') {
|
|
2572
2529
|
columns.push(
|
|
2573
|
-
<
|
|
2530
|
+
<Col key={val.id} span={val.width}>
|
|
2574
2531
|
<CapInput
|
|
2575
2532
|
id={val.id}
|
|
2576
|
-
errorMessage={val.errorMessage
|
|
2577
|
-
label={val.label}
|
|
2533
|
+
errorMessage={val.errorMessage ? val.errorMessage : ''}
|
|
2578
2534
|
className={`input-primary chart-name-input${ifError ? ' error' : ''}`}
|
|
2579
2535
|
// fluid={val.fluid}
|
|
2580
2536
|
style={val.style ? val.style : {}}
|
|
2581
2537
|
placeholder={val.placeholder}
|
|
2582
2538
|
onChange={(e) => this.updateFormData(e.target.value, val)}
|
|
2583
|
-
value={
|
|
2539
|
+
value={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2584
2540
|
defaultValue={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2585
2541
|
disabled={val.disabled}
|
|
2586
2542
|
/>
|
|
2587
|
-
</
|
|
2543
|
+
</Col>
|
|
2588
2544
|
);
|
|
2589
2545
|
}
|
|
2590
2546
|
break;
|
|
2591
2547
|
case "SmsEditor":
|
|
2592
2548
|
columns.push(
|
|
2593
|
-
<
|
|
2549
|
+
<Col span={5} key="input">
|
|
2594
2550
|
<SmsEditor
|
|
2595
2551
|
id={val.id}
|
|
2596
2552
|
content={this.state.formData[val.id]}
|
|
2597
2553
|
onDataChange={(data) => this.updateFormData(data.value, val)}
|
|
2598
2554
|
/>
|
|
2599
|
-
</
|
|
2555
|
+
</Col>
|
|
2600
2556
|
);
|
|
2601
2557
|
break;
|
|
2602
2558
|
case "textarea":
|
|
2603
2559
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2604
|
-
const textValue = isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id];
|
|
2605
2560
|
if (styling === 'semantic') {
|
|
2606
2561
|
columns.push(
|
|
2607
|
-
<
|
|
2608
|
-
<
|
|
2562
|
+
<Col key="input" span={val.width} offset={val.offset}>
|
|
2563
|
+
<CapTextArea
|
|
2609
2564
|
id={val.id}
|
|
2610
2565
|
placeholder={val.placeholder ? val.placeholder : ''}
|
|
2611
2566
|
disabled={val.disabled}
|
|
2612
2567
|
className={`${ifError ? 'error' : ''}`}
|
|
2613
|
-
errorMessage={val.errorMessage
|
|
2614
|
-
label={val.label}
|
|
2568
|
+
errorMessage={val.errorMessage ? val.errorMessage : ''}
|
|
2615
2569
|
autosize={val.autosize ? val.autosizeParams : false}
|
|
2616
2570
|
onChange={(e) => this.updateFormData(e.target.value, val)}
|
|
2617
2571
|
style={val.style ? val.style : {}}
|
|
2618
2572
|
defaultValue={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2619
|
-
value={
|
|
2573
|
+
value={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2620
2574
|
rows={10}
|
|
2621
2575
|
cols={2}
|
|
2622
2576
|
/>
|
|
2623
|
-
</
|
|
2577
|
+
</Col>
|
|
2624
2578
|
);
|
|
2625
2579
|
}
|
|
2626
2580
|
break;
|
|
@@ -2628,21 +2582,19 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2628
2582
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2629
2583
|
if (styling === 'semantic') {
|
|
2630
2584
|
columns.push(
|
|
2631
|
-
<
|
|
2585
|
+
<Col key="input" span={val.width} offset={val.offset}>
|
|
2632
2586
|
<CapCheckbox
|
|
2633
|
-
key={val.id}
|
|
2634
2587
|
className={`${ifError ? 'error' : ''}`}
|
|
2635
|
-
errorMessage={val.errorMessage
|
|
2636
|
-
onChange={(e) => this.updateFormData(e.target.checked, val
|
|
2588
|
+
errorMessage={val.errorMessage ? val.errorMessage : ''}
|
|
2589
|
+
onChange={(e) => this.updateFormData(e.target.checked, val)}
|
|
2637
2590
|
checked={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2638
2591
|
defaultChecked={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2639
2592
|
style={val.style ? val.style : {}}
|
|
2640
2593
|
disabled={val.disabled}
|
|
2641
|
-
inductiveText={val.inductiveText}
|
|
2642
2594
|
>
|
|
2643
2595
|
{val.label}
|
|
2644
2596
|
</CapCheckbox>
|
|
2645
|
-
</
|
|
2597
|
+
</Col>
|
|
2646
2598
|
);
|
|
2647
2599
|
}
|
|
2648
2600
|
break;
|
|
@@ -2650,10 +2602,10 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2650
2602
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2651
2603
|
if (styling === 'semantic') {
|
|
2652
2604
|
columns.push(
|
|
2653
|
-
<
|
|
2605
|
+
<Col key={`input-${val.id}`} span={val.width} offset={val.offset}>
|
|
2654
2606
|
<CapRadio
|
|
2655
2607
|
className={`${ifError ? 'error' : ''}`}
|
|
2656
|
-
errorMessage={val.errorMessage
|
|
2608
|
+
errorMessage={val.errorMessage ? val.errorMessage : ''}
|
|
2657
2609
|
onChange={(e) => this.updateFormData(e.target.checked, val)}
|
|
2658
2610
|
checked={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
2659
2611
|
defaultChecked={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
@@ -2661,7 +2613,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2661
2613
|
>
|
|
2662
2614
|
{val.label}
|
|
2663
2615
|
</CapRadio>
|
|
2664
|
-
</
|
|
2616
|
+
</Col>
|
|
2665
2617
|
);
|
|
2666
2618
|
}
|
|
2667
2619
|
break;
|
|
@@ -2669,33 +2621,32 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2669
2621
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2670
2622
|
if (styling === 'semantic') {
|
|
2671
2623
|
columns.push(
|
|
2672
|
-
<
|
|
2624
|
+
<Col key={`input-${val.id}`} span={val.width} offset={val.offset}>
|
|
2673
2625
|
<CapRadioGroup
|
|
2674
2626
|
key={`${val.id}-radio-group`}
|
|
2675
|
-
className={
|
|
2676
|
-
errorMessage={val.errorMessage
|
|
2627
|
+
className={`${ifError ? 'error' : ''}`}
|
|
2628
|
+
errorMessage={val.errorMessage ? val.errorMessage : ''}
|
|
2677
2629
|
onChange={(e) => this.updateFormData(e.target.value, val)}
|
|
2678
2630
|
style={val.style ? val.style : {}}
|
|
2679
2631
|
value={this.handleSetRadioValue(this.state.formData, self.state.currentTab, val)}
|
|
2680
2632
|
name={val.name ? val.name : `${val.id}-name`}
|
|
2633
|
+
options={val.options}
|
|
2681
2634
|
disabled={val.disabled}
|
|
2682
2635
|
>
|
|
2683
|
-
{val.options.map((option, index) => <CapRadio value={option} inductiveText={val.inductiveText && val.inductiveText[index]}>{option}</CapRadio>) }
|
|
2684
|
-
|
|
2685
2636
|
</CapRadioGroup>
|
|
2686
2637
|
{/*{ifError ?*/}
|
|
2687
2638
|
{/*<div className="error"> {val.errorMessage}</div>*/}
|
|
2688
2639
|
{/*:*/}
|
|
2689
2640
|
{/*""*/}
|
|
2690
2641
|
{/*}*/}
|
|
2691
|
-
</
|
|
2642
|
+
</Col>
|
|
2692
2643
|
);
|
|
2693
2644
|
}
|
|
2694
2645
|
break;
|
|
2695
2646
|
case 'image':
|
|
2696
2647
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2697
2648
|
columns.push(
|
|
2698
|
-
<
|
|
2649
|
+
<Col key={`input-${val.id}${self.state.currentTab - 1}`} style={val.style} span={val.width} offset={val.offset}>
|
|
2699
2650
|
<div>
|
|
2700
2651
|
<div className={`image-container ${ifError ? 'error' : ''}`}>
|
|
2701
2652
|
{self.state && !!self.state.formData[`${self.state.currentTab - 1}`].image ?
|
|
@@ -2706,37 +2657,21 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2706
2657
|
</div>
|
|
2707
2658
|
{ifError && <span className="error">{val.errorMessage}</span>}
|
|
2708
2659
|
</div>
|
|
2709
|
-
</
|
|
2660
|
+
</Col>
|
|
2710
2661
|
);
|
|
2711
2662
|
break;
|
|
2712
2663
|
case 'upload':
|
|
2713
|
-
ifError = (this.state.checkValidation || this.props.startValidation) && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2714
|
-
const ImageComponent = (props) => (
|
|
2715
|
-
<div key={`${val.id}-${this.state.currentTab}`}>
|
|
2716
|
-
<div className={`image-container ${props.ifError ? 'error' : ''}`}>
|
|
2717
|
-
{self.state && !!self.state.formData[`${self.state.currentTab - 1}`].image ?
|
|
2718
|
-
<img src={self.state.formData[`${self.state.currentTab - 1}`].image} alt={props.alt} style={props.style}/>
|
|
2719
|
-
:
|
|
2720
|
-
<div style={{width: "100%", textAlign: "center"}}><span className="image-placeholder">{props.placeholder}</span></div>
|
|
2721
|
-
}
|
|
2722
|
-
</div>
|
|
2723
|
-
</div>
|
|
2724
|
-
);
|
|
2725
|
-
const WithLabel = LabelHOC(ImageComponent);
|
|
2726
|
-
const {errorMessage, ...rest} = val.previewProps || {};
|
|
2727
2664
|
columns.push(
|
|
2728
|
-
<
|
|
2729
|
-
{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}>
|
|
2730
2666
|
<form encType="multipart/form-data" id={val.id}>
|
|
2731
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/*"} />
|
|
2732
2668
|
<CapButton disabled={val.disabled ? val.disabled : false} type="secondary" onClick={(e) => this.openFileDialog(e, val.id)} style={{float: 'right'}}>
|
|
2733
2669
|
{val.label}
|
|
2734
2670
|
</CapButton>
|
|
2735
2671
|
</form>
|
|
2736
|
-
</
|
|
2737
|
-
|
|
2672
|
+
</Col>
|
|
2673
|
+
);
|
|
2738
2674
|
break;
|
|
2739
|
-
|
|
2740
2675
|
case "table":
|
|
2741
2676
|
columns.push(
|
|
2742
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}>
|
|
@@ -2746,7 +2681,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2746
2681
|
break;
|
|
2747
2682
|
case "tag-list":
|
|
2748
2683
|
columns.push(
|
|
2749
|
-
<
|
|
2684
|
+
<Col key={`input-${val.id}`} offset={val.offset} span={val.width ? val.width : ''} style={val.style ? val.style : {marginBottom: '16px'}}>
|
|
2750
2685
|
<TagList
|
|
2751
2686
|
key={`input-${val.id}`}
|
|
2752
2687
|
moduleFilterEnabled={this.props.location && this.props.location.query && this.props.location.query.type !== 'embedded'}
|
|
@@ -2760,21 +2695,21 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2760
2695
|
id={val.id}
|
|
2761
2696
|
userLocale={this.props.userLocale}
|
|
2762
2697
|
/>
|
|
2763
|
-
</
|
|
2698
|
+
</Col>
|
|
2764
2699
|
);
|
|
2765
2700
|
break;
|
|
2766
2701
|
case "button":
|
|
2767
2702
|
if (styling === 'semantic' && val.metaType === 'submit-button') {
|
|
2768
2703
|
columns.push(
|
|
2769
|
-
<
|
|
2704
|
+
<Col style={val.colStyle ? val.colStyle : {}} span={val.width} offset={val.offset}>
|
|
2770
2705
|
<CapButton
|
|
2771
2706
|
type={val.buttonType}
|
|
2772
2707
|
icon={val.icon}
|
|
2773
2708
|
disabled={val.disabled ? val.disabled : false}
|
|
2774
|
-
onClick={(data) => this.callChildEvent(data, val, val.submitAction)}>
|
|
2709
|
+
onClick={(data) => val.id === 'save-button' ? this.saveForm() : this.callChildEvent(data, val, val.submitAction)}>
|
|
2775
2710
|
{val.value}
|
|
2776
2711
|
</CapButton>
|
|
2777
|
-
</
|
|
2712
|
+
</Col>
|
|
2778
2713
|
);
|
|
2779
2714
|
}
|
|
2780
2715
|
break;
|
|
@@ -2787,7 +2722,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2787
2722
|
content = isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][`sms-editor${this.state.currentTab > 1 ? this.state.currentTab : ''}`] : this.state.formData[val.id];
|
|
2788
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'];
|
|
2789
2724
|
columns.push(
|
|
2790
|
-
<
|
|
2725
|
+
<Col key="input" span={23} offset={1}>
|
|
2791
2726
|
<TemplatePreview
|
|
2792
2727
|
key={val.id}
|
|
2793
2728
|
style={val.customStyling ? val.customStyling : {}}
|
|
@@ -2797,7 +2732,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2797
2732
|
unicodeEnabled={unicodeEnabled}
|
|
2798
2733
|
>
|
|
2799
2734
|
</TemplatePreview>
|
|
2800
|
-
</
|
|
2735
|
+
</Col>
|
|
2801
2736
|
);
|
|
2802
2737
|
}
|
|
2803
2738
|
break;
|
|
@@ -2811,7 +2746,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2811
2746
|
}
|
|
2812
2747
|
|
|
2813
2748
|
columns.push(
|
|
2814
|
-
<
|
|
2749
|
+
<Col key="input" span={23} offset={1}>
|
|
2815
2750
|
<TemplatePreview
|
|
2816
2751
|
key={val.id}
|
|
2817
2752
|
style={val.customStyling ? val.customStyling : {}}
|
|
@@ -2819,7 +2754,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2819
2754
|
content={content}
|
|
2820
2755
|
>
|
|
2821
2756
|
</TemplatePreview>
|
|
2822
|
-
</
|
|
2757
|
+
</Col>
|
|
2823
2758
|
);
|
|
2824
2759
|
}
|
|
2825
2760
|
break;
|
|
@@ -2828,7 +2763,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2828
2763
|
return true;
|
|
2829
2764
|
}
|
|
2830
2765
|
columns.push(
|
|
2831
|
-
<
|
|
2766
|
+
<Col key="input" span={23} offset={1}>
|
|
2832
2767
|
<TemplatePreview
|
|
2833
2768
|
key={val.id}
|
|
2834
2769
|
device={val.device ? val.device : 'android'}
|
|
@@ -2846,7 +2781,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2846
2781
|
}}
|
|
2847
2782
|
>
|
|
2848
2783
|
</TemplatePreview>
|
|
2849
|
-
</
|
|
2784
|
+
</Col>
|
|
2850
2785
|
);
|
|
2851
2786
|
break;
|
|
2852
2787
|
case "popover":
|
|
@@ -2859,7 +2794,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2859
2794
|
return result;
|
|
2860
2795
|
});
|
|
2861
2796
|
columns.push(
|
|
2862
|
-
<
|
|
2797
|
+
<Col style={val.colStyle ? val.colStyle : {}} span={val.width} offset={val.offset}>
|
|
2863
2798
|
<CapPopover
|
|
2864
2799
|
trigger={val.trigger}
|
|
2865
2800
|
placement={val.placement}
|
|
@@ -2883,7 +2818,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2883
2818
|
})
|
|
2884
2819
|
}
|
|
2885
2820
|
</CapPopover>
|
|
2886
|
-
</
|
|
2821
|
+
</Col>
|
|
2887
2822
|
);
|
|
2888
2823
|
break;
|
|
2889
2824
|
|
|
@@ -2895,7 +2830,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2895
2830
|
}
|
|
2896
2831
|
}
|
|
2897
2832
|
columns.push(
|
|
2898
|
-
<
|
|
2833
|
+
<Col
|
|
2899
2834
|
key={`icon-${val.id}`}
|
|
2900
2835
|
id={val.id}
|
|
2901
2836
|
offset={val.offset}
|
|
@@ -2905,14 +2840,14 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2905
2840
|
style={val.colStyle ? val.colStyle : {}}
|
|
2906
2841
|
>
|
|
2907
2842
|
<i style={val.style ? val.style : {}} className="material-icons">{val.value ? val.value : ''}</i>
|
|
2908
|
-
</
|
|
2843
|
+
</Col>
|
|
2909
2844
|
);
|
|
2910
2845
|
break;
|
|
2911
2846
|
case "select": {
|
|
2912
2847
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2913
2848
|
const options = (this.state.formData[`${val.id}-options`]) ? (this.state.formData[`${val.id}-options`]) : val.options;
|
|
2914
2849
|
columns.push(
|
|
2915
|
-
<
|
|
2850
|
+
<Col style={val.colStyle ? val.colStyle : {}} span={val.width}>
|
|
2916
2851
|
<CapSelect
|
|
2917
2852
|
id={val.id}
|
|
2918
2853
|
options={options}
|
|
@@ -2925,7 +2860,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2925
2860
|
{ifError && val.errorMessage &&
|
|
2926
2861
|
<span className={'error'}>{val.errorMessage}</span>
|
|
2927
2862
|
}
|
|
2928
|
-
</
|
|
2863
|
+
</Col>
|
|
2929
2864
|
);
|
|
2930
2865
|
}
|
|
2931
2866
|
break;
|
|
@@ -2951,15 +2886,15 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2951
2886
|
if (val.id.indexOf('template-content') > -1 && val.id !== 'template-content') {
|
|
2952
2887
|
langIndex = parseInt(val.id.replace('template-content', ''), 10) - 1;
|
|
2953
2888
|
}
|
|
2954
|
-
|
|
2889
|
+
|
|
2955
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;
|
|
2956
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'] : '');
|
|
2957
|
-
|
|
2892
|
+
|
|
2958
2893
|
if (this.state.formData[`${this.state.currentTab - 1}`][currentLang].is_drag_drop) {
|
|
2959
2894
|
// content = "";
|
|
2960
2895
|
}
|
|
2961
2896
|
columns.push(
|
|
2962
|
-
<
|
|
2897
|
+
<Col style={val.colStyle ? val.colStyle : {}} span={val.width}>
|
|
2963
2898
|
<CKEditor
|
|
2964
2899
|
id={val.id}
|
|
2965
2900
|
content={content}
|
|
@@ -2967,7 +2902,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2967
2902
|
getEditorInstanse={(evt, id) => val.injectedEvents.getEditorInstanse.call(this, evt, id)}
|
|
2968
2903
|
handleContentChange={(event) => this.callChildEvent(event, val, 'onContentChange')}
|
|
2969
2904
|
/>
|
|
2970
|
-
</
|
|
2905
|
+
</Col>
|
|
2971
2906
|
);
|
|
2972
2907
|
}
|
|
2973
2908
|
}
|
|
@@ -2999,13 +2934,13 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2999
2934
|
|
|
3000
2935
|
|
|
3001
2936
|
columns.push(
|
|
3002
|
-
<
|
|
2937
|
+
<Col style={val.colStyle ? val.colStyle : {}} span={val.width}>
|
|
3003
2938
|
<EDMEditor
|
|
3004
2939
|
id={val.id}
|
|
3005
2940
|
getEditorInstanse={this.getEditorInstanse}
|
|
3006
2941
|
edmSrc={edmSrc}
|
|
3007
2942
|
/>
|
|
3008
|
-
</
|
|
2943
|
+
</Col>
|
|
3009
2944
|
);
|
|
3010
2945
|
}
|
|
3011
2946
|
break;
|
|
@@ -3014,7 +2949,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3014
2949
|
return true;
|
|
3015
2950
|
}
|
|
3016
2951
|
columns.push(
|
|
3017
|
-
<
|
|
2952
|
+
<Col style={val.colStyle ? val.colStyle : {}} span={val.width}>
|
|
3018
2953
|
<CustomPopOver
|
|
3019
2954
|
id={val.id}
|
|
3020
2955
|
popOverList={this.props.supportedLanguages}
|
|
@@ -3023,7 +2958,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3023
2958
|
visible={this.state.customPopoverVisible}
|
|
3024
2959
|
onVisibleChange={this.handleCustomPopoverVisibleChange}
|
|
3025
2960
|
/>
|
|
3026
|
-
</
|
|
2961
|
+
</Col>
|
|
3027
2962
|
);
|
|
3028
2963
|
}
|
|
3029
2964
|
break;
|
|
@@ -3033,7 +2968,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3033
2968
|
return true;
|
|
3034
2969
|
});
|
|
3035
2970
|
const row = (
|
|
3036
|
-
<
|
|
2971
|
+
<Row style={field.rowStyle ? field.rowStyle : {}} className={field.rowClassName ? field.rowClassName : ''}>
|
|
3037
2972
|
{
|
|
3038
2973
|
_.forEach(columns, (value) => {
|
|
3039
2974
|
if (value) {
|
|
@@ -3042,7 +2977,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3042
2977
|
return value;
|
|
3043
2978
|
})
|
|
3044
2979
|
}
|
|
3045
|
-
</
|
|
2980
|
+
</Row>
|
|
3046
2981
|
);
|
|
3047
2982
|
fields.push(row);
|
|
3048
2983
|
});
|
|
@@ -3056,7 +2991,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3056
2991
|
case "button":
|
|
3057
2992
|
if (styling === 'semantic' && val.metaType === 'submit-button') {
|
|
3058
2993
|
columns.push(
|
|
3059
|
-
<
|
|
2994
|
+
<Col span={3}>
|
|
3060
2995
|
<CapButton
|
|
3061
2996
|
type={val.buttonType}
|
|
3062
2997
|
icon={val.icon}
|
|
@@ -3064,7 +2999,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3064
2999
|
onClick={(data) => val.id === 'save-button' ? this.saveForm() : this.callChildEvent(data, val, val.submitAction)}>
|
|
3065
3000
|
{val.value}
|
|
3066
3001
|
</CapButton>
|
|
3067
|
-
</
|
|
3002
|
+
</Col>
|
|
3068
3003
|
);
|
|
3069
3004
|
}
|
|
3070
3005
|
break;
|
|
@@ -3073,7 +3008,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3073
3008
|
}
|
|
3074
3009
|
});
|
|
3075
3010
|
const row = (
|
|
3076
|
-
<
|
|
3011
|
+
<Row>
|
|
3077
3012
|
{
|
|
3078
3013
|
_.forEach(columns, (value) => {
|
|
3079
3014
|
if (value) {
|
|
@@ -3082,7 +3017,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3082
3017
|
return value;
|
|
3083
3018
|
})
|
|
3084
3019
|
}
|
|
3085
|
-
</
|
|
3020
|
+
</Row>
|
|
3086
3021
|
);
|
|
3087
3022
|
fields.push(row);
|
|
3088
3023
|
});
|
|
@@ -3128,35 +3063,33 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3128
3063
|
const currentLang = this.state.formData[this.state.currentTab - 1].selectedLanguages[index];
|
|
3129
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;
|
|
3130
3065
|
}
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
tab={
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
_.forEach(renderedContentSections, (value) => {
|
|
3140
|
-
if (value) {
|
|
3141
|
-
return value;
|
|
3142
|
-
}
|
|
3143
|
-
return value;
|
|
3144
|
-
})
|
|
3145
|
-
}
|
|
3146
|
-
</div>
|
|
3147
|
-
}
|
|
3148
|
-
key={paneTabKey && paneTabKey !== '' ? `${paneTabKey}` : index}>
|
|
3149
|
-
{
|
|
3150
|
-
_.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) => {
|
|
3151
3074
|
if (value) {
|
|
3152
3075
|
return value;
|
|
3153
3076
|
}
|
|
3154
3077
|
return value;
|
|
3155
3078
|
})
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
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;
|
|
3160
3093
|
});
|
|
3161
3094
|
extraActionSections = container.tabBarExtraContent && container.tabBarExtraContent.sections ? container.tabBarExtraContent.sections.map((section) => {
|
|
3162
3095
|
result = this.renderSection(section);
|
|
@@ -3168,6 +3101,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3168
3101
|
}
|
|
3169
3102
|
return (
|
|
3170
3103
|
<Tabs
|
|
3104
|
+
className={`cap-tabs-${container.id}`}
|
|
3171
3105
|
activeKey={activeTabKey && activeTabKey !== '' ? `${activeTabKey}` : '1'}
|
|
3172
3106
|
defaultActiveKey={activeTabKey && activeTabKey !== '' ? `${activeTabKey}` : '1'}
|
|
3173
3107
|
onChange={(data, e) => { this.callChildEvent(data, container, 'onTabChange', e); }}
|
|
@@ -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
|
}
|