@capillarytech/creatives-library 8.0.136-alpha.4 → 8.0.136-beta.3
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/BreadCrumbs/index.js +65 -0
- package/components/BreadCrumbs/messages.js +13 -0
- package/components/CapTagList/index.js +235 -0
- package/components/CapTagList/messages.js +45 -0
- package/components/Card/_customCard.scss +40 -0
- package/components/Card/index.js +78 -0
- package/components/Card/tests/__snapshots__/index.test.js.snap +22 -0
- package/components/Card/tests/index.test.js +20 -0
- package/components/CardGrid/index.js +71 -0
- package/components/Ckeditor/index.js +238 -0
- package/components/Ckeditor/messages.js +13 -0
- package/components/Ckeditor/style.scss +3 -0
- package/components/Component/index.js +29 -0
- package/components/CustomPopOver/index.js +81 -0
- package/components/CustomPopOver/messages.js +17 -0
- package/components/DateFilter/index.js +349 -0
- package/components/DateFilter/messages.js +57 -0
- package/components/DateRange/index.js +114 -0
- package/components/DateRange/messages.js +25 -0
- package/components/Edmeditor/index.js +65 -0
- package/components/Edmeditor/messages.js +13 -0
- package/components/EmailPreview/_emailPreview.scss +119 -0
- package/components/EmailPreview/assets/images/iPad.svg +10 -0
- package/components/EmailPreview/assets/images/mobile.png +0 -0
- package/components/EmailPreview/index.js +107 -0
- package/components/EmailPreview/messages.js +33 -0
- package/components/Footer/index.js +27 -0
- package/components/Footer/messages.js +13 -0
- package/components/FormBuilder/_formBuilder.scss +83 -0
- package/components/FormBuilder/index.js +3279 -0
- package/components/FormBuilder/messages.js +61 -0
- package/components/Header/index.js +44 -0
- package/components/Header/messages.js +29 -0
- package/components/ImagePreview/_imagePreview.scss +63 -0
- package/components/ImagePreview/index.js +52 -0
- package/components/ImagePreview/messages.js +17 -0
- package/components/PageHeader/_pageHeader.scss +22 -0
- package/components/PageHeader/index.js +37 -0
- package/components/PageHeader/messages.js +13 -0
- package/components/Pagination/_pagination.scss +5 -0
- package/components/Pagination/index.js +49 -0
- package/components/PreviewSideBar/_previewsidebar.scss +28 -0
- package/components/PreviewSideBar/index.js +152 -0
- package/components/PreviewSideBar/messages.js +41 -0
- package/components/Sidebar/_sidebar.scss +115 -0
- package/components/Sidebar/index.js +214 -0
- package/components/Sidebar/messages.js +21 -0
- package/components/SlideBox/_slideBox.scss +63 -0
- package/components/SlideBox/index.js +47 -0
- package/components/SlideBox/tests/index.test.js +103 -0
- package/components/SmsEditor/index.js +55 -0
- package/components/SmsTest/index.js +117 -0
- package/components/SmsTest/messages.js +21 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +42 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +141 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +21 -0
- package/components/TemplatePreview/_templatePreview.scss +642 -0
- package/components/TemplatePreview/assets/images/WECHAT_5x.png +0 -0
- package/components/TemplatePreview/assets/images/androidPushMessage.svg +45 -0
- package/components/TemplatePreview/assets/images/home-screen-android.svg +21 -0
- package/components/TemplatePreview/assets/images/home-screen-ios.svg +16 -0
- package/components/TemplatePreview/assets/images/iPhonePushMessage.svg +135 -0
- package/components/TemplatePreview/assets/images/mobile.svg +24 -0
- package/components/TemplatePreview/assets/images/sms-body.png +0 -0
- package/components/TemplatePreview/assets/images/sms-icon.png +0 -0
- package/components/TemplatePreview/assets/images/sms_mobile.png +0 -0
- package/components/TemplatePreview/assets/images/sms_mobile_android.svg +22 -0
- package/components/TemplatePreview/assets/images/sms_mobile_ios.svg +16 -0
- package/components/TemplatePreview/assets/images/user-icon.svg +19 -0
- package/components/TemplatePreview/assets/images/wechat-mobile.svg +78 -0
- package/components/TemplatePreview/assets/images/wechat_mobile_android.svg +20 -0
- package/components/TemplatePreview/index.js +617 -0
- package/components/TemplatePreview/messages.js +78 -0
- package/components/Toastr/index.js +60 -0
- package/components/Toastr/messages.js +13 -0
- package/components/ToastrMessage/index.js +113 -0
- package/components/ToastrMessage/messages.js +17 -0
- package/components/TopBar/_topbar.scss +46 -0
- package/components/TopBar/assets/images/capillary_logo.png +0 -0
- package/components/TopBar/assets/images/old_capillary_logo.png +0 -0
- package/components/TopBar/index.js +113 -0
- package/components/TopBar/messages.js +29 -0
- package/containers/App/actions.js +7 -0
- package/containers/App/constants.js +114 -0
- package/containers/App/index.js +52 -0
- package/containers/App/reducer.js +19 -0
- package/containers/App/sagas.js +31 -0
- package/containers/App/selectors.js +25 -0
- package/containers/App/test/saga.test.js +11 -0
- package/containers/Assets/Gallery/_gallery.scss +126 -0
- package/containers/Assets/Gallery/actions.js +37 -0
- package/containers/Assets/Gallery/constants.js +23 -0
- package/containers/Assets/Gallery/index.js +473 -0
- package/containers/Assets/Gallery/messages.js +93 -0
- package/containers/Assets/Gallery/reducer.js +81 -0
- package/containers/Assets/Gallery/sagas.js +80 -0
- package/containers/Assets/Gallery/selectors.js +25 -0
- package/containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +9 -0
- package/containers/Assets/Gallery/tests/actions.test.js +25 -0
- package/containers/Assets/Gallery/tests/reducer.test.js +96 -0
- package/containers/Assets/Gallery/tests/saga.test.js +157 -0
- package/containers/Cap/actions.js +66 -0
- package/containers/Cap/constants.js +25 -0
- package/containers/Cap/index.js +402 -0
- package/containers/Cap/messages.js +75 -0
- package/containers/Cap/reducer.js +113 -0
- package/containers/Cap/sagas.js +159 -0
- package/containers/Cap/selectors.js +75 -0
- package/containers/Cap/tests/__snapshots__/index.test.js.snap +2269 -0
- package/containers/Cap/tests/index.test.js +22 -0
- package/containers/Cap/tests/saga.test.js +284 -0
- package/containers/Dashboard/actions.js +15 -0
- package/containers/Dashboard/constants.js +7 -0
- package/containers/Dashboard/index.js +76 -0
- package/containers/Dashboard/messages.js +13 -0
- package/containers/Dashboard/reducer.js +21 -0
- package/containers/Dashboard/sagas.js +17 -0
- package/containers/Dashboard/selectors.js +25 -0
- package/containers/Dashboard/test/saga.test.js +9 -0
- package/containers/Ebill/_ebill.scss +5 -0
- package/containers/Ebill/actions.js +43 -0
- package/containers/Ebill/constants.js +20 -0
- package/containers/Ebill/index.js +1278 -0
- package/containers/Ebill/messages.js +77 -0
- package/containers/Ebill/reducer.js +72 -0
- package/containers/Ebill/sagas.js +74 -0
- package/containers/Ebill/selectors.js +25 -0
- package/containers/Ebill/test/saga.test.js +11 -0
- package/containers/Email/_email.scss +141 -0
- package/containers/Email/actions.js +81 -0
- package/containers/Email/constants.js +36 -0
- package/containers/Email/index.js +3325 -0
- package/containers/Email/messages.js +289 -0
- package/containers/Email/reducer.js +142 -0
- package/containers/Email/sagas.js +135 -0
- package/containers/Email/selectors.js +31 -0
- package/containers/Email/test/saga.test.js +671 -0
- package/containers/LanguageProvider/actions.js +17 -0
- package/containers/LanguageProvider/constants.js +8 -0
- package/containers/LanguageProvider/index.js +80 -0
- package/containers/LanguageProvider/reducer.js +30 -0
- package/containers/LanguageProvider/selectors.js +20 -0
- package/containers/LanguageProvider/tests/actions.test.js +19 -0
- package/containers/LanguageProvider/tests/index.test.js +78 -0
- package/containers/LanguageProvider/tests/reducer.test.js +20 -0
- package/containers/LanguageProvider/tests/selectors.test.js +15 -0
- package/containers/Line/Create/_lineCreate.scss +54 -0
- package/containers/Line/Create/actions.js +90 -0
- package/containers/Line/Create/constants.js +39 -0
- package/containers/Line/Create/index.js +836 -0
- package/containers/Line/Create/messages.js +189 -0
- package/containers/Line/Create/reducer.js +99 -0
- package/containers/Line/Create/sagas.js +121 -0
- package/containers/Line/Create/selectors.js +36 -0
- package/containers/Line/Create/tests/saga.test.js +202 -0
- package/containers/Line/Edit/_lineEdit.scss +35 -0
- package/containers/Line/Edit/actions.js +79 -0
- package/containers/Line/Edit/constants.js +27 -0
- package/containers/Line/Edit/index.js +1050 -0
- package/containers/Line/Edit/messages.js +177 -0
- package/containers/Line/Edit/reducer.js +83 -0
- package/containers/Line/Edit/sagas.js +80 -0
- package/containers/Line/Edit/selectors.js +29 -0
- package/containers/Line/Edit/test/saga.test.js +160 -0
- package/containers/Login/assets/images/capillary_logo.png +0 -0
- package/containers/Login/components/LoginForm/index.js +62 -0
- package/containers/Login/components/LoginForm/messages.js +33 -0
- package/containers/Login/index.js +130 -0
- package/containers/Login/messages.js +25 -0
- package/containers/Login/selectors.js +25 -0
- package/containers/MobilePush/Create/_mobilePushCreate.scss +39 -0
- package/containers/MobilePush/Create/actions.js +46 -0
- package/containers/MobilePush/Create/constants.js +23 -0
- package/containers/MobilePush/Create/index.js +2303 -0
- package/containers/MobilePush/Create/messages.js +269 -0
- package/containers/MobilePush/Create/reducer.js +70 -0
- package/containers/MobilePush/Create/sagas.js +74 -0
- package/containers/MobilePush/Create/selectors.js +28 -0
- package/containers/MobilePush/Create/test/saga.test.js +19 -0
- package/containers/MobilePush/Edit/_mobilePushCreate.scss +39 -0
- package/containers/MobilePush/Edit/actions.js +91 -0
- package/containers/MobilePush/Edit/constants.js +35 -0
- package/containers/MobilePush/Edit/index.js +2601 -0
- package/containers/MobilePush/Edit/messages.js +266 -0
- package/containers/MobilePush/Edit/reducer.js +112 -0
- package/containers/MobilePush/Edit/sagas.js +126 -0
- package/containers/MobilePush/Edit/selectors.js +29 -0
- package/containers/MobilePush/Edit/tests/saga.test.js +255 -0
- package/containers/NotFoundPage/index.js +25 -0
- package/containers/NotFoundPage/messages.js +13 -0
- package/containers/NotFoundPage/tests/index.test.js +17 -0
- package/containers/Sms/Create/_smsCreate.scss +42 -0
- package/containers/Sms/Create/actions.js +27 -0
- package/containers/Sms/Create/constants.js +16 -0
- package/containers/Sms/Create/index.js +1488 -0
- package/containers/Sms/Create/messages.js +109 -0
- package/containers/Sms/Create/reducer.js +41 -0
- package/containers/Sms/Create/sagas.js +40 -0
- package/containers/Sms/Create/selectors.js +28 -0
- package/containers/Sms/Create/test/saga.test.js +11 -0
- package/containers/Sms/Edit/actions.js +40 -0
- package/containers/Sms/Edit/constants.js +17 -0
- package/containers/Sms/Edit/index.js +1472 -0
- package/containers/Sms/Edit/messages.js +105 -0
- package/containers/Sms/Edit/reducer.js +50 -0
- package/containers/Sms/Edit/sagas.js +60 -0
- package/containers/Sms/Edit/selectors.js +32 -0
- package/containers/Sms/Edit/test/saga.test.js +13 -0
- package/containers/TagList/_tagList.scss +8 -0
- package/containers/TagList/actions.js +15 -0
- package/containers/TagList/constants.js +32 -0
- package/containers/TagList/index.js +236 -0
- package/containers/TagList/messages.js +13 -0
- package/containers/TagList/reducer.js +23 -0
- package/containers/TagList/sagas.js +11 -0
- package/containers/TagList/selectors.js +25 -0
- package/containers/Templates/_templates.scss +333 -0
- package/containers/Templates/actions.js +103 -0
- package/containers/Templates/constants.js +60 -0
- package/containers/Templates/index.js +1756 -0
- package/containers/Templates/messages.js +337 -0
- package/containers/Templates/reducer.js +142 -0
- package/containers/Templates/sagas.js +163 -0
- package/containers/Templates/selectors.js +28 -0
- package/containers/Templates/test/saga.test.js +241 -0
- package/containers/WeChat/MapTemplates/_mapTemplates.scss +8 -0
- package/containers/WeChat/MapTemplates/actions.js +52 -0
- package/containers/WeChat/MapTemplates/constants.js +28 -0
- package/containers/WeChat/MapTemplates/index.js +1610 -0
- package/containers/WeChat/MapTemplates/messages.js +157 -0
- package/containers/WeChat/MapTemplates/reducer.js +74 -0
- package/containers/WeChat/MapTemplates/sagas.js +84 -0
- package/containers/WeChat/MapTemplates/selectors.js +25 -0
- package/containers/WeChat/MapTemplates/test/saga.test.js +155 -0
- package/containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +57 -0
- package/containers/WeChat/RichmediaTemplates/Create/actions.js +36 -0
- package/containers/WeChat/RichmediaTemplates/Create/constants.js +15 -0
- package/containers/WeChat/RichmediaTemplates/Create/index.js +1071 -0
- package/containers/WeChat/RichmediaTemplates/Create/messages.js +165 -0
- package/containers/WeChat/RichmediaTemplates/Create/reducer.js +60 -0
- package/containers/WeChat/RichmediaTemplates/Create/richmediaschema.js +497 -0
- package/containers/WeChat/RichmediaTemplates/Create/sagas.js +51 -0
- package/containers/WeChat/RichmediaTemplates/Create/selectors.js +37 -0
- package/containers/WeChat/RichmediaTemplates/Create/test/saga.test.js +13 -0
- package/containers/WeChat/RichmediaTemplates/Edit/actions.js +20 -0
- package/containers/WeChat/RichmediaTemplates/Edit/constants.js +10 -0
- package/containers/WeChat/RichmediaTemplates/Edit/index.js +136 -0
- package/containers/WeChat/RichmediaTemplates/Edit/messages.js +13 -0
- package/containers/WeChat/RichmediaTemplates/Edit/reducer.js +28 -0
- package/containers/WeChat/RichmediaTemplates/Edit/sagas.js +36 -0
- package/containers/WeChat/RichmediaTemplates/Edit/selectors.js +30 -0
- package/containers/WeChat/RichmediaTemplates/Edit/test/saga.test.js +12 -0
- package/containers/WeChat/RichmediaTemplates/View/actions.js +15 -0
- package/containers/WeChat/RichmediaTemplates/View/constants.js +7 -0
- package/containers/WeChat/RichmediaTemplates/View/index.js +47 -0
- package/containers/WeChat/RichmediaTemplates/View/messages.js +21 -0
- package/containers/WeChat/RichmediaTemplates/View/reducer.js +23 -0
- package/containers/WeChat/RichmediaTemplates/View/sagas.js +11 -0
- package/containers/WeChat/RichmediaTemplates/View/selectors.js +25 -0
- package/index.js +2 -4
- package/package.json +1 -1
- package/routes.js +202 -136
- package/services/getSchema.js +1 -1
- package/services/localStorageApi.js +0 -1
- package/tests/i18n.test.js +1 -1
- package/utils/asyncInjectors.js +78 -0
- package/utils/authWrapper.js +1 -1
- package/utils/callNativeEvent.js +16 -0
- package/utils/checkStore.js +21 -0
- package/utils/common.js +2 -2
- package/utils/customAuthWrapper.js +62 -0
- package/utils/customConnectedAuthWrapper.js +26 -0
- package/utils/tagValidations.js +1 -1
- package/utils/tests/checkStore.test.js +1 -1
- package/utils/tests/customAuth.test.js +1 -1
- package/utils/transformerUtils.js +195 -1
- package/v2Components/CapTagList/index.js +14 -9
- package/v2Components/Carousel/style.scss +1 -1
- package/v2Components/EmailMobilePreview/index.js +2 -2
- package/v2Components/FormBuilder/index.js +2 -2
- package/v2Components/TemplatePreview/index.js +1 -2
- package/v2Containers/Cap/tests/saga.test.js +1 -1
- package/v2Containers/Email/index.js +1 -1
- package/v2Containers/FTP/index.js +1 -1
- package/v2Containers/Line/Container/Text/index.js +6 -6
- package/v2Containers/Sms/Create/index.js +2 -2
- package/v2Containers/Sms/Edit/index.js +1 -1
- package/v2Containers/TagList/index.js +1 -1
- package/v2Containers/TagList/utils.js +1 -1
- package/v2Containers/Templates/index.js +1 -1
- package/v2Containers/Templates/sagas.js +1 -1
- package/constants/unified.js +0 -189
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* DateFilter
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
// import styled from 'styled-components';
|
|
11
|
+
|
|
12
|
+
import { FormattedMessage } from 'react-intl';
|
|
13
|
+
import { Popup, Input, Button, Grid, Checkbox, Dimmer, Loader } from 'semantic-ui-react';
|
|
14
|
+
import DateRange from 'components/DateRange';
|
|
15
|
+
import moment from 'moment';
|
|
16
|
+
import _ from 'lodash';
|
|
17
|
+
import messages from './messages';
|
|
18
|
+
|
|
19
|
+
class DateFilter extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
20
|
+
constructor(props) {
|
|
21
|
+
super(props);
|
|
22
|
+
this.state = {
|
|
23
|
+
selectedDateRange: this.props.selectedDateRange,
|
|
24
|
+
showChartCompareOptions: this.props.isCompareSelected,
|
|
25
|
+
compareDateRange: this.props.compareDateRange,
|
|
26
|
+
selectedDateText: '',
|
|
27
|
+
isDateSelectorOpen: false,
|
|
28
|
+
loading: this.props.loading,
|
|
29
|
+
openCustomDatePicker: false,
|
|
30
|
+
compareCustomDateSelected: false,
|
|
31
|
+
customDateSelected: false,
|
|
32
|
+
pastStateData: {},
|
|
33
|
+
componentWidth: 270,
|
|
34
|
+
};
|
|
35
|
+
this.handleToggleDateSelector = this.handleToggleDateSelector.bind(this);
|
|
36
|
+
this.renderDateSelector = this.renderDateSelector.bind(this);
|
|
37
|
+
this.handleDateTypeClick = this.handleDateTypeClick.bind(this);
|
|
38
|
+
this.printSelectedDate = this.printSelectedDate.bind(this);
|
|
39
|
+
this.handleCancel = this.handleCancel.bind(this);
|
|
40
|
+
this.handleChartCompareToggle = this.handleChartCompareToggle.bind(this);
|
|
41
|
+
this.handleCompareDateChange = this.handleCompareDateChange.bind(this);
|
|
42
|
+
this.handleCustomDatePickerCancel = this.handleCustomDatePickerCancel.bind(this);
|
|
43
|
+
this.handleDatePickerApply = this.handleDatePickerApply.bind(this);
|
|
44
|
+
this.compareDateValueSetting = this.compareDateValueSetting.bind(this);
|
|
45
|
+
this.handleApply = this.handleApply.bind(this);
|
|
46
|
+
this.restoreInitialState = this.restoreInitialState.bind(this);
|
|
47
|
+
this.storeInitialState = this.storeInitialState.bind(this);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
componentWillMount() {
|
|
51
|
+
const dateText = this.printSelectedDate(this.state.selectedDateRange.startDate, this.state.selectedDateRange.endDate, this.state.selectedDateRange.dateType);
|
|
52
|
+
this.setState({ selectedDateText: dateText });
|
|
53
|
+
this.setState({ loading: false });
|
|
54
|
+
this.storeInitialState();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
componentDidMount() {
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
componentWillReceiveProps(nextProp) {
|
|
61
|
+
this.setState({ selectedDateRange: nextProp.selectedDateRange, showChartCompareOptions: nextProp.isCompareSelected }, () => {
|
|
62
|
+
let dateText = this.printSelectedDate(this.state.selectedDateRange.startDate, this.state.selectedDateRange.endDate, this.state.selectedDateRange.dateType);
|
|
63
|
+
if (this.state.showChartCompareOptions) {
|
|
64
|
+
this.setState({ componentWidth: 450 });
|
|
65
|
+
dateText = `${dateText} vs ${this.printSelectedDate(this.state.compareDateRange.startDate, this.state.compareDateRange.endDate, this.state.compareDateRange.dateType, true)}`;
|
|
66
|
+
} else {
|
|
67
|
+
this.setState({ componentWidth: 270 });
|
|
68
|
+
}
|
|
69
|
+
this.setState({ selectedDateText: dateText });
|
|
70
|
+
});
|
|
71
|
+
this.storeInitialState();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
storeInitialState() {
|
|
75
|
+
const stateData = _.cloneDeep(this.state);
|
|
76
|
+
const tmpState = {
|
|
77
|
+
selectedDateRange: stateData.selectedDateRange,
|
|
78
|
+
showChartCompareOptions: stateData.showChartCompareOptions,
|
|
79
|
+
compareDateRange: stateData.compareDateRange,
|
|
80
|
+
};
|
|
81
|
+
this.setState({ pastStateData: tmpState });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
handleToggleDateSelector() {
|
|
85
|
+
this.setState({ isDateSelectorOpen: !this.state.isDateSelectorOpen });
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
handleDateTypeClick(specifier) {
|
|
89
|
+
const date = this.state.selectedDateRange;
|
|
90
|
+
if (specifier !== 'custom') {
|
|
91
|
+
date.dateType = specifier;
|
|
92
|
+
if (specifier === 'week') {
|
|
93
|
+
date.startDate = moment().isoWeekday(1);
|
|
94
|
+
} else {
|
|
95
|
+
date.startDate = moment().startOf(specifier);
|
|
96
|
+
}
|
|
97
|
+
date.endDate = moment();
|
|
98
|
+
this.setState({ selectedDateRange: date }, () => {
|
|
99
|
+
if (this.state.showChartCompareOptions) {
|
|
100
|
+
this.compareDateValueSetting(specifier);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
} else {
|
|
104
|
+
this.setState({ customDateSelected: true, openCustomDatePicker: true });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
printSelectedDate(startDate, endDate, specifier, isCompare) {
|
|
109
|
+
let specifierType = '';
|
|
110
|
+
if (isCompare) {
|
|
111
|
+
if (specifier === 'week') {
|
|
112
|
+
specifierType = 'Previous Week';
|
|
113
|
+
} else if (specifier === 'month') {
|
|
114
|
+
specifierType = 'Previous Month';
|
|
115
|
+
} else if (specifier === 'year') {
|
|
116
|
+
specifierType = 'Previous Year';
|
|
117
|
+
} else {
|
|
118
|
+
specifierType = 'Custom';
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (!isCompare) {
|
|
122
|
+
if (specifier === 'week') {
|
|
123
|
+
specifierType = 'WTD';
|
|
124
|
+
} else if (specifier === 'month') {
|
|
125
|
+
specifierType = 'MTD';
|
|
126
|
+
} else if (specifier === 'year') {
|
|
127
|
+
specifierType = 'YTD';
|
|
128
|
+
} else {
|
|
129
|
+
specifierType = 'Custom';
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
let tmpDateString = '';
|
|
134
|
+
if (moment(startDate).year() === moment(endDate).year()) {
|
|
135
|
+
tmpDateString = `${specifierType} ( ${moment(startDate).format('MMM D').toString()} - ${moment(endDate).format('MMM D YYYY').toString()} )`;
|
|
136
|
+
} else {
|
|
137
|
+
tmpDateString = `${specifierType} ( ${moment(startDate).format('MMM D YYYY').toString()} - ${moment(endDate).format('MMM D YYYY').toString()} )`;
|
|
138
|
+
}
|
|
139
|
+
return tmpDateString;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
handleCancel() {
|
|
143
|
+
this.setState({ isDateSelectorOpen: false });
|
|
144
|
+
if (this.props.handleCancel !== undefined) {
|
|
145
|
+
this.props.handleCancel();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Need to improve this function
|
|
149
|
+
this.restoreInitialState();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
compareDateValueSetting(specifier) {
|
|
153
|
+
const dateRange = (this.state.compareDateRange) ? this.state.compareDateRange : _.cloneDeep(this.state.selectedDateRange);
|
|
154
|
+
if (specifier === 'week') {
|
|
155
|
+
dateRange.startDate = moment(this.state.selectedDateRange.startDate).subtract(7, 'days');
|
|
156
|
+
dateRange.endDate = moment(this.state.selectedDateRange.endDate).subtract(7, 'days');
|
|
157
|
+
dateRange.dateType = specifier;
|
|
158
|
+
} else if (specifier === 'month') {
|
|
159
|
+
dateRange.startDate = moment(this.state.selectedDateRange.startDate).subtract(1, 'months');
|
|
160
|
+
dateRange.endDate = moment(this.state.selectedDateRange.endDate).subtract(1, 'months');
|
|
161
|
+
dateRange.dateType = specifier;
|
|
162
|
+
} else if (specifier === 'year' || specifier === 'custom') {
|
|
163
|
+
dateRange.startDate = moment(this.state.selectedDateRange.startDate).subtract(1, 'years');
|
|
164
|
+
dateRange.endDate = moment(this.state.selectedDateRange.endDate).subtract(1, 'years');
|
|
165
|
+
dateRange.dateType = specifier;
|
|
166
|
+
}
|
|
167
|
+
this.setState({ compareDateRange: dateRange });
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
handleChartCompareToggle() {
|
|
171
|
+
this.setState({ showChartCompareOptions: !this.state.showChartCompareOptions });
|
|
172
|
+
const compareDateType = (this.state.compareDateRange) ? this.state.compareDateRange.dateType : this.state.selectedDateRange.dateType;
|
|
173
|
+
this.compareDateValueSetting(compareDateType);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
handleCompareDateChange(specifier) {
|
|
177
|
+
if (specifier === 'custom') {
|
|
178
|
+
this.setState({ compareCustomDateSelected: true, openCustomDatePicker: true });
|
|
179
|
+
} else {
|
|
180
|
+
this.compareDateValueSetting(specifier);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
handleCustomDatePickerCancel(e) {
|
|
185
|
+
if (e) {
|
|
186
|
+
e.preventDefault();
|
|
187
|
+
}
|
|
188
|
+
this.setState({ customDateSelected: false });
|
|
189
|
+
this.setState({ compareCustomDateSelected: false });
|
|
190
|
+
this.setState({ openCustomDatePicker: false });
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
handleDatePickerApply(startDate, endDate, dateType) {
|
|
194
|
+
if (this.state.customDateSelected) {
|
|
195
|
+
const dateRange = _.cloneDeep(this.state.selectedDateRange);
|
|
196
|
+
dateRange.startDate = startDate;
|
|
197
|
+
dateRange.endDate = endDate;
|
|
198
|
+
dateRange.dateType = dateType;
|
|
199
|
+
this.setState({ selectedDateRange: dateRange });
|
|
200
|
+
this.setState({ customDateSelected: false });
|
|
201
|
+
} else {
|
|
202
|
+
const dateRange = _.cloneDeep(this.state.compareDateRange);
|
|
203
|
+
dateRange.startDate = startDate;
|
|
204
|
+
dateRange.endDate = endDate;
|
|
205
|
+
dateRange.dateType = dateType;
|
|
206
|
+
this.setState({ compareDateRange: dateRange });
|
|
207
|
+
this.setState({ compareCustomDateSelected: false });
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
handleApply() {
|
|
212
|
+
let dateText = this.printSelectedDate(this.state.selectedDateRange.startDate, this.state.selectedDateRange.endDate, this.state.selectedDateRange.dateType);
|
|
213
|
+
if (this.state.showChartCompareOptions) {
|
|
214
|
+
this.setState({ componentWidth: 450 });
|
|
215
|
+
dateText = `${dateText} vs ${this.printSelectedDate(this.state.compareDateRange.startDate, this.state.compareDateRange.endDate, this.state.compareDateRange.dateType, true)}`;
|
|
216
|
+
} else {
|
|
217
|
+
this.setState({ componentWidth: 270 });
|
|
218
|
+
}
|
|
219
|
+
this.setState({ selectedDateText: dateText });
|
|
220
|
+
this.setState({ isDateSelectorOpen: false });
|
|
221
|
+
this.props.handleApply(this.state.selectedDateRange, this.state.showChartCompareOptions, this.state.compareDateRange);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
restoreInitialState() {
|
|
225
|
+
this.setState({ selectedDateRange: this.state.pastStateData.selectedDateRange });
|
|
226
|
+
this.setState({ compareDateRange: this.state.pastStateData.compareDateRange, showChartCompareOptions: this.state.pastStateData.showChartCompareOptions });
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
renderDateSelector() {
|
|
230
|
+
const dateType = this.state.selectedDateRange.dateType;
|
|
231
|
+
return (
|
|
232
|
+
<div className="date-filter-wrapper">
|
|
233
|
+
{ this.state.loading ? <Dimmer active inverted className={'hide'}><Loader inverted><FormattedMessage {...messages.loaderMessage} /> </Loader></Dimmer> :
|
|
234
|
+
<Grid>
|
|
235
|
+
<Grid.Row className={this.state.openCustomDatePicker ? 'hide' : ''}>
|
|
236
|
+
<Grid.Column width={16}>
|
|
237
|
+
<Button.Group fluid className="btn-group till-date">
|
|
238
|
+
<Button className={dateType === 'week' ? 'active' : ''} onClick={() => this.handleDateTypeClick('week')}><FormattedMessage {...messages.wtd} /></Button>
|
|
239
|
+
<Button className={dateType === 'month' ? 'active' : ''} onClick={() => this.handleDateTypeClick('month')}><FormattedMessage {...messages.mtd} /></Button>
|
|
240
|
+
<Button className={dateType === 'year' ? 'active' : ''} onClick={() => this.handleDateTypeClick('year')}><FormattedMessage {...messages.ytd} /></Button>
|
|
241
|
+
<Button className={dateType === 'custom' ? 'active' : ''} onClick={() => this.handleDateTypeClick('custom')}><FormattedMessage {...messages.custom} /></Button>
|
|
242
|
+
</Button.Group>
|
|
243
|
+
</Grid.Column>
|
|
244
|
+
<Grid.Column width={16} className="selectedDateText">
|
|
245
|
+
{this.printSelectedDate(this.state.selectedDateRange.startDate, this.state.selectedDateRange.endDate, this.state.selectedDateRange.dateType)}
|
|
246
|
+
{dateType === 'custom' ? <span className="editSelectedDate" onClick={() => this.handleDateTypeClick('custom')}><FormattedMessage {...messages.editText} /></span> : ''}
|
|
247
|
+
</Grid.Column>
|
|
248
|
+
</Grid.Row>
|
|
249
|
+
<Grid.Row className={this.state.openCustomDatePicker ? 'hide' : 'compareDateToggle'}>
|
|
250
|
+
<Grid.Column width={16}>
|
|
251
|
+
<Checkbox className={!this.props.compareMode ? 'hide' : 'dateCompareCheckbox'} checked={this.state.showChartCompareOptions} label="Compare" onClick={this.handleChartCompareToggle} />
|
|
252
|
+
</Grid.Column>
|
|
253
|
+
</Grid.Row>
|
|
254
|
+
{ this.state.showChartCompareOptions ?
|
|
255
|
+
<Grid.Row className={!this.state.openCustomDatePicker ? '' : 'hide'}>
|
|
256
|
+
<Grid.Column width={16}>
|
|
257
|
+
<Button.Group fluid className="btn-group till-date">
|
|
258
|
+
{dateType !== 'week' ? '' :
|
|
259
|
+
<Button className={this.state.compareDateRange.dateType !== 'week' ? '' : 'active'} onClick={() => this.handleCompareDateChange('week')}><FormattedMessage {...messages.previousWeek} /></Button> }
|
|
260
|
+
{dateType !== 'month' ? '' :
|
|
261
|
+
<Button className={this.state.compareDateRange.dateType !== 'month' ? '' : 'active'} onClick={() => this.handleCompareDateChange('month')}><FormattedMessage {...messages.previousMonth} /></Button>}
|
|
262
|
+
<Button className={this.state.compareDateRange.dateType === 'year' ? 'active' : ''} onClick={() => this.handleCompareDateChange('year')}><FormattedMessage {...messages.previousYear} /></Button>
|
|
263
|
+
<Button className={this.state.compareDateRange.dateType === 'custom' ? 'active' : ''} onClick={() => this.handleCompareDateChange('custom')}><FormattedMessage {...messages.custom} /></Button>
|
|
264
|
+
</Button.Group>
|
|
265
|
+
</Grid.Column>
|
|
266
|
+
<Grid.Column width={16} className="selectedDateText">
|
|
267
|
+
{this.printSelectedDate(this.state.compareDateRange.startDate, this.state.compareDateRange.endDate, this.state.compareDateRange.dateType, true)}
|
|
268
|
+
{this.state.compareDateRange.dateType === 'custom' ? <span className="editSelectedDate" onClick={() => this.handleCompareDateChange('custom')}><FormattedMessage {...messages.editText} /></span> : ''}
|
|
269
|
+
</Grid.Column>
|
|
270
|
+
</Grid.Row>
|
|
271
|
+
: ''
|
|
272
|
+
}
|
|
273
|
+
<Grid.Row className={this.state.openCustomDatePicker ? 'hide' : ''}>
|
|
274
|
+
<Grid.Column width={16}>
|
|
275
|
+
<Button primary onClick={this.handleApply}><FormattedMessage {...messages.apply} /></Button>
|
|
276
|
+
<Button basic onClick={this.handleCancel}><FormattedMessage {...messages.cancel} /></Button>
|
|
277
|
+
</Grid.Column>
|
|
278
|
+
</Grid.Row>
|
|
279
|
+
|
|
280
|
+
{ this.state.customDateSelected ?
|
|
281
|
+
<Grid.Row className={!this.state.openCustomDatePicker ? 'hide' : ''}>
|
|
282
|
+
<Grid.Column className="selectDateRangeTitle" width={16}>
|
|
283
|
+
<a href="" className="backButton" onClick={this.handleCustomDatePickerCancel}><i className="material-icons">keyboard_backspace</i></a>
|
|
284
|
+
<span className="dateRangeTitle"><FormattedMessage {...messages.selectDateRange} /></span>
|
|
285
|
+
</Grid.Column>
|
|
286
|
+
<Grid.Column width={16} className="dateRangeWrapper">
|
|
287
|
+
<DateRange prevSelectedDate={this.state.selectedDateRange} handleDatePickerApply={this.handleDatePickerApply} handleDatePickerCancel={this.handleCustomDatePickerCancel} />
|
|
288
|
+
</Grid.Column>
|
|
289
|
+
{/* { this.state.showChartCompareOptions ? <Grid.Column width={16}>
|
|
290
|
+
{this.printSelectedDate(this.props.selectedDateRange.startDate, this.props.selectedDateRange.endDate, this.state.selectedDateRange.dateType)} vs
|
|
291
|
+
</Grid.Column> : '' } */}
|
|
292
|
+
</Grid.Row> : ''
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
{ this.state.compareCustomDateSelected ?
|
|
296
|
+
<Grid.Row className={!this.state.openCustomDatePicker ? 'hide' : ''}>
|
|
297
|
+
<Grid.Column width={16}>
|
|
298
|
+
<a href="" className="backButton" onClick={this.handleCustomDatePickerCancel}><i className="material-icons">keyboard_backspace</i></a>
|
|
299
|
+
<span className="dateRangeTitle"><FormattedMessage {...messages.selectDateRange} /></span>
|
|
300
|
+
</Grid.Column>
|
|
301
|
+
<Grid.Column width={16}>
|
|
302
|
+
{this.printSelectedDate(this.state.selectedDateRange.startDate, this.state.selectedDateRange.endDate, this.state.selectedDateRange.dateType)} vs
|
|
303
|
+
</Grid.Column>
|
|
304
|
+
<Grid.Column width={16} className="dateRangeWrapper">
|
|
305
|
+
<DateRange prevSelectedDate={this.state.compareDateRange} handleDatePickerApply={this.handleDatePickerApply} handleDatePickerCancel={this.handleCustomDatePickerCancel} />
|
|
306
|
+
</Grid.Column>
|
|
307
|
+
</Grid.Row> : ''
|
|
308
|
+
}
|
|
309
|
+
</Grid>}
|
|
310
|
+
</div>
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
render() {
|
|
315
|
+
const { isDateSelectorOpen } = this.state;
|
|
316
|
+
// const loading = this.state.loading;
|
|
317
|
+
return (
|
|
318
|
+
<span>
|
|
319
|
+
<Popup
|
|
320
|
+
trigger={
|
|
321
|
+
<Input
|
|
322
|
+
id="compareDate"
|
|
323
|
+
style={{ width: `${this.state.componentWidth}px` }}
|
|
324
|
+
readOnly
|
|
325
|
+
icon="caret down"
|
|
326
|
+
value={this.state.selectedDateText}
|
|
327
|
+
/>
|
|
328
|
+
}
|
|
329
|
+
content={this.renderDateSelector()}
|
|
330
|
+
on="click"
|
|
331
|
+
open={isDateSelectorOpen}
|
|
332
|
+
onOpen={this.handleToggleDateSelector}
|
|
333
|
+
/>
|
|
334
|
+
</span>
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
DateFilter.propTypes = {
|
|
340
|
+
selectedDateRange: PropTypes.object.isRequired,
|
|
341
|
+
compareMode: PropTypes.bool,
|
|
342
|
+
compareDateRange: PropTypes.object,
|
|
343
|
+
isCompareSelected: PropTypes.bool,
|
|
344
|
+
handleApply: PropTypes.func.isRequired,
|
|
345
|
+
handleCancel: PropTypes.func,
|
|
346
|
+
loading: PropTypes.bool,
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
export default DateFilter;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* DateFilter Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the DateFilter component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
loaderMessage: {
|
|
10
|
+
id: 'reon.components.DateFilter.loaderMessage',
|
|
11
|
+
defaultMessage: 'Fetching data',
|
|
12
|
+
},
|
|
13
|
+
editText: {
|
|
14
|
+
id: 'reon.components.DateFilter.editText',
|
|
15
|
+
defaultMessage: 'Edit',
|
|
16
|
+
},
|
|
17
|
+
wtd: {
|
|
18
|
+
id: 'reon.components.DateFilter.wtd',
|
|
19
|
+
defaultMessage: 'WTD',
|
|
20
|
+
},
|
|
21
|
+
mtd: {
|
|
22
|
+
id: 'reon.components.DateFilter.mtd',
|
|
23
|
+
defaultMessage: 'MTD',
|
|
24
|
+
},
|
|
25
|
+
ytd: {
|
|
26
|
+
id: 'reon.components.DateFilter.ytd',
|
|
27
|
+
defaultMessage: 'YTD',
|
|
28
|
+
},
|
|
29
|
+
custom: {
|
|
30
|
+
id: 'reon.components.DateFilter.custom',
|
|
31
|
+
defaultMessage: 'Custom',
|
|
32
|
+
},
|
|
33
|
+
previousWeek: {
|
|
34
|
+
id: 'reon.components.DateFilter.previousWeek',
|
|
35
|
+
defaultMessage: 'Previous Week',
|
|
36
|
+
},
|
|
37
|
+
previousMonth: {
|
|
38
|
+
id: 'reon.components.DateFilter.previousMonth',
|
|
39
|
+
defaultMessage: 'Previous Month',
|
|
40
|
+
},
|
|
41
|
+
previousYear: {
|
|
42
|
+
id: 'reon.components.DateFilter.previousYear',
|
|
43
|
+
defaultMessage: 'Previous Year',
|
|
44
|
+
},
|
|
45
|
+
selectDateRange: {
|
|
46
|
+
id: 'reon.components.DateFilter.selectDateRange',
|
|
47
|
+
defaultMessage: 'Select Date Range',
|
|
48
|
+
},
|
|
49
|
+
apply: {
|
|
50
|
+
id: 'reon.components.DateFilter.apply',
|
|
51
|
+
defaultMessage: 'Apply',
|
|
52
|
+
},
|
|
53
|
+
cancel: {
|
|
54
|
+
id: 'reon.components.DateFilter.cancel',
|
|
55
|
+
defaultMessage: 'Cancel',
|
|
56
|
+
},
|
|
57
|
+
});
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* DateRange
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
// import styled from 'styled-components';
|
|
11
|
+
|
|
12
|
+
import { FormattedMessage } from 'react-intl';
|
|
13
|
+
import { Grid, Button } from 'semantic-ui-react';
|
|
14
|
+
|
|
15
|
+
import DatePicker from 'react-datepicker';
|
|
16
|
+
import 'react-datepicker/dist/react-datepicker.css';
|
|
17
|
+
|
|
18
|
+
import moment from 'moment';
|
|
19
|
+
import messages from './messages';
|
|
20
|
+
|
|
21
|
+
class DateRange extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
22
|
+
constructor(props) {
|
|
23
|
+
super(props);
|
|
24
|
+
this.state = {
|
|
25
|
+
startDate: this.props.prevSelectedDate.startDate,
|
|
26
|
+
endDate: this.props.prevSelectedDate.endDate,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
this.handleChangeStart = this.handleChangeStart.bind(this);
|
|
30
|
+
this.handleChangeEnd = this.handleChangeEnd.bind(this);
|
|
31
|
+
this.closeAndUpdate = this.closeAndUpdate.bind(this);
|
|
32
|
+
this.closeAndCancel = this.closeAndCancel.bind(this);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
handleChangeStart(date) {
|
|
36
|
+
this.setState({ startDate: date });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
handleChangeEnd(date) {
|
|
40
|
+
this.setState({ endDate: date });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
closeAndUpdate() {
|
|
44
|
+
this.props.handleDatePickerApply(this.state.startDate, this.state.endDate, 'custom');
|
|
45
|
+
this.props.handleDatePickerCancel();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
closeAndCancel() {
|
|
49
|
+
this.props.handleDatePickerCancel();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
render() {
|
|
53
|
+
const { startDate, endDate } = this.state;
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<Grid className="dateRangeWrapper" columns={2}>
|
|
57
|
+
<Grid.Row className="selectedDateTitleWrapper">
|
|
58
|
+
<Grid.Column style={{ paddingLeft: 0, paddingBottom: `${8}px` }}>
|
|
59
|
+
<span className="selectedDateTitle"><FormattedMessage {...messages.from} /></span>
|
|
60
|
+
<input className="selectedDateRange" type="text" readOnly defaultValue={moment(startDate).format('MM/DD/YYYY').toString()} />
|
|
61
|
+
<i className="calenderIcon material-icons"><FormattedMessage {...messages.today} /></i>
|
|
62
|
+
</Grid.Column>
|
|
63
|
+
<Grid.Column style={{ paddingLeft: 0 }}>
|
|
64
|
+
<span className="selectedDateTitle"><FormattedMessage {...messages.to} /></span>
|
|
65
|
+
<input className="selectedDateRange" readOnly type="text" defaultValue={moment(endDate).format('MM/DD/YYYY').toString()} />
|
|
66
|
+
<i className="calenderIcon material-icons"><FormattedMessage {...messages.today} /></i>
|
|
67
|
+
</Grid.Column>
|
|
68
|
+
</Grid.Row>
|
|
69
|
+
<Grid.Row style={{ paddingTop: 0, paddingBottom: `${2}px` }}>
|
|
70
|
+
<Grid.Column style={{ paddingLeft: 0 }}>
|
|
71
|
+
<DatePicker
|
|
72
|
+
inline
|
|
73
|
+
selected={startDate}
|
|
74
|
+
startDate={startDate}
|
|
75
|
+
endDate={endDate}
|
|
76
|
+
onChange={this.handleChangeStart}
|
|
77
|
+
showMonthDropdown
|
|
78
|
+
showYearDropdown
|
|
79
|
+
dropdownMode="select"
|
|
80
|
+
/>
|
|
81
|
+
</Grid.Column>
|
|
82
|
+
<Grid.Column style={{ paddingLeft: 0 }}>
|
|
83
|
+
<DatePicker
|
|
84
|
+
inline
|
|
85
|
+
selected={endDate}
|
|
86
|
+
startDate={startDate}
|
|
87
|
+
endDate={endDate}
|
|
88
|
+
minDate={startDate}
|
|
89
|
+
maxDate={moment()}
|
|
90
|
+
onChange={this.handleChangeEnd}
|
|
91
|
+
showMonthDropdown
|
|
92
|
+
showYearDropdown
|
|
93
|
+
dropdownMode="select"
|
|
94
|
+
/>
|
|
95
|
+
</Grid.Column>
|
|
96
|
+
</Grid.Row>
|
|
97
|
+
<Grid.Row>
|
|
98
|
+
<Grid.Column width={16} style={{ paddingLeft: 0 }}>
|
|
99
|
+
<Button onClick={this.closeAndUpdate} className="btn-primary" floated="left"><FormattedMessage id="customdatepicker.done" defaultMessage="Done" /></Button>
|
|
100
|
+
<Button onClick={this.closeAndCancel} className="btn-secondary" floated="left"><FormattedMessage id="customdatepicker.cancel" defaultMessage="Cancel" /></Button>
|
|
101
|
+
</Grid.Column>
|
|
102
|
+
</Grid.Row>
|
|
103
|
+
</Grid>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
DateRange.propTypes = {
|
|
109
|
+
prevSelectedDate: PropTypes.object.isRequired,
|
|
110
|
+
handleDatePickerCancel: PropTypes.func,
|
|
111
|
+
handleDatePickerApply: PropTypes.func,
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export default DateRange;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* DateRange Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the DateRange component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
header: {
|
|
10
|
+
id: 'creatives.components.DateRange.header',
|
|
11
|
+
defaultMessage: 'This is the DateRange component !',
|
|
12
|
+
},
|
|
13
|
+
today: {
|
|
14
|
+
id: 'creatives.components.DateRange.today',
|
|
15
|
+
defaultMessage: 'Today',
|
|
16
|
+
},
|
|
17
|
+
from: {
|
|
18
|
+
id: 'creatives.components.DateRange.from',
|
|
19
|
+
defaultMessage: 'From',
|
|
20
|
+
},
|
|
21
|
+
to: {
|
|
22
|
+
id: 'creatives.components.DateRange.to',
|
|
23
|
+
defaultMessage: 'To',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Edmeditor
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
// import styled from 'styled-components';
|
|
11
|
+
|
|
12
|
+
// import { FormattedMessage } from 'react-intl';
|
|
13
|
+
// import messages from './messages';
|
|
14
|
+
// const loadScript = require('load-script');
|
|
15
|
+
// const defaultScriptUrl = "https://api-static.edmdesigner.com/EDMdesignerAPI.js";
|
|
16
|
+
|
|
17
|
+
class Edmeditor extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
18
|
+
constructor(props) {
|
|
19
|
+
super(props);
|
|
20
|
+
this.state = {
|
|
21
|
+
editorInstance: undefined,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// this.onLoad = this.onLoad.bind(this);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
componentDidMount() {
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
componentWillReceiveProps(nextProps) {
|
|
32
|
+
|
|
33
|
+
// if (!_.isEqual(nextProps.content, this.props.content)) {
|
|
34
|
+
//
|
|
35
|
+
// this.editorInstance.content = nextProps.content;
|
|
36
|
+
// }
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
componentWillUnmount() {
|
|
40
|
+
this.unmounting = true;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
render() {
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
this.props.edmSrc ?
|
|
47
|
+
(<iframe id={this.props.id} className={this.props.activeClass} src={this.props.edmSrc} height="460" width="100%" style={{height: "calc(100vh - 180px)"}}></iframe>)
|
|
48
|
+
: 'aaasass'
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
Edmeditor.defaultProps = {
|
|
54
|
+
id: 'edmEditor',
|
|
55
|
+
activeClass: "",
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
Edmeditor.propTypes = {
|
|
59
|
+
id: PropTypes.string,
|
|
60
|
+
activeClass: PropTypes.string,
|
|
61
|
+
// getEditorInstanse: PropTypes.func,
|
|
62
|
+
edmSrc: PropTypes.string,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default Edmeditor;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Edmeditor Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the Edmeditor component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
header: {
|
|
10
|
+
id: 'creatives.components.Edmeditor.header',
|
|
11
|
+
defaultMessage: 'This is the Edmeditor component !',
|
|
12
|
+
},
|
|
13
|
+
});
|