@plusscommunities/pluss-core-app 6.1.2-beta.0 → 6.1.3-beta.0
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/dist/module/apis/index.js +1 -0
- package/dist/module/apis/index.js.map +1 -1
- package/dist/module/apis/settingActions.js +22 -0
- package/dist/module/apis/settingActions.js.map +1 -0
- package/dist/module/components/index.js +0 -1
- package/dist/module/components/index.js.map +1 -1
- package/package.json +1 -2
- package/src/apis/index.js +1 -0
- package/src/apis/settingActions.js +18 -0
- package/src/components/index.js +0 -1
- package/dist/module/components/CalendarPopup.js +0 -124
- package/dist/module/components/CalendarPopup.js.map +0 -1
- package/src/components/CalendarPopup.js +0 -109
|
@@ -7,6 +7,7 @@ export * from './analyticsActions';
|
|
|
7
7
|
export * from './notificationActions';
|
|
8
8
|
export * from './stringActions';
|
|
9
9
|
export * from './typeActions';
|
|
10
|
+
export * from './settingActions';
|
|
10
11
|
export { default as userActions } from './userActions';
|
|
11
12
|
export { default as profileActions } from './profileActions';
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["default","userActions","profileActions"],"sources":["index.js"],"sourcesContent":["export * from './reactionActions';\nexport * from './fileActions';\nexport * from './followerActions';\nexport * from './contactActions';\nexport * from './eventActions';\nexport * from './analyticsActions';\nexport * from './notificationActions';\nexport * from './stringActions';\nexport * from './typeActions';\nexport { default as userActions } from './userActions';\nexport { default as profileActions } from './profileActions';\n"],"mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,eAAe;AAC7B,cAAc,mBAAmB;AACjC,cAAc,kBAAkB;AAChC,cAAc,gBAAgB;AAC9B,cAAc,oBAAoB;AAClC,cAAc,uBAAuB;AACrC,cAAc,iBAAiB;AAC/B,cAAc,eAAe;AAC7B,SAASA,OAAO,IAAIC,WAAW,QAAQ,eAAe;AACtD,SAASD,OAAO,IAAIE,cAAc,QAAQ,kBAAkB"}
|
|
1
|
+
{"version":3,"names":["default","userActions","profileActions"],"sources":["index.js"],"sourcesContent":["export * from './reactionActions';\nexport * from './fileActions';\nexport * from './followerActions';\nexport * from './contactActions';\nexport * from './eventActions';\nexport * from './analyticsActions';\nexport * from './notificationActions';\nexport * from './stringActions';\nexport * from './typeActions';\nexport * from './settingActions';\nexport { default as userActions } from './userActions';\nexport { default as profileActions } from './profileActions';\n"],"mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,eAAe;AAC7B,cAAc,mBAAmB;AACjC,cAAc,kBAAkB;AAChC,cAAc,gBAAgB;AAC9B,cAAc,oBAAoB;AAClC,cAAc,uBAAuB;AACrC,cAAc,iBAAiB;AAC/B,cAAc,eAAe;AAC7B,cAAc,kBAAkB;AAChC,SAASA,OAAO,IAAIC,WAAW,QAAQ,eAAe;AACtD,SAASD,OAAO,IAAIE,cAAc,QAAQ,kBAAkB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { authedFunction } from '../session';
|
|
2
|
+
import { getUrl } from '../helper';
|
|
3
|
+
export const settingActions = {
|
|
4
|
+
getSetting: (site, key) => {
|
|
5
|
+
return authedFunction({
|
|
6
|
+
method: 'GET',
|
|
7
|
+
url: getUrl('utility', `getSetting/${site}_${key}`)
|
|
8
|
+
});
|
|
9
|
+
},
|
|
10
|
+
setSetting: (site, key, value) => {
|
|
11
|
+
return authedFunction({
|
|
12
|
+
method: 'POST',
|
|
13
|
+
url: getUrl('utility', 'setSetting'),
|
|
14
|
+
data: {
|
|
15
|
+
site,
|
|
16
|
+
key,
|
|
17
|
+
value
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=settingActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["authedFunction","getUrl","settingActions","getSetting","site","key","method","url","setSetting","value","data"],"sources":["settingActions.js"],"sourcesContent":["import { authedFunction } from '../session';\nimport { getUrl } from '../helper';\n\nexport const settingActions = {\n getSetting: (site, key) => {\n return authedFunction({\n method: 'GET',\n url: getUrl('utility', `getSetting/${site}_${key}`),\n });\n },\n setSetting: (site, key, value) => {\n return authedFunction({\n method: 'POST',\n url: getUrl('utility', 'setSetting'),\n data: { site, key, value },\n });\n },\n};\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,YAAY;AAC3C,SAASC,MAAM,QAAQ,WAAW;AAElC,OAAO,MAAMC,cAAc,GAAG;EAC5BC,UAAU,EAAEA,CAACC,IAAI,EAAEC,GAAG,KAAK;IACzB,OAAOL,cAAc,CAAC;MACpBM,MAAM,EAAE,KAAK;MACbC,GAAG,EAAEN,MAAM,CAAC,SAAS,EAAG,cAAaG,IAAK,IAAGC,GAAI,EAAC;IACpD,CAAC,CAAC;EACJ,CAAC;EACDG,UAAU,EAAEA,CAACJ,IAAI,EAAEC,GAAG,EAAEI,KAAK,KAAK;IAChC,OAAOT,cAAc,CAAC;MACpBM,MAAM,EAAE,MAAM;MACdC,GAAG,EAAEN,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC;MACpCS,IAAI,EAAE;QAAEN,IAAI;QAAEC,GAAG;QAAEI;MAAM;IAC3B,CAAC,CAAC;EACJ;AACF,CAAC"}
|
|
@@ -39,7 +39,6 @@ export * from './FontScaleButton';
|
|
|
39
39
|
export * from './UserListPopup';
|
|
40
40
|
export * from './Reactions';
|
|
41
41
|
export * from './AudienceSelectorLauncher';
|
|
42
|
-
export * from './CalendarPopup';
|
|
43
42
|
export { default as EmptyStateWidget } from './EmptyStateWidget';
|
|
44
43
|
export { default as EmptyStateMain } from './EmptyStateMain';
|
|
45
44
|
export { default as LoadingStateWidget } from './LoadingStateWidget';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["default","EmptyStateWidget","EmptyStateMain","LoadingStateWidget","Header","LoadingIndicator","ImageUploader","ImageUploadProgress","UserListing","PlussChat","PositionedImage","FormattedText","MediaPlayer","AudienceSelectorPage"],"sources":["index.js"],"sourcesContent":["export * from './InlineButton';\nexport * from './AddToCalendarButton';\nexport * from './Forbidden';\nexport * from './FormCard';\nexport * from './FormCardSection';\nexport * from './FormCardSectionOptionLauncher';\nexport * from './ProfilePic';\nexport * from './Spinner';\nexport * from './LoadingCircles';\nexport * from './Popup';\nexport * from './ImagePopup';\nexport * from './VideoPopup';\nexport * from './SharingTools';\nexport * from './MiddlePopup';\nexport * from './ConfirmPopup';\nexport * from './ConfirmationPopup';\nexport * from './CommentSection';\nexport * from './CommentReply';\nexport * from './PopupMenu';\nexport * from './AddButton';\nexport * from './Attachment';\nexport * from './GenericInputSection';\nexport * from './GenericInput';\nexport * from './RadioButton';\nexport * from './PDFPopup';\nexport * from './TextStyle';\nexport * from './Toggle';\nexport * from './Input';\nexport * from './StickyFooter';\nexport * from './CategoryTabs';\nexport * from './DropDownMenu';\nexport * from './DropDownItem';\nexport * from './BackButton';\nexport * from './Reaction';\nexport * from './TouchableSearchBar';\nexport * from './WarningPopup';\nexport * from './FontScalePopup';\nexport * from './FontScaleButton';\nexport * from './UserListPopup';\nexport * from './Reactions';\nexport * from './AudienceSelectorLauncher';\nexport
|
|
1
|
+
{"version":3,"names":["default","EmptyStateWidget","EmptyStateMain","LoadingStateWidget","Header","LoadingIndicator","ImageUploader","ImageUploadProgress","UserListing","PlussChat","PositionedImage","FormattedText","MediaPlayer","AudienceSelectorPage"],"sources":["index.js"],"sourcesContent":["export * from './InlineButton';\nexport * from './AddToCalendarButton';\nexport * from './Forbidden';\nexport * from './FormCard';\nexport * from './FormCardSection';\nexport * from './FormCardSectionOptionLauncher';\nexport * from './ProfilePic';\nexport * from './Spinner';\nexport * from './LoadingCircles';\nexport * from './Popup';\nexport * from './ImagePopup';\nexport * from './VideoPopup';\nexport * from './SharingTools';\nexport * from './MiddlePopup';\nexport * from './ConfirmPopup';\nexport * from './ConfirmationPopup';\nexport * from './CommentSection';\nexport * from './CommentReply';\nexport * from './PopupMenu';\nexport * from './AddButton';\nexport * from './Attachment';\nexport * from './GenericInputSection';\nexport * from './GenericInput';\nexport * from './RadioButton';\nexport * from './PDFPopup';\nexport * from './TextStyle';\nexport * from './Toggle';\nexport * from './Input';\nexport * from './StickyFooter';\nexport * from './CategoryTabs';\nexport * from './DropDownMenu';\nexport * from './DropDownItem';\nexport * from './BackButton';\nexport * from './Reaction';\nexport * from './TouchableSearchBar';\nexport * from './WarningPopup';\nexport * from './FontScalePopup';\nexport * from './FontScaleButton';\nexport * from './UserListPopup';\nexport * from './Reactions';\nexport * from './AudienceSelectorLauncher';\nexport { default as EmptyStateWidget } from './EmptyStateWidget';\nexport { default as EmptyStateMain } from './EmptyStateMain';\nexport { default as LoadingStateWidget } from './LoadingStateWidget';\nexport { default as Header } from './Header';\nexport { default as LoadingIndicator } from './LoadingIndicator';\nexport { default as ImageUploader } from './ImageUploader';\nexport { default as ImageUploadProgress } from './ImageUploadProgress';\nexport { default as UserListing } from './UserListing';\nexport { default as PlussChat } from './PlussChat';\nexport { default as PositionedImage } from './PositionedImage';\nexport * from './AutoOffsetImage';\nexport { default as FormattedText } from './FormattedText';\nexport { default as MediaPlayer } from './MediaPlayer';\nexport { default as AudienceSelectorPage } from './AudienceSelectorPage';\n"],"mappings":"AAAA,cAAc,gBAAgB;AAC9B,cAAc,uBAAuB;AACrC,cAAc,aAAa;AAC3B,cAAc,YAAY;AAC1B,cAAc,mBAAmB;AACjC,cAAc,iCAAiC;AAC/C,cAAc,cAAc;AAC5B,cAAc,WAAW;AACzB,cAAc,kBAAkB;AAChC,cAAc,SAAS;AACvB,cAAc,cAAc;AAC5B,cAAc,cAAc;AAC5B,cAAc,gBAAgB;AAC9B,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,qBAAqB;AACnC,cAAc,kBAAkB;AAChC,cAAc,gBAAgB;AAC9B,cAAc,aAAa;AAC3B,cAAc,aAAa;AAC3B,cAAc,cAAc;AAC5B,cAAc,uBAAuB;AACrC,cAAc,gBAAgB;AAC9B,cAAc,eAAe;AAC7B,cAAc,YAAY;AAC1B,cAAc,aAAa;AAC3B,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,gBAAgB;AAC9B,cAAc,gBAAgB;AAC9B,cAAc,gBAAgB;AAC9B,cAAc,gBAAgB;AAC9B,cAAc,cAAc;AAC5B,cAAc,YAAY;AAC1B,cAAc,sBAAsB;AACpC,cAAc,gBAAgB;AAC9B,cAAc,kBAAkB;AAChC,cAAc,mBAAmB;AACjC,cAAc,iBAAiB;AAC/B,cAAc,aAAa;AAC3B,cAAc,4BAA4B;AAC1C,SAASA,OAAO,IAAIC,gBAAgB,QAAQ,oBAAoB;AAChE,SAASD,OAAO,IAAIE,cAAc,QAAQ,kBAAkB;AAC5D,SAASF,OAAO,IAAIG,kBAAkB,QAAQ,sBAAsB;AACpE,SAASH,OAAO,IAAII,MAAM,QAAQ,UAAU;AAC5C,SAASJ,OAAO,IAAIK,gBAAgB,QAAQ,oBAAoB;AAChE,SAASL,OAAO,IAAIM,aAAa,QAAQ,iBAAiB;AAC1D,SAASN,OAAO,IAAIO,mBAAmB,QAAQ,uBAAuB;AACtE,SAASP,OAAO,IAAIQ,WAAW,QAAQ,eAAe;AACtD,SAASR,OAAO,IAAIS,SAAS,QAAQ,aAAa;AAClD,SAAST,OAAO,IAAIU,eAAe,QAAQ,mBAAmB;AAC9D,cAAc,mBAAmB;AACjC,SAASV,OAAO,IAAIW,aAAa,QAAQ,iBAAiB;AAC1D,SAASX,OAAO,IAAIY,WAAW,QAAQ,eAAe;AACtD,SAASZ,OAAO,IAAIa,oBAAoB,QAAQ,wBAAwB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plusscommunities/pluss-core-app",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.3-beta.0",
|
|
4
4
|
"description": "Core extension package for Pluss Communities platform",
|
|
5
5
|
"main": "dist/module/index.js",
|
|
6
6
|
"module": "dist/module/index.js",
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
"react": "18.2.0",
|
|
47
47
|
"react-native": "0.73.6",
|
|
48
48
|
"react-native-auto-height-image": "3.1.3",
|
|
49
|
-
"react-native-calendars": "^1.1309.1",
|
|
50
49
|
"react-native-elements": "^0.17.0",
|
|
51
50
|
"react-native-gifted-chat": "^0.16.3",
|
|
52
51
|
"react-native-image-zoom-viewer": "^3.0.1",
|
package/src/apis/index.js
CHANGED
|
@@ -7,5 +7,6 @@ export * from './analyticsActions';
|
|
|
7
7
|
export * from './notificationActions';
|
|
8
8
|
export * from './stringActions';
|
|
9
9
|
export * from './typeActions';
|
|
10
|
+
export * from './settingActions';
|
|
10
11
|
export { default as userActions } from './userActions';
|
|
11
12
|
export { default as profileActions } from './profileActions';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { authedFunction } from '../session';
|
|
2
|
+
import { getUrl } from '../helper';
|
|
3
|
+
|
|
4
|
+
export const settingActions = {
|
|
5
|
+
getSetting: (site, key) => {
|
|
6
|
+
return authedFunction({
|
|
7
|
+
method: 'GET',
|
|
8
|
+
url: getUrl('utility', `getSetting/${site}_${key}`),
|
|
9
|
+
});
|
|
10
|
+
},
|
|
11
|
+
setSetting: (site, key, value) => {
|
|
12
|
+
return authedFunction({
|
|
13
|
+
method: 'POST',
|
|
14
|
+
url: getUrl('utility', 'setSetting'),
|
|
15
|
+
data: { site, key, value },
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
};
|
package/src/components/index.js
CHANGED
|
@@ -39,7 +39,6 @@ export * from './FontScaleButton';
|
|
|
39
39
|
export * from './UserListPopup';
|
|
40
40
|
export * from './Reactions';
|
|
41
41
|
export * from './AudienceSelectorLauncher';
|
|
42
|
-
export * from './CalendarPopup';
|
|
43
42
|
export { default as EmptyStateWidget } from './EmptyStateWidget';
|
|
44
43
|
export { default as EmptyStateMain } from './EmptyStateMain';
|
|
45
44
|
export { default as LoadingStateWidget } from './LoadingStateWidget';
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
-
import moment from 'moment';
|
|
5
|
-
import React, { Component } from 'react';
|
|
6
|
-
import { Modal, View, TouchableOpacity, StyleSheet } from 'react-native';
|
|
7
|
-
import { Calendar } from 'react-native-calendars';
|
|
8
|
-
import { StatusBarHeight } from '../helper';
|
|
9
|
-
import { Pl60Icon } from '../fonts';
|
|
10
|
-
import { hexToRGBAstring } from '../colours';
|
|
11
|
-
class CalendarPopup extends Component {
|
|
12
|
-
constructor(props) {
|
|
13
|
-
super(props);
|
|
14
|
-
_defineProperty(this, "onDayPress", date => {
|
|
15
|
-
const {
|
|
16
|
-
onSelect
|
|
17
|
-
} = this.props;
|
|
18
|
-
if (!onSelect) return;
|
|
19
|
-
|
|
20
|
-
// console.log('onDayPress', date);
|
|
21
|
-
onSelect(date.timestamp);
|
|
22
|
-
});
|
|
23
|
-
this.state = {};
|
|
24
|
-
}
|
|
25
|
-
renderClose() {
|
|
26
|
-
const {
|
|
27
|
-
onClose
|
|
28
|
-
} = this.props;
|
|
29
|
-
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
30
|
-
style: styles.menuIconContainer,
|
|
31
|
-
onPress: onClose,
|
|
32
|
-
activeOpacity: 0.6
|
|
33
|
-
}, /*#__PURE__*/React.createElement(Pl60Icon, {
|
|
34
|
-
name: "close",
|
|
35
|
-
style: styles.menuIcon
|
|
36
|
-
}));
|
|
37
|
-
}
|
|
38
|
-
render() {
|
|
39
|
-
const {
|
|
40
|
-
visible,
|
|
41
|
-
animationType,
|
|
42
|
-
onClose,
|
|
43
|
-
backgroundStyle,
|
|
44
|
-
selectedDate,
|
|
45
|
-
minDate,
|
|
46
|
-
maxDate,
|
|
47
|
-
enabledDates,
|
|
48
|
-
selectedColor,
|
|
49
|
-
enabledColor,
|
|
50
|
-
disabledColor
|
|
51
|
-
} = this.props;
|
|
52
|
-
const initialDate = (selectedDate ? moment(selectedDate) : moment()).format('YYYY-MM-DD');
|
|
53
|
-
const min = minDate ? moment(minDate).format('YYYY-MM-DD') : undefined;
|
|
54
|
-
const max = maxDate ? moment(maxDate).format('YYYY-MM-DD') : undefined;
|
|
55
|
-
const dateMarkings = {};
|
|
56
|
-
(enabledDates || []).forEach(date => {
|
|
57
|
-
const {
|
|
58
|
-
day,
|
|
59
|
-
enabled
|
|
60
|
-
} = date;
|
|
61
|
-
const key = moment(day).format('YYYY-MM-DD');
|
|
62
|
-
dateMarkings[key] = {
|
|
63
|
-
enabled,
|
|
64
|
-
disableTouchEvent: !enabled,
|
|
65
|
-
customStyles: {
|
|
66
|
-
text: {
|
|
67
|
-
color: enabled ? enabledColor || 'green' : disabledColor || 'red'
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
});
|
|
72
|
-
// console.log('CalendarPopup - enabled', JSON.stringify(dateMarkings, null, 2));
|
|
73
|
-
return /*#__PURE__*/React.createElement(Modal, {
|
|
74
|
-
transparent: true,
|
|
75
|
-
visible: visible || false,
|
|
76
|
-
animationType: animationType || 'fade',
|
|
77
|
-
onRequestClose: onClose
|
|
78
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
79
|
-
style: [styles.popup, backgroundStyle || {
|
|
80
|
-
backgroundColor: hexToRGBAstring('#fff', 1)
|
|
81
|
-
}]
|
|
82
|
-
}, /*#__PURE__*/React.createElement(Calendar, {
|
|
83
|
-
initialDate: initialDate,
|
|
84
|
-
minDate: min,
|
|
85
|
-
maxDate: max,
|
|
86
|
-
markingType: 'custom',
|
|
87
|
-
markedDates: {
|
|
88
|
-
...dateMarkings,
|
|
89
|
-
[initialDate]: {
|
|
90
|
-
selected: true,
|
|
91
|
-
selectedColor: selectedColor || 'blue'
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
onDayPress: this.onDayPress
|
|
95
|
-
})), this.renderClose());
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
const styles = StyleSheet.create({
|
|
99
|
-
container: {
|
|
100
|
-
backgroundColor: '#000'
|
|
101
|
-
},
|
|
102
|
-
popup: {
|
|
103
|
-
flex: 1,
|
|
104
|
-
justifyContent: 'center'
|
|
105
|
-
},
|
|
106
|
-
menuIconContainer: {
|
|
107
|
-
position: 'absolute',
|
|
108
|
-
top: StatusBarHeight(0),
|
|
109
|
-
right: 0,
|
|
110
|
-
width: 55,
|
|
111
|
-
height: 55,
|
|
112
|
-
zIndex: 3
|
|
113
|
-
},
|
|
114
|
-
menuIcon: {
|
|
115
|
-
fontSize: 30,
|
|
116
|
-
padding: 15,
|
|
117
|
-
width: 65,
|
|
118
|
-
textAlign: 'center',
|
|
119
|
-
color: '#000',
|
|
120
|
-
zIndex: 3
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
export { CalendarPopup };
|
|
124
|
-
//# sourceMappingURL=CalendarPopup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["moment","React","Component","Modal","View","TouchableOpacity","StyleSheet","Calendar","StatusBarHeight","Pl60Icon","hexToRGBAstring","CalendarPopup","constructor","props","_defineProperty","date","onSelect","timestamp","state","renderClose","onClose","createElement","style","styles","menuIconContainer","onPress","activeOpacity","name","menuIcon","render","visible","animationType","backgroundStyle","selectedDate","minDate","maxDate","enabledDates","selectedColor","enabledColor","disabledColor","initialDate","format","min","undefined","max","dateMarkings","forEach","day","enabled","key","disableTouchEvent","customStyles","text","color","transparent","onRequestClose","popup","backgroundColor","markingType","markedDates","selected","onDayPress","create","container","flex","justifyContent","position","top","right","width","height","zIndex","fontSize","padding","textAlign"],"sources":["CalendarPopup.js"],"sourcesContent":["import moment from 'moment';\nimport React, { Component } from 'react';\nimport { Modal, View, TouchableOpacity, StyleSheet } from 'react-native';\nimport { Calendar } from 'react-native-calendars';\nimport { StatusBarHeight } from '../helper';\nimport { Pl60Icon } from '../fonts';\nimport { hexToRGBAstring } from '../colours';\n\nclass CalendarPopup extends Component {\n constructor(props) {\n super(props);\n\n this.state = {};\n }\n\n onDayPress = date => {\n const { onSelect } = this.props;\n if (!onSelect) return;\n\n // console.log('onDayPress', date);\n onSelect(date.timestamp);\n };\n\n renderClose() {\n const { onClose } = this.props;\n return (\n <TouchableOpacity style={styles.menuIconContainer} onPress={onClose} activeOpacity={0.6}>\n <Pl60Icon name=\"close\" style={styles.menuIcon} />\n </TouchableOpacity>\n );\n }\n\n render() {\n const {\n visible,\n animationType,\n onClose,\n backgroundStyle,\n selectedDate,\n minDate,\n maxDate,\n enabledDates,\n selectedColor,\n enabledColor,\n disabledColor,\n } = this.props;\n\n const initialDate = (selectedDate ? moment(selectedDate) : moment()).format('YYYY-MM-DD');\n const min = minDate ? moment(minDate).format('YYYY-MM-DD') : undefined;\n const max = maxDate ? moment(maxDate).format('YYYY-MM-DD') : undefined;\n const dateMarkings = {};\n (enabledDates || []).forEach(date => {\n const { day, enabled } = date;\n const key = moment(day).format('YYYY-MM-DD');\n dateMarkings[key] = {\n enabled,\n disableTouchEvent: !enabled,\n customStyles: { text: { color: enabled ? enabledColor || 'green' : disabledColor || 'red' } },\n };\n });\n // console.log('CalendarPopup - enabled', JSON.stringify(dateMarkings, null, 2));\n return (\n <Modal transparent visible={visible || false} animationType={animationType || 'fade'} onRequestClose={onClose}>\n <View style={[styles.popup, backgroundStyle || { backgroundColor: hexToRGBAstring('#fff', 1) }]}>\n <Calendar\n initialDate={initialDate}\n minDate={min}\n maxDate={max}\n markingType={'custom'}\n markedDates={{\n ...dateMarkings,\n [initialDate]: { selected: true, selectedColor: selectedColor || 'blue' },\n }}\n onDayPress={this.onDayPress}\n />\n </View>\n {this.renderClose()}\n </Modal>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n backgroundColor: '#000',\n },\n popup: {\n flex: 1,\n justifyContent: 'center',\n },\n menuIconContainer: {\n position: 'absolute',\n top: StatusBarHeight(0),\n right: 0,\n width: 55,\n height: 55,\n zIndex: 3,\n },\n menuIcon: {\n fontSize: 30,\n padding: 15,\n width: 65,\n textAlign: 'center',\n color: '#000',\n zIndex: 3,\n },\n});\n\nexport { CalendarPopup };\n"],"mappings":";;;AAAA,OAAOA,MAAM,MAAM,QAAQ;AAC3B,OAAOC,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,KAAK,EAAEC,IAAI,EAAEC,gBAAgB,EAAEC,UAAU,QAAQ,cAAc;AACxE,SAASC,QAAQ,QAAQ,wBAAwB;AACjD,SAASC,eAAe,QAAQ,WAAW;AAC3C,SAASC,QAAQ,QAAQ,UAAU;AACnC,SAASC,eAAe,QAAQ,YAAY;AAE5C,MAAMC,aAAa,SAAST,SAAS,CAAC;EACpCU,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA,qBAKFC,IAAI,IAAI;MACnB,MAAM;QAAEC;MAAS,CAAC,GAAG,IAAI,CAACH,KAAK;MAC/B,IAAI,CAACG,QAAQ,EAAE;;MAEf;MACAA,QAAQ,CAACD,IAAI,CAACE,SAAS,CAAC;IAC1B,CAAC;IATC,IAAI,CAACC,KAAK,GAAG,CAAC,CAAC;EACjB;EAUAC,WAAWA,CAAA,EAAG;IACZ,MAAM;MAAEC;IAAQ,CAAC,GAAG,IAAI,CAACP,KAAK;IAC9B,oBACEZ,KAAA,CAAAoB,aAAA,CAAChB,gBAAgB;MAACiB,KAAK,EAAEC,MAAM,CAACC,iBAAkB;MAACC,OAAO,EAAEL,OAA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IACbkB,MAAM,EAAE;EACV;AACF,CAAC,CAAC;AAEF,SAAS5D,aAAa"}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import moment from 'moment';
|
|
2
|
-
import React, { Component } from 'react';
|
|
3
|
-
import { Modal, View, TouchableOpacity, StyleSheet } from 'react-native';
|
|
4
|
-
import { Calendar } from 'react-native-calendars';
|
|
5
|
-
import { StatusBarHeight } from '../helper';
|
|
6
|
-
import { Pl60Icon } from '../fonts';
|
|
7
|
-
import { hexToRGBAstring } from '../colours';
|
|
8
|
-
|
|
9
|
-
class CalendarPopup extends Component {
|
|
10
|
-
constructor(props) {
|
|
11
|
-
super(props);
|
|
12
|
-
|
|
13
|
-
this.state = {};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
onDayPress = date => {
|
|
17
|
-
const { onSelect } = this.props;
|
|
18
|
-
if (!onSelect) return;
|
|
19
|
-
|
|
20
|
-
// console.log('onDayPress', date);
|
|
21
|
-
onSelect(date.timestamp);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
renderClose() {
|
|
25
|
-
const { onClose } = this.props;
|
|
26
|
-
return (
|
|
27
|
-
<TouchableOpacity style={styles.menuIconContainer} onPress={onClose} activeOpacity={0.6}>
|
|
28
|
-
<Pl60Icon name="close" style={styles.menuIcon} />
|
|
29
|
-
</TouchableOpacity>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
render() {
|
|
34
|
-
const {
|
|
35
|
-
visible,
|
|
36
|
-
animationType,
|
|
37
|
-
onClose,
|
|
38
|
-
backgroundStyle,
|
|
39
|
-
selectedDate,
|
|
40
|
-
minDate,
|
|
41
|
-
maxDate,
|
|
42
|
-
enabledDates,
|
|
43
|
-
selectedColor,
|
|
44
|
-
enabledColor,
|
|
45
|
-
disabledColor,
|
|
46
|
-
} = this.props;
|
|
47
|
-
|
|
48
|
-
const initialDate = (selectedDate ? moment(selectedDate) : moment()).format('YYYY-MM-DD');
|
|
49
|
-
const min = minDate ? moment(minDate).format('YYYY-MM-DD') : undefined;
|
|
50
|
-
const max = maxDate ? moment(maxDate).format('YYYY-MM-DD') : undefined;
|
|
51
|
-
const dateMarkings = {};
|
|
52
|
-
(enabledDates || []).forEach(date => {
|
|
53
|
-
const { day, enabled } = date;
|
|
54
|
-
const key = moment(day).format('YYYY-MM-DD');
|
|
55
|
-
dateMarkings[key] = {
|
|
56
|
-
enabled,
|
|
57
|
-
disableTouchEvent: !enabled,
|
|
58
|
-
customStyles: { text: { color: enabled ? enabledColor || 'green' : disabledColor || 'red' } },
|
|
59
|
-
};
|
|
60
|
-
});
|
|
61
|
-
// console.log('CalendarPopup - enabled', JSON.stringify(dateMarkings, null, 2));
|
|
62
|
-
return (
|
|
63
|
-
<Modal transparent visible={visible || false} animationType={animationType || 'fade'} onRequestClose={onClose}>
|
|
64
|
-
<View style={[styles.popup, backgroundStyle || { backgroundColor: hexToRGBAstring('#fff', 1) }]}>
|
|
65
|
-
<Calendar
|
|
66
|
-
initialDate={initialDate}
|
|
67
|
-
minDate={min}
|
|
68
|
-
maxDate={max}
|
|
69
|
-
markingType={'custom'}
|
|
70
|
-
markedDates={{
|
|
71
|
-
...dateMarkings,
|
|
72
|
-
[initialDate]: { selected: true, selectedColor: selectedColor || 'blue' },
|
|
73
|
-
}}
|
|
74
|
-
onDayPress={this.onDayPress}
|
|
75
|
-
/>
|
|
76
|
-
</View>
|
|
77
|
-
{this.renderClose()}
|
|
78
|
-
</Modal>
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const styles = StyleSheet.create({
|
|
84
|
-
container: {
|
|
85
|
-
backgroundColor: '#000',
|
|
86
|
-
},
|
|
87
|
-
popup: {
|
|
88
|
-
flex: 1,
|
|
89
|
-
justifyContent: 'center',
|
|
90
|
-
},
|
|
91
|
-
menuIconContainer: {
|
|
92
|
-
position: 'absolute',
|
|
93
|
-
top: StatusBarHeight(0),
|
|
94
|
-
right: 0,
|
|
95
|
-
width: 55,
|
|
96
|
-
height: 55,
|
|
97
|
-
zIndex: 3,
|
|
98
|
-
},
|
|
99
|
-
menuIcon: {
|
|
100
|
-
fontSize: 30,
|
|
101
|
-
padding: 15,
|
|
102
|
-
width: 65,
|
|
103
|
-
textAlign: 'center',
|
|
104
|
-
color: '#000',
|
|
105
|
-
zIndex: 3,
|
|
106
|
-
},
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
export { CalendarPopup };
|