versacall-core-library-react 2.0.70 → 2.0.71
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/components/CoreAlert/CoreAlert.js +85 -0
- package/dist/components/CoreAlert/index.js +13 -0
- package/dist/components/CoreAlert/readme.md +21 -0
- package/dist/components/CoreAppBar/CoreAppBar.js +364 -0
- package/dist/components/CoreAppBar/CoreAppBarDrawer.js +134 -0
- package/dist/components/CoreAppBar/README.md +27 -0
- package/dist/components/CoreAppBar/index.js +13 -0
- package/dist/components/CoreAppBar/screenshot.png +0 -0
- package/dist/components/CoreAppSelector/AppLink.js +101 -0
- package/dist/components/CoreAppSelector/CoreAppSelector.js +155 -0
- package/dist/components/CoreAppSelector/index.js +13 -0
- package/dist/components/CoreDialogueToolBar/CoreDialogueToolBar.js +123 -0
- package/dist/components/CoreDialogueToolBar/index.js +13 -0
- package/dist/components/CoreDrawer/CoreDrawer.js +236 -0
- package/dist/components/CoreDrawer/README.md +36 -0
- package/dist/components/CoreDrawer/index.js +13 -0
- package/dist/components/CoreDrawer/screenshot_collapsed.png +0 -0
- package/dist/components/CoreDrawer/screenshot_expanded.png +0 -0
- package/dist/components/CoreDropDownTextfield/CoreDropDownTextfield.js +85 -0
- package/dist/components/CoreDropDownTextfield/index.js +13 -0
- package/dist/components/CoreElapsedTime/CoreElapsedTime.js +57 -0
- package/dist/components/CoreElapsedTime/index.js +13 -0
- package/dist/components/CoreFrame/CoreFrame.js +64 -0
- package/dist/components/CoreFrame/index.js +13 -0
- package/dist/components/CoreImportDialog/CoreImportDialog.js +350 -0
- package/dist/components/CoreImportDialog/index.js +13 -0
- package/dist/components/CoreImportResultsDialog/CoreImportResultsDialog.js +103 -0
- package/dist/components/CoreImportResultsDialog/index.js +13 -0
- package/dist/components/CoreImporting/CoreImporting.js +60 -0
- package/dist/components/CoreImporting/index.js +13 -0
- package/dist/components/CorePlugin/CorePlugin.js +134 -0
- package/dist/components/CorePlugin/OldCorePlugin.js +124 -0
- package/dist/components/CorePlugin/index.js +13 -0
- package/dist/components/CoreSaveChangesDialog/CoreSaveChangesDialog.js +62 -0
- package/dist/components/CoreSaveChangesDialog/index.js +13 -0
- package/dist/components/CoreShiftTagFilter/CoreShiftTagFilter.js +350 -0
- package/dist/components/CoreShiftTagFilter/OldCoreShiftTagFilter.js +208 -0
- package/dist/components/CoreShiftTagFilter/index.js +13 -0
- package/dist/components/CoreSideBar/CoreSideBar.js +737 -0
- package/dist/components/CoreSideBar/CoreSideBarDrawer.js +172 -0
- package/dist/components/CoreSideBar/index.js +13 -0
- package/dist/components/CoreSnackBar/CoreSnackBar.js +116 -0
- package/dist/components/CoreSnackBar/index.js +13 -0
- package/dist/components/CoreSnackBar/readme.md +23 -0
- package/dist/components/CoreTable/CoreTable.js +315 -0
- package/dist/components/CoreTable/CoreTableChips.js +50 -0
- package/dist/components/CoreTable/CoreTableHead.js +175 -0
- package/dist/components/CoreTable/CoreTableToolbar.js +108 -0
- package/dist/components/CoreTable/index.js +13 -0
- package/dist/components/CoreTable/readMe.md +79 -0
- package/dist/components/CoreTagFilter/CoreTagFilter.js +275 -0
- package/dist/components/CoreTagFilter/OldCoreTagFilter.js +341 -0
- package/dist/components/CoreTagFilter/OldTagChip.js +44 -0
- package/dist/components/CoreTagFilter/OldTagFilterSelector.js +105 -0
- package/dist/components/CoreTagFilter/OldTagOption.js +53 -0
- package/dist/components/CoreTagFilter/TagFilterBuilder.js +487 -0
- package/dist/components/CoreTagFilter/index.js +13 -0
- package/dist/components/CoreTextField/CoreTextField.js +109 -0
- package/dist/components/CoreTextField/index.js +13 -0
- package/dist/components/CoreTheme/CoreTheme.css +9 -0
- package/dist/components/CoreTheme/CoreTheme.js +51 -0
- package/dist/components/CoreTheme/README.md +3 -0
- package/dist/components/CoreTheme/index.js +13 -0
- package/dist/components/CoreTile/CoreTile.js +62 -0
- package/dist/components/CoreTile/CoreTileToolbar.js +62 -0
- package/dist/components/CoreTile/index.js +13 -0
- package/dist/components/CoreTimerInput/CoreTimerInput.js +203 -0
- package/dist/components/CoreTimerInput/CoreTimerInputOld.js +146 -0
- package/dist/components/CoreTimerInput/index.js +13 -0
- package/dist/components/CoreToolbar/CoreToolbar.js +205 -0
- package/dist/components/CoreToolbar/index.js +13 -0
- package/dist/components/CoreTracker/CoreTracker.js +52 -0
- package/dist/components/CoreTracker/index.js +13 -0
- package/dist/components/CoreTranslate/CoreTranslate.js +62 -0
- package/dist/components/CoreTranslate/README.md +5 -0
- package/dist/components/CoreTranslate/index.js +13 -0
- package/dist/components/CoreTranslate/translations/en.json +451 -0
- package/dist/components/CoreTranslate/translations/es.json +433 -0
- package/dist/components/CoreTranslateWrapper/CoreTranslateWrapper.js +36 -0
- package/dist/components/CoreTranslateWrapper/index.js +13 -0
- package/dist/components/CoreWidget/CoreWidget.js +120 -0
- package/dist/components/CoreWidget/index.js +13 -0
- package/dist/components/CoreWrapper/CoreWrapper.js +51 -0
- package/dist/components/CoreWrapper/README.md +41 -0
- package/dist/components/CoreWrapper/index.js +13 -0
- package/dist/components/index.js +202 -0
- package/dist/constants/index.js +20 -0
- package/dist/constants/testOrganization.js +31 -0
- package/dist/constants/testToken.js +33 -0
- package/dist/context/Authentication/AuthenticationContext.js +10 -0
- package/dist/context/Authentication/AuthenticationProvider.js +225 -0
- package/dist/context/Authentication/README.md +47 -0
- package/dist/context/Authentication/index.js +27 -0
- package/dist/context/Authentication/withAuthentication.js +15 -0
- package/dist/context/Channels/ChannelsConsumer.js +42 -0
- package/dist/context/Channels/ChannelsContext.js +10 -0
- package/dist/context/Channels/ChannelsProvider.js +258 -0
- package/dist/context/Channels/DataChannel.js +68 -0
- package/dist/context/Channels/EntityChannel.js +69 -0
- package/dist/context/Channels/EveryoneChannel.js +55 -0
- package/dist/context/Channels/OrganizationChannel.js +69 -0
- package/dist/context/Channels/README.md +52 -0
- package/dist/context/Channels/UserChannel.js +60 -0
- package/dist/context/Channels/index.js +69 -0
- package/dist/context/Channels/withChannels.js +15 -0
- package/dist/context/Core/CoreContext.js +10 -0
- package/dist/context/Core/CoreProvider.js +107 -0
- package/dist/context/Core/README.md +43 -0
- package/dist/context/Core/index.js +27 -0
- package/dist/context/Core/withCore.js +15 -0
- package/dist/context/Organization/OrganizationContext.js +10 -0
- package/dist/context/Organization/OrganizationProvider.js +108 -0
- package/dist/context/Organization/README.md +82 -0
- package/dist/context/Organization/index.js +27 -0
- package/dist/context/Organization/withOrganization.js +15 -0
- package/dist/context/Plugin/PluginContext.js +10 -0
- package/dist/context/Plugin/PluginProvider.js +78 -0
- package/dist/context/Plugin/index.js +27 -0
- package/dist/context/Plugin/withPlugin.js +15 -0
- package/dist/context/index.js +60 -0
- package/dist/css/index.js +20 -0
- package/dist/css/junk.module.css +3 -0
- package/dist/css/scrollbar.css +35 -0
- package/dist/css/scrollbar.module.css +37 -0
- package/dist/functions/TagEvaluator.js +165 -0
- package/dist/functions/compareObjects.js +27 -0
- package/dist/functions/formatElapsedTime.js +18 -0
- package/dist/functions/formatNameFileSafe.js +16 -0
- package/dist/functions/getIconUrl.js +15 -0
- package/dist/functions/getParameterByName.js +34 -0
- package/dist/functions/getProperty.js +17 -0
- package/dist/functions/getUrl.js +15 -0
- package/dist/functions/index.js +62 -0
- package/dist/icons/CopyIcon.js +42 -0
- package/dist/icons/DeleteIcon.js +42 -0
- package/dist/icons/DuplicateIcon.js +42 -0
- package/dist/icons/EditIcon.js +42 -0
- package/dist/icons/FabAddIcon.js +78 -0
- package/dist/icons/PasteIcon.js +42 -0
- package/dist/icons/index.js +48 -0
- package/dist/index.js +71 -0
- package/package.json +2 -2
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _InputAdornment = _interopRequireDefault(require("@material-ui/core/InputAdornment"));
|
|
9
|
+
var _TextField = _interopRequireDefault(require("@material-ui/core/TextField"));
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* eslint-disable react/jsx-no-duplicate-props */ // !! had to disable duplicate props because InputProps (capital I) vs inputProps(lowercase) target different sub components
|
|
17
|
+
const CoreTimerInputOld = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
time,
|
|
20
|
+
handleUpdateTime,
|
|
21
|
+
showSeconds,
|
|
22
|
+
showHours,
|
|
23
|
+
style
|
|
24
|
+
} = _ref;
|
|
25
|
+
let hours = 0;
|
|
26
|
+
let min = 0;
|
|
27
|
+
let sec = time;
|
|
28
|
+
const getTime = () => {
|
|
29
|
+
hours = Math.floor(sec / 3600);
|
|
30
|
+
sec -= hours * 3600;
|
|
31
|
+
min = Math.floor(sec / 60);
|
|
32
|
+
sec -= min * 60;
|
|
33
|
+
};
|
|
34
|
+
// 1000
|
|
35
|
+
// divde by 360 get 2.777
|
|
36
|
+
// math.floor(2.7) = hours
|
|
37
|
+
// 1000 - hours * 360
|
|
38
|
+
// 280 divide by 60 get 4.6
|
|
39
|
+
// math.floor(4.6) = min
|
|
40
|
+
// 280 - min * 60 = seconds
|
|
41
|
+
|
|
42
|
+
getTime();
|
|
43
|
+
const handleChange = (value, type) => {
|
|
44
|
+
let newTime = time;
|
|
45
|
+
if (type === 'hours' && value < 24) {
|
|
46
|
+
newTime -= hours * 3600;
|
|
47
|
+
newTime += 3600 * value;
|
|
48
|
+
}
|
|
49
|
+
if (type === 'min' && value < 60) {
|
|
50
|
+
newTime -= min * 60;
|
|
51
|
+
newTime += 60 * value;
|
|
52
|
+
}
|
|
53
|
+
if (type === 'sec' && value < 60) {
|
|
54
|
+
newTime -= sec;
|
|
55
|
+
newTime += 1 * value; // added the 1 to convert value to int
|
|
56
|
+
}
|
|
57
|
+
return handleUpdateTime(Math.abs(newTime));
|
|
58
|
+
};
|
|
59
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
60
|
+
style: _objectSpread({
|
|
61
|
+
display: 'flex',
|
|
62
|
+
justifyContent: 'space-between'
|
|
63
|
+
}, style)
|
|
64
|
+
}, showHours && /*#__PURE__*/_react.default.createElement(_TextField.default, {
|
|
65
|
+
id: "hoursInput",
|
|
66
|
+
value: hours,
|
|
67
|
+
onChange: event => handleChange(event.target.value, 'hours'),
|
|
68
|
+
type: "number",
|
|
69
|
+
style: {
|
|
70
|
+
width: '32%'
|
|
71
|
+
},
|
|
72
|
+
InputLabelProps: {
|
|
73
|
+
shrink: true
|
|
74
|
+
},
|
|
75
|
+
InputProps: {
|
|
76
|
+
startAdornment: /*#__PURE__*/_react.default.createElement(_InputAdornment.default, {
|
|
77
|
+
position: "start"
|
|
78
|
+
}, "H")
|
|
79
|
+
},
|
|
80
|
+
inputProps: {
|
|
81
|
+
min: '0'
|
|
82
|
+
},
|
|
83
|
+
margin: "normal",
|
|
84
|
+
variant: "outlined"
|
|
85
|
+
}), /*#__PURE__*/_react.default.createElement(_TextField.default, {
|
|
86
|
+
id: "minutesInput",
|
|
87
|
+
value: min,
|
|
88
|
+
onChange: event => handleChange(event.target.value, 'min'),
|
|
89
|
+
type: "number",
|
|
90
|
+
style: {
|
|
91
|
+
width: '32%'
|
|
92
|
+
},
|
|
93
|
+
InputLabelProps: {
|
|
94
|
+
shrink: true
|
|
95
|
+
},
|
|
96
|
+
InputProps: {
|
|
97
|
+
startAdornment: /*#__PURE__*/_react.default.createElement(_InputAdornment.default, {
|
|
98
|
+
position: "start"
|
|
99
|
+
}, "M")
|
|
100
|
+
},
|
|
101
|
+
inputProps: {
|
|
102
|
+
min: '0'
|
|
103
|
+
},
|
|
104
|
+
margin: "normal",
|
|
105
|
+
variant: "outlined"
|
|
106
|
+
}), showSeconds && /*#__PURE__*/_react.default.createElement(_TextField.default, {
|
|
107
|
+
id: "secondsInput",
|
|
108
|
+
value: sec,
|
|
109
|
+
onChange: event => handleChange(event.target.value, 'sec'),
|
|
110
|
+
type: "number",
|
|
111
|
+
style: {
|
|
112
|
+
width: '32%'
|
|
113
|
+
},
|
|
114
|
+
InputLabelProps: {
|
|
115
|
+
shrink: true
|
|
116
|
+
},
|
|
117
|
+
InputProps: {
|
|
118
|
+
startAdornment: /*#__PURE__*/_react.default.createElement(_InputAdornment.default, {
|
|
119
|
+
position: "start"
|
|
120
|
+
}, "S")
|
|
121
|
+
},
|
|
122
|
+
inputProps: {
|
|
123
|
+
min: '0'
|
|
124
|
+
},
|
|
125
|
+
margin: "normal",
|
|
126
|
+
variant: "outlined"
|
|
127
|
+
}));
|
|
128
|
+
|
|
129
|
+
// should take prop for time in seconds
|
|
130
|
+
// should take a handleChange function
|
|
131
|
+
// pull the event target value and then update the time with that * seconds
|
|
132
|
+
// might wanna move this coreLibrary after
|
|
133
|
+
};
|
|
134
|
+
CoreTimerInputOld.propTypes = {
|
|
135
|
+
time: _propTypes.default.number.isRequired,
|
|
136
|
+
handleUpdateTime: _propTypes.default.func.isRequired,
|
|
137
|
+
showSeconds: _propTypes.default.bool,
|
|
138
|
+
showHours: _propTypes.default.bool,
|
|
139
|
+
style: _propTypes.default.objectOf(_propTypes.default.string)
|
|
140
|
+
};
|
|
141
|
+
CoreTimerInputOld.defaultProps = {
|
|
142
|
+
showSeconds: true,
|
|
143
|
+
showHours: true,
|
|
144
|
+
style: {}
|
|
145
|
+
};
|
|
146
|
+
var _default = exports.default = CoreTimerInputOld;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _CoreTimerInput.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _CoreTimerInput = _interopRequireDefault(require("./CoreTimerInput"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _styles = require("@material-ui/core/styles");
|
|
9
|
+
var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
|
|
10
|
+
var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
|
|
11
|
+
var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
|
|
12
|
+
var _Print = _interopRequireDefault(require("@material-ui/icons/Print"));
|
|
13
|
+
var _Close = _interopRequireDefault(require("@material-ui/icons/Close"));
|
|
14
|
+
var _Toolbar = _interopRequireDefault(require("@material-ui/core/Toolbar"));
|
|
15
|
+
var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
|
|
16
|
+
var _Save = _interopRequireDefault(require("@material-ui/icons/Save"));
|
|
17
|
+
var _Badge = _interopRequireDefault(require("@material-ui/core/Badge"));
|
|
18
|
+
var _reactIntl = require("react-intl");
|
|
19
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
22
|
+
const styles = theme => ({
|
|
23
|
+
fab: {
|
|
24
|
+
margin: 0,
|
|
25
|
+
top: 'auto',
|
|
26
|
+
right: 20,
|
|
27
|
+
bottom: 20,
|
|
28
|
+
left: 'auto',
|
|
29
|
+
position: 'fixed'
|
|
30
|
+
},
|
|
31
|
+
appBar: {
|
|
32
|
+
position: 'relative'
|
|
33
|
+
},
|
|
34
|
+
iconStyle: {
|
|
35
|
+
marginRight: 10
|
|
36
|
+
},
|
|
37
|
+
closeIconStyle: {
|
|
38
|
+
marginLeft: 10
|
|
39
|
+
},
|
|
40
|
+
flex: {
|
|
41
|
+
flex: 1
|
|
42
|
+
},
|
|
43
|
+
root: {
|
|
44
|
+
flexGrow: 1
|
|
45
|
+
},
|
|
46
|
+
separator: {
|
|
47
|
+
display: 'inline',
|
|
48
|
+
width: 2,
|
|
49
|
+
height: 36,
|
|
50
|
+
background: '#496b78',
|
|
51
|
+
margin: 7
|
|
52
|
+
},
|
|
53
|
+
paper: {
|
|
54
|
+
margin: '10px 10px 10px 10px',
|
|
55
|
+
padding: theme.spacing.unit * 2,
|
|
56
|
+
textAlign: 'center',
|
|
57
|
+
color: theme.palette.text.secondary
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
function CoreToolbar(props) {
|
|
61
|
+
const {
|
|
62
|
+
title,
|
|
63
|
+
warning,
|
|
64
|
+
intl,
|
|
65
|
+
classes,
|
|
66
|
+
showSeperator,
|
|
67
|
+
disableHotkeys,
|
|
68
|
+
saveDisabled,
|
|
69
|
+
handleSave
|
|
70
|
+
} = props;
|
|
71
|
+
|
|
72
|
+
/* const propsRef = useRef(props);
|
|
73
|
+
useLayoutEffect(() => {
|
|
74
|
+
propsRef.current = props;
|
|
75
|
+
}); */
|
|
76
|
+
|
|
77
|
+
const handleKeyDown = (0, _react.useCallback)(e => {
|
|
78
|
+
// NOTE: In theory it would be good to have a hotkey for the close button.
|
|
79
|
+
if (!disableHotkeys) {
|
|
80
|
+
// Look for CTRL+S or META+S
|
|
81
|
+
if ((window.navigator.platform.match('Mac') ? e.metaKey : e.ctrlKey) && e.keyCode === 83) {
|
|
82
|
+
// CTRL+S or META+S (Mac)
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
if (!saveDisabled) {
|
|
85
|
+
// console.log('calling save');
|
|
86
|
+
handleSave();
|
|
87
|
+
} else {
|
|
88
|
+
// console.log('save disabled');
|
|
89
|
+
}
|
|
90
|
+
/* } else if (e.altKey && e.keyCode === 115) {
|
|
91
|
+
// ALT+F4
|
|
92
|
+
e.preventDefault();
|
|
93
|
+
if (!props.closeDisabled) {
|
|
94
|
+
props.handleClose();
|
|
95
|
+
}
|
|
96
|
+
} else if (e.ctrlKey && e.keyCode === 115) {
|
|
97
|
+
// CTRL+F4
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
if (!props.closeDisabled) {
|
|
100
|
+
props.handleClose();
|
|
101
|
+
} */
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
// console.log('hotkeys disabled');
|
|
105
|
+
}
|
|
106
|
+
}, [disableHotkeys, saveDisabled, handleSave]);
|
|
107
|
+
_react.default.useEffect(() => {
|
|
108
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
109
|
+
|
|
110
|
+
// cleanup
|
|
111
|
+
return () => {
|
|
112
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
113
|
+
};
|
|
114
|
+
}, [handleKeyDown, disableHotkeys, saveDisabled, handleSave]);
|
|
115
|
+
return /*#__PURE__*/_react.default.createElement(_Toolbar.default, null, props.icon, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
116
|
+
variant: "h6",
|
|
117
|
+
color: "inherit",
|
|
118
|
+
className: classes.flex
|
|
119
|
+
}, title), props.children, props.handlePrint && /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
120
|
+
variant: "contained",
|
|
121
|
+
color: "secondary",
|
|
122
|
+
style: {
|
|
123
|
+
whitespace: 'nowrap'
|
|
124
|
+
},
|
|
125
|
+
onClick: () => props.handlePrint(),
|
|
126
|
+
"aria-label": intl.formatMessage({
|
|
127
|
+
id: '__print'
|
|
128
|
+
}),
|
|
129
|
+
printDisabled: props.printDisabled
|
|
130
|
+
}, /*#__PURE__*/_react.default.createElement(_Print.default, {
|
|
131
|
+
className: classes.iconStyle
|
|
132
|
+
}), /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
133
|
+
id: "__print"
|
|
134
|
+
})), (props.handlePrint || props.children) && (props.handleSave || props.handleClose) && showSeperator && /*#__PURE__*/_react.default.createElement("div", {
|
|
135
|
+
className: classes.separator
|
|
136
|
+
}), props.handleSave && /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
137
|
+
title: "".concat(intl.formatMessage({
|
|
138
|
+
id: '__save'
|
|
139
|
+
}), " (Ctrl+S)"),
|
|
140
|
+
"aria-label": "save"
|
|
141
|
+
}, /*#__PURE__*/_react.default.createElement(_Badge.default, {
|
|
142
|
+
badgeContent: "!",
|
|
143
|
+
color: "error",
|
|
144
|
+
invisible: !warning
|
|
145
|
+
}, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
146
|
+
variant: "contained",
|
|
147
|
+
color: "primary",
|
|
148
|
+
style: {
|
|
149
|
+
whitespace: 'nowrap'
|
|
150
|
+
},
|
|
151
|
+
onClick: () => props.handleSave(),
|
|
152
|
+
"aria-label": intl.formatMessage({
|
|
153
|
+
id: '__save'
|
|
154
|
+
}),
|
|
155
|
+
disabled: props.saveDisabled
|
|
156
|
+
}, /*#__PURE__*/_react.default.createElement(_Save.default, {
|
|
157
|
+
className: classes.iconStyle
|
|
158
|
+
}), /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
159
|
+
id: "__save"
|
|
160
|
+
})))), props.handleClose && /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
161
|
+
title: intl.formatMessage({
|
|
162
|
+
id: '__close'
|
|
163
|
+
}),
|
|
164
|
+
"aria-label": "close"
|
|
165
|
+
}, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
166
|
+
color: "inherit",
|
|
167
|
+
className: classes.closeIconStyle,
|
|
168
|
+
"aria-label": intl.formatMessage({
|
|
169
|
+
id: '__close'
|
|
170
|
+
}),
|
|
171
|
+
disabled: props.closeDisabled,
|
|
172
|
+
onClick: () => props.handleClose()
|
|
173
|
+
}, /*#__PURE__*/_react.default.createElement(_Close.default, null))));
|
|
174
|
+
}
|
|
175
|
+
CoreToolbar.propTypes = {
|
|
176
|
+
icon: _propTypes.default.node,
|
|
177
|
+
title: _propTypes.default.string,
|
|
178
|
+
warning: _propTypes.default.bool,
|
|
179
|
+
handlePrint: _propTypes.default.func,
|
|
180
|
+
handleSave: _propTypes.default.func,
|
|
181
|
+
handleClose: _propTypes.default.func,
|
|
182
|
+
printDisabled: _propTypes.default.bool,
|
|
183
|
+
saveDisabled: _propTypes.default.bool,
|
|
184
|
+
closeDisabled: _propTypes.default.bool,
|
|
185
|
+
showSeperator: _propTypes.default.bool,
|
|
186
|
+
disableHotkeys: _propTypes.default.bool,
|
|
187
|
+
intl: _propTypes.default.shape().isRequired,
|
|
188
|
+
classes: _propTypes.default.shape().isRequired,
|
|
189
|
+
children: _propTypes.default.node
|
|
190
|
+
};
|
|
191
|
+
CoreToolbar.defaultProps = {
|
|
192
|
+
icon: null,
|
|
193
|
+
title: '',
|
|
194
|
+
warning: false,
|
|
195
|
+
handlePrint: null,
|
|
196
|
+
handleSave: null,
|
|
197
|
+
handleClose: null,
|
|
198
|
+
printDisabled: false,
|
|
199
|
+
saveDisabled: false,
|
|
200
|
+
closeDisabled: false,
|
|
201
|
+
showSeperator: true,
|
|
202
|
+
disableHotkeys: false,
|
|
203
|
+
children: null
|
|
204
|
+
};
|
|
205
|
+
var _default = exports.default = (0, _reactIntl.injectIntl)((0, _styles.withStyles)(styles)(CoreToolbar));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _CoreToolbar.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _CoreToolbar = _interopRequireDefault(require("./CoreToolbar"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _Authentication = require("../../context/Authentication");
|
|
10
|
+
var _Core = require("../../context/Core");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
+
const namespace = 'CoreTracker';
|
|
14
|
+
class CoreTracker extends _react.Component {
|
|
15
|
+
componentDidMount() {
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
this.postTrack();
|
|
18
|
+
}, this.props.seconds * 1000);
|
|
19
|
+
}
|
|
20
|
+
postTrack() {
|
|
21
|
+
const methodName = 'postTrack()';
|
|
22
|
+
if (this.props.authentication.authenticated) {
|
|
23
|
+
this.props.authentication.http({
|
|
24
|
+
method: 'post',
|
|
25
|
+
url: "".concat(this.props.core.baseUrl, "/api/user/activity/track"),
|
|
26
|
+
params: {
|
|
27
|
+
type: this.props.type,
|
|
28
|
+
itemId: this.props.id
|
|
29
|
+
}
|
|
30
|
+
}).then(results => {
|
|
31
|
+
this.props.core.log('system', namespace, methodName, "Type: ".concat(this.props.type, " Track: ").concat(this.props.id), results);
|
|
32
|
+
}).catch(error => {
|
|
33
|
+
this.props.core.log('error', namespace, methodName, error);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
render() {
|
|
38
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
39
|
+
style: {
|
|
40
|
+
display: 'none'
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
CoreTracker.propTypes = {
|
|
46
|
+
type: _propTypes.default.string.isRequired,
|
|
47
|
+
id: _propTypes.default.string.isRequired,
|
|
48
|
+
seconds: _propTypes.default.number.isRequired,
|
|
49
|
+
core: _propTypes.default.shape().isRequired,
|
|
50
|
+
authentication: _propTypes.default.shape().isRequired
|
|
51
|
+
};
|
|
52
|
+
var _default = exports.default = (0, _Core.withCore)((0, _Authentication.withAuthentication)(CoreTracker));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _CoreTracker.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _CoreTracker = _interopRequireDefault(require("./CoreTracker"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactIntl = require("react-intl");
|
|
9
|
+
var _en = _interopRequireDefault(require("react-intl/locale-data/en"));
|
|
10
|
+
var _es = _interopRequireDefault(require("react-intl/locale-data/es"));
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _deepmerge = _interopRequireDefault(require("deepmerge"));
|
|
13
|
+
var _en2 = _interopRequireDefault(require("./translations/en.json"));
|
|
14
|
+
var _es2 = _interopRequireDefault(require("./translations/es.json"));
|
|
15
|
+
var _context = require("../../context");
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
/* eslint camelcase: "off" */
|
|
18
|
+
|
|
19
|
+
const namespace = 'CoreTranslate';
|
|
20
|
+
const defaultMessages = {
|
|
21
|
+
en: _en2.default,
|
|
22
|
+
es: _es2.default
|
|
23
|
+
};
|
|
24
|
+
(0, _reactIntl.addLocaleData)([..._en.default, ..._es.default]);
|
|
25
|
+
function CoreTranslate(props) {
|
|
26
|
+
const methodName = 'CoreTranslate()';
|
|
27
|
+
const {
|
|
28
|
+
locale,
|
|
29
|
+
timeZone,
|
|
30
|
+
messages,
|
|
31
|
+
core
|
|
32
|
+
} = props;
|
|
33
|
+
const duplicated = {
|
|
34
|
+
en: Object.keys(messages.en).filter(key => Object.keys(defaultMessages.en).includes(key)),
|
|
35
|
+
es: Object.keys(messages.es).filter(key => Object.keys(defaultMessages.es).includes(key))
|
|
36
|
+
};
|
|
37
|
+
if (duplicated.en.length > 0 || duplicated.es.length > 0) {
|
|
38
|
+
core.log('warning', namespace, methodName, 'Translation Keys Already in Core Library', duplicated);
|
|
39
|
+
}
|
|
40
|
+
const combinedMessages = _deepmerge.default.all([defaultMessages, messages]);
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement(_reactIntl.IntlProvider, {
|
|
42
|
+
locale: locale,
|
|
43
|
+
timeZone: timeZone,
|
|
44
|
+
messages: combinedMessages[locale]
|
|
45
|
+
}, props.children);
|
|
46
|
+
}
|
|
47
|
+
CoreTranslate.propTypes = {
|
|
48
|
+
locale: _propTypes.default.string,
|
|
49
|
+
timeZone: _propTypes.default.string,
|
|
50
|
+
messages: _propTypes.default.objectOf(_propTypes.default.object),
|
|
51
|
+
core: _propTypes.default.shape().isRequired,
|
|
52
|
+
children: _propTypes.default.node.isRequired
|
|
53
|
+
};
|
|
54
|
+
CoreTranslate.defaultProps = {
|
|
55
|
+
locale: 'en',
|
|
56
|
+
timeZone: '',
|
|
57
|
+
messages: {
|
|
58
|
+
en: {},
|
|
59
|
+
es: {}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var _default = exports.default = (0, _context.withCore)(CoreTranslate);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# CoreTranslate
|
|
2
|
+
|
|
3
|
+
This is a wrapper that supports multiple languages by adding [react-intl](https://github.com/yahoo/react-intl) to the application. This also provides translations for any components inside of core-library-react.
|
|
4
|
+
|
|
5
|
+
Can be added directly but typically done by adding [CoreWrapper](../CoreWrapper) to the application.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _CoreTranslate.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _CoreTranslate = _interopRequireDefault(require("./CoreTranslate"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|