versacall-dashboards-library-react 2.0.39 → 2.0.40

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.
Files changed (102) hide show
  1. package/package.json +2 -2
  2. package/dist/components/DashboardsCell/DashboardsCell.js +0 -267
  3. package/dist/components/DashboardsCell/index.js +0 -15
  4. package/dist/components/DashboardsCellContent/DashboardsCellContent.js +0 -438
  5. package/dist/components/DashboardsCellContent/index.js +0 -15
  6. package/dist/components/DashboardsCellFindAndReplace/DashboardsCellFindAndReplace.js +0 -190
  7. package/dist/components/DashboardsCellFindAndReplace/index.js +0 -15
  8. package/dist/components/DashboardsCellGlobalActions/DashboardsCellGlobalActions.js +0 -218
  9. package/dist/components/DashboardsCellGlobalActions/index.js +0 -15
  10. package/dist/components/DashboardsCellGlobalConditions/DashboardsCellGlobalConditions.js +0 -1043
  11. package/dist/components/DashboardsCellGlobalConditions/DashboardsCellGlobalConditionsNestable.js +0 -927
  12. package/dist/components/DashboardsCellGlobalConditions/DashboardsCellGlobalConditionsOld.js +0 -816
  13. package/dist/components/DashboardsCellGlobalConditions/index.js +0 -15
  14. package/dist/components/DashboardsCellGlobalStyles/DashboardsCellGlobalStyles.js +0 -394
  15. package/dist/components/DashboardsCellGlobalStyles/index.js +0 -15
  16. package/dist/components/DashboardsCellMergeUnmerge/DashboardsCellMergeUnmerge.js +0 -152
  17. package/dist/components/DashboardsCellMergeUnmerge/index.js +0 -15
  18. package/dist/components/DashboardsCellPosition/DashboardsCellPosition.js +0 -85
  19. package/dist/components/DashboardsCellPosition/index.js +0 -15
  20. package/dist/components/DashboardsCellSize/DashboardsCellSize.js +0 -89
  21. package/dist/components/DashboardsCellSize/index.js +0 -15
  22. package/dist/components/DashboardsCellStyle/DashboardsCellStyle.js +0 -83
  23. package/dist/components/DashboardsCellStyle/index.js +0 -15
  24. package/dist/components/DashboardsCellStyleAlignItems/DashboardsCellStyleAlignItems.js +0 -152
  25. package/dist/components/DashboardsCellStyleAlignItems/index.js +0 -15
  26. package/dist/components/DashboardsCellStyleBackgroundColor/DashboardsCellStyleBackgroundColor.js +0 -198
  27. package/dist/components/DashboardsCellStyleBackgroundColor/index.js +0 -15
  28. package/dist/components/DashboardsCellStyleClear/DashboardsCellStyleClear.js +0 -50
  29. package/dist/components/DashboardsCellStyleClear/index.js +0 -15
  30. package/dist/components/DashboardsCellStyleColor/DashboardsCellStyleColor.js +0 -198
  31. package/dist/components/DashboardsCellStyleColor/index.js +0 -15
  32. package/dist/components/DashboardsCellStyleDisplay/DashboardsCellStyleDisplay.js +0 -65
  33. package/dist/components/DashboardsCellStyleDisplay/index.js +0 -15
  34. package/dist/components/DashboardsCellStyleFontFamily/DashboardsCellStyleFontFamily.js +0 -64
  35. package/dist/components/DashboardsCellStyleFontFamily/index.js +0 -15
  36. package/dist/components/DashboardsCellStyleFontSize/DashboardsCellStyleFontSize.js +0 -89
  37. package/dist/components/DashboardsCellStyleFontSize/index.js +0 -15
  38. package/dist/components/DashboardsCellStyleJustifyContent/DashboardsCellStyleJustifyContent.js +0 -152
  39. package/dist/components/DashboardsCellStyleJustifyContent/index.js +0 -15
  40. package/dist/components/DashboardsCellStyleObjectFit/DashboardsCellStyleObjectFit.js +0 -81
  41. package/dist/components/DashboardsCellStyleObjectFit/index.js +0 -15
  42. package/dist/components/DashboardsCellStylePadding/DashboardsCellStylePadding.js +0 -105
  43. package/dist/components/DashboardsCellStylePadding/index.js +0 -15
  44. package/dist/components/DashboardsCellStyleWeightStyleDecoration/DashboardsCellStyleWeightStyleDecoration.js +0 -154
  45. package/dist/components/DashboardsCellStyleWeightStyleDecoration/index.js +0 -15
  46. package/dist/components/DashboardsCopyAndPaste/DashboardsCopyAndPaste.js +0 -112
  47. package/dist/components/DashboardsCopyAndPaste/index.js +0 -15
  48. package/dist/components/DashboardsEditor/DashboardsEditor.js +0 -415
  49. package/dist/components/DashboardsEditor/index.js +0 -15
  50. package/dist/components/DashboardsGlobalStylesPicker/DashboardsGlobalStylesPicker.js +0 -90
  51. package/dist/components/DashboardsGlobalStylesPicker/index.js +0 -15
  52. package/dist/components/DashboardsGrid/DashboardsGrid.js +0 -139
  53. package/dist/components/DashboardsGrid/index.js +0 -15
  54. package/dist/components/DashboardsMainFreehand/DashboardsMainFreehand.js +0 -466
  55. package/dist/components/DashboardsMainFreehand/index.js +0 -15
  56. package/dist/components/DashboardsMainMessaging/DashboardsMainMessaging.js +0 -628
  57. package/dist/components/DashboardsMainMessaging/index.js +0 -15
  58. package/dist/components/DashboardsMainTable/DashboardsMainTable.js +0 -626
  59. package/dist/components/DashboardsMainTable/index.js +0 -15
  60. package/dist/components/DashboardsPreview/DashboardsPreview.js +0 -113
  61. package/dist/components/DashboardsPreview/index.js +0 -15
  62. package/dist/components/DashboardsRatio/DashboardsRatio.js +0 -288
  63. package/dist/components/DashboardsRatio/DashboardsRatioOld.js +0 -211
  64. package/dist/components/DashboardsRatio/index.js +0 -15
  65. package/dist/components/DashboardsStatusBar/DashboardsStatusBar.css +0 -1
  66. package/dist/components/DashboardsStatusBar/DashboardsStatusBar.js +0 -137
  67. package/dist/components/DashboardsStatusBar/index.js +0 -15
  68. package/dist/components/DashboardsUndoRedo/DashboardsUndoRedo.js +0 -144
  69. package/dist/components/DashboardsUndoRedo/index.js +0 -15
  70. package/dist/components/DashboardsViewer/DashboardsViewer.js +0 -74
  71. package/dist/components/DashboardsViewer/index.js +0 -15
  72. package/dist/components/DashboardsWidthHeight/DashboardsWidthHeight.js +0 -98
  73. package/dist/components/DashboardsWidthHeight/index.js +0 -15
  74. package/dist/components/WidgetParameters/WidgetParameters.js +0 -383
  75. package/dist/components/WidgetParameters/index.js +0 -15
  76. package/dist/components/index.js +0 -287
  77. package/dist/constants/defaultFreehandCell.js +0 -23
  78. package/dist/constants/defaultFreehandDashboard.js +0 -23
  79. package/dist/constants/defaultMessagingDashboard.js +0 -53
  80. package/dist/constants/defaultStyle.js +0 -11
  81. package/dist/constants/defaultTableCell.js +0 -27
  82. package/dist/constants/defaultTableDashboard.js +0 -25
  83. package/dist/constants/index.js +0 -55
  84. package/dist/functions/addTranslations.js +0 -28
  85. package/dist/functions/calculateDashboardVariables.js +0 -146
  86. package/dist/functions/convertColorObject.js +0 -10
  87. package/dist/functions/convertColorString.js +0 -26
  88. package/dist/functions/convertPercentToInt.js +0 -10
  89. package/dist/functions/convertSecondsToElapsedTime.js +0 -37
  90. package/dist/functions/generateFreehandCell.js +0 -24
  91. package/dist/functions/generateFreehandDashboard.js +0 -19
  92. package/dist/functions/generateMessagingDashboard.js +0 -14
  93. package/dist/functions/generateSelected.js +0 -18
  94. package/dist/functions/generateTableCell.js +0 -18
  95. package/dist/functions/generateTableDashboard.js +0 -37
  96. package/dist/functions/index.js +0 -119
  97. package/dist/functions/mergeSelected.js +0 -22
  98. package/dist/functions/sortCells.js +0 -26
  99. package/dist/images/BackgroundTransparency.png +0 -0
  100. package/dist/index.js +0 -44
  101. package/dist/translations/en.json +0 -11
  102. package/dist/translations/es.json +0 -3
@@ -1,1043 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireWildcard(require("react"));
9
-
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
- var _styles = require("@material-ui/core/styles");
13
-
14
- var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
15
-
16
- var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
17
-
18
- var _FormControlLabel = _interopRequireDefault(require("@material-ui/core/FormControlLabel"));
19
-
20
- var _Switch = _interopRequireDefault(require("@material-ui/core/Switch"));
21
-
22
- var _TextField = _interopRequireDefault(require("@material-ui/core/TextField"));
23
-
24
- var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
25
-
26
- var _Dialog = _interopRequireDefault(require("@material-ui/core/Dialog"));
27
-
28
- var _Paper = _interopRequireDefault(require("@material-ui/core/Paper"));
29
-
30
- var _Grid = _interopRequireDefault(require("@material-ui/core/Grid"));
31
-
32
- var _Tabs = _interopRequireDefault(require("@material-ui/core/Tabs"));
33
-
34
- var _Tab = _interopRequireDefault(require("@material-ui/core/Tab"));
35
-
36
- var _Menu = _interopRequireDefault(require("@material-ui/core/Menu"));
37
-
38
- var _MenuItem = _interopRequireDefault(require("@material-ui/core/MenuItem"));
39
-
40
- var _ArrowDownward = _interopRequireDefault(require("@material-ui/icons/ArrowDownward"));
41
-
42
- var _ArrowUpward = _interopRequireDefault(require("@material-ui/icons/ArrowUpward"));
43
-
44
- var _FileCopy = _interopRequireDefault(require("@material-ui/icons/FileCopy"));
45
-
46
- var _Delete = _interopRequireDefault(require("@material-ui/icons/Delete"));
47
-
48
- var _Add = _interopRequireDefault(require("@material-ui/icons/Add"));
49
-
50
- var _MoreVert = _interopRequireDefault(require("@material-ui/icons/MoreVert"));
51
-
52
- var _OpenWith = _interopRequireDefault(require("@material-ui/icons/OpenWith"));
53
-
54
- var _CallSplit = _interopRequireDefault(require("@material-ui/icons/CallSplit"));
55
-
56
- var _reactBeautifulDnd = require("react-beautiful-dnd");
57
-
58
- var _reactIntl = require("react-intl");
59
-
60
- var _versacallCoreLibraryReact = require("versacall-core-library-react");
61
-
62
- var _DashboardsCellGlobalStyles = _interopRequireDefault(require("../DashboardsCellGlobalStyles"));
63
-
64
- var _DashboardsCellContent = _interopRequireDefault(require("../DashboardsCellContent"));
65
-
66
- var _DashboardsCellStyle = _interopRequireDefault(require("../DashboardsCellStyle"));
67
-
68
- var _DashboardsPreview = _interopRequireDefault(require("../DashboardsPreview"));
69
-
70
- var _DashboardsCell = _interopRequireDefault(require("../DashboardsCell"));
71
-
72
- require("react-nestable-fork/dist/Nestable/Nestable.css");
73
-
74
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
75
-
76
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
77
-
78
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
79
-
80
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
81
-
82
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
83
-
84
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
85
-
86
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
87
-
88
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
89
-
90
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
91
-
92
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
93
-
94
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
95
-
96
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
97
-
98
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
99
-
100
- var muiStyles = () => ({
101
- dialog: {
102
- backgroundColor: '#eff4f8'
103
- },
104
- icon: {
105
- marginRight: 10
106
- },
107
- anchor: {
108
- marginLeft: 10,
109
- color: 'rgba(0, 0, 0, 0.54)',
110
- '&:hover': {
111
- cursor: 'grab'
112
- }
113
- },
114
- selectable: {
115
- '&:hover': {
116
- cursor: 'pointer'
117
- }
118
- },
119
- menuPaper: {
120
- backgroundColor: '#496b78',
121
- color: '#ffffff'
122
- },
123
- menuList: {
124
- color: '#ffffff'
125
- }
126
- });
127
-
128
- var style = {
129
- root: {
130
- position: 'relative',
131
- display: 'flex',
132
- flexFlow: 'column',
133
- height: '76vh',
134
- padding: 16,
135
- paddingBottom: 0,
136
- // backgroundColor: '#e6e6e6',
137
- overflow: 'hidden'
138
- },
139
- fullHeight: {
140
- height: '100%',
141
- overflow: 'hidden'
142
- },
143
- paper: {
144
- // display: 'block',
145
- boxSizing: 'border-box',
146
- padding: 16,
147
- overflow: 'hidden'
148
- },
149
- block: {
150
- display: 'block',
151
- boxSizing: 'border-box'
152
- },
153
- scrollHolder: {
154
- position: 'relative',
155
- height: '100%'
156
- },
157
- scroll: {
158
- position: 'absolute',
159
- // display: 'block',
160
- width: '100%',
161
- maxHeight: '100%',
162
- overflow: 'auto',
163
- overflowY: 'auto'
164
- },
165
- fab: {
166
- position: 'absolute',
167
- right: 22,
168
- bottom: 4
169
- },
170
- styleBox: {
171
- borderStyle: 'solid',
172
- borderWidth: 1,
173
- borderColor: 'rgba(0, 0, 0, 0.23',
174
- borderRadius: 4,
175
- padding: 16,
176
- marginBottom: 16,
177
- marginTop: 16
178
- },
179
- button: {
180
- textAlign: 'center',
181
- textTransform: 'uppercase',
182
- color: 'rgba(0, 0, 0, 0.87)',
183
- padding: '12px 24px',
184
- border: '1px solid rgba(0, 0, 0, 0.23)',
185
- fontSize: '0.9375rem',
186
- borderRadius: '4px'
187
- },
188
- information: {
189
- padding: 16,
190
- textTransform: 'uppercase'
191
- }
192
- };
193
- var operatorOptions = [{
194
- value: '===',
195
- label: '='
196
- }, {
197
- value: '>',
198
- label: '>'
199
- }, {
200
- value: '<',
201
- label: '<'
202
- }, {
203
- value: '!==',
204
- label: "".concat(String.fromCharCode(0x2260))
205
- }, {
206
- value: '>=',
207
- label: "".concat(String.fromCharCode(0x2265))
208
- }, {
209
- value: '<=',
210
- label: "".concat(String.fromCharCode(0x2264))
211
- }];
212
-
213
- var formatCondition = original => {
214
- var formatted = original;
215
- formatted = formatted.replace('===', '=');
216
- formatted = formatted.replace('!==', String.fromCharCode(0x2260));
217
- formatted = formatted.replace('>=', String.fromCharCode(0x2265));
218
- formatted = formatted.replace('<=', String.fromCharCode(0x2264));
219
- formatted = formatted.replace('&&', 'AND');
220
- formatted = formatted.replace('||', 'OR');
221
- return formatted;
222
- };
223
-
224
- var tabStyle = active => ({
225
- // border: active ? '2px solid #008bcc' : '',
226
- color: active ? 'black' : 'white',
227
- backgroundColor: active ? '#55b7dc' : '#496b78' // borderRadius: '3px',
228
-
229
- });
230
-
231
- var contentPreviewCustomCell = ({
232
- row
233
- }) => /*#__PURE__*/_react.default.createElement("div", {
234
- style: {
235
- width: 120
236
- }
237
- }, /*#__PURE__*/_react.default.createElement(_DashboardsPreview.default, {
238
- width: "120px",
239
- height: "100px",
240
- padding: "10px"
241
- }, /*#__PURE__*/_react.default.createElement(_DashboardsCell.default, {
242
- cell: {
243
- content: row.content,
244
- custom: {
245
- viewWidth: 120,
246
- viewHeight: 100,
247
- style: {}
248
- }
249
- }
250
- })));
251
- /* const conditionCustomCell = ({ row }) => {
252
- let newCondition = row.condition;
253
- if (newCondition.split(' ').length === 3) {
254
- operatorOptions.forEach(option => {
255
- newCondition = newCondition.replace(new RegExp(option.value, 'g'), option.label);
256
- });
257
- }
258
- return newCondition;
259
- }; */
260
- // const grid = 8;
261
-
262
-
263
- var getItemStyle = (isDragging, draggableStyle) => _objectSpread({
264
- // some basic styles to make the items look a bit nicer
265
- userSelect: 'none',
266
- // padding: grid * 2,
267
- // margin: `0 0 ${grid}px 0`,
268
- marginBottom: 10
269
- }, draggableStyle);
270
-
271
- var getListStyle = isDraggingOver => ({// background: isDraggingOver ? 'lightblue' : 'lightgrey',
272
- // padding: grid,
273
- // width: 250,
274
- }); // a little function to help us with reordering the result
275
-
276
-
277
- var reorder = (list, startIndex, endIndex) => {
278
- var result = Array.from(list);
279
-
280
- var _result$splice = result.splice(startIndex, 1),
281
- _result$splice2 = _slicedToArray(_result$splice, 1),
282
- removed = _result$splice2[0];
283
-
284
- result.splice(endIndex, 0, removed);
285
- return result;
286
- };
287
-
288
- var determineIfAdvanced = condition => {
289
- // console.log('determinIfAdvanced', condition);
290
- if (condition) {
291
- var split = condition.split(/[ ,]+/);
292
-
293
- if (split.length === 3) {
294
- var operator = operatorOptions.find(x => x.value === split[1]);
295
-
296
- if (operator) {
297
- return false;
298
- }
299
- }
300
- }
301
-
302
- return true;
303
- };
304
-
305
- class DashboardsCellGlobalConditions extends _react.Component {
306
- constructor(props) {
307
- super(props);
308
- this.state = {
309
- open: false,
310
- tabIndex: 0,
311
- conditionIndex: null,
312
- menuIndex: null,
313
- menuAnchorEl: null,
314
- advanced: false
315
- /* styleColumns: [
316
- {
317
- id: 'condition', style: { paddingRight: 0 }, label: props.intl.formatMessage({ id: '__condition' }), customCell: custom => conditionCustomCell(custom),
318
- },
319
- {
320
- id: 'preview', style: { paddingRight: 0 }, label: props.intl.formatMessage({ id: '__preview' }), customCell: custom => this.stylePreviewCustomCell(custom),
321
- },
322
- {
323
- id: 'actions', style: { textAlign: 'right' }, label: props.intl.formatMessage({ id: '__actions' }), customCell: custom => this.actionsCustomCell(custom),
324
- }
325
- ],
326
- conditionColumns: [
327
- {
328
- id: 'condition', style: { paddingRight: 0 }, label: props.intl.formatMessage({ id: '__condition' }), customCell: custom => conditionCustomCell(custom),
329
- },
330
- {
331
- id: 'type', style: { paddingRight: 0 }, label: props.intl.formatMessage({ id: '__type' }), customCell: custom => this.contentTypeCustomCell(custom),
332
- },
333
- {
334
- id: 'preview', style: { paddingRight: 0 }, label: props.intl.formatMessage({ id: '__preview' }), customCell: custom => contentPreviewCustomCell(custom),
335
- },
336
- {
337
- id: 'actions', style: { textAlign: 'right' }, label: props.intl.formatMessage({ id: '__actions' }), customCell: custom => this.actionsCustomCell(custom),
338
- }
339
- ], */
340
-
341
- };
342
- }
343
-
344
- stylePreviewCustomCell({
345
- row
346
- }) {
347
- var _this = this;
348
-
349
- var newCell = JSON.parse(JSON.stringify(row));
350
- newCell.custom = {
351
- viewWidth: 120,
352
- viewHeight: 120,
353
- style: {}
354
- };
355
-
356
- if (this.props.styles.length > 0 && row.styleIds && row.styleIds.length > 0) {
357
- var _loop = function _loop(i) {
358
- var findStyle = _this.props.styles.find(searchStyle => searchStyle.id === newCell.styleIds[i]);
359
-
360
- if (findStyle) {
361
- newCell.custom.style = _objectSpread(_objectSpread({}, newCell.custom.style), findStyle.options);
362
- }
363
- };
364
-
365
- for (var i = 0; i < newCell.styleIds.length; i++) {
366
- _loop(i);
367
- }
368
- }
369
-
370
- newCell.custom.style = _objectSpread(_objectSpread({}, newCell.custom.style), newCell.style);
371
- return /*#__PURE__*/_react.default.createElement("div", {
372
- style: {
373
- width: 120
374
- }
375
- }, /*#__PURE__*/_react.default.createElement(_DashboardsPreview.default, {
376
- width: "120px",
377
- height: "100px",
378
- padding: "10px"
379
- }, /*#__PURE__*/_react.default.createElement(_DashboardsCell.default, {
380
- cell: {
381
- content: {
382
- type: 'text',
383
- text: 'Hello'
384
- },
385
- custom: newCell.custom
386
- }
387
- })));
388
- }
389
-
390
- contentTypeCustomCell({
391
- row
392
- }) {
393
- return /*#__PURE__*/_react.default.createElement("span", null, this.props.intl.formatMessage({
394
- id: "__".concat(row.content.type)
395
- }));
396
- }
397
-
398
- actionsCustomCell({
399
- row
400
- }) {
401
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, row.index !== '0' && /*#__PURE__*/_react.default.createElement(_IconButton.default, {
402
- onClick: e => {
403
- e.stopPropagation();
404
- this.moveCondition(row.index, -1);
405
- }
406
- }, /*#__PURE__*/_react.default.createElement(_ArrowUpward.default, null)), row.index !== String(this.props.value[this.state.tabIndex === 0 ? 'styleConditions' : 'contentConditions'].length - 1) && /*#__PURE__*/_react.default.createElement(_IconButton.default, {
407
- onClick: e => {
408
- e.stopPropagation();
409
- this.moveCondition(row.index, 1);
410
- }
411
- }, /*#__PURE__*/_react.default.createElement(_ArrowDownward.default, null)), /*#__PURE__*/_react.default.createElement(_IconButton.default, {
412
- onClick: e => {
413
- e.stopPropagation();
414
- this.copyCondition(row);
415
- }
416
- }, /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
417
- title: this.props.intl.formatMessage({
418
- id: '__copy'
419
- })
420
- }, /*#__PURE__*/_react.default.createElement(_FileCopy.default, null))), /*#__PURE__*/_react.default.createElement(_IconButton.default, {
421
- onClick: e => {
422
- e.stopPropagation();
423
- this.deleteCondition(row.index);
424
- }
425
- }, /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
426
- title: this.props.intl.formatMessage({
427
- id: '__delete'
428
- })
429
- }, /*#__PURE__*/_react.default.createElement(_Delete.default, null))));
430
- }
431
-
432
- updateCondition(change) {
433
- var _this$state = this.state,
434
- conditionIndex = _this$state.conditionIndex,
435
- tabIndex = _this$state.tabIndex; // console.log(`conditionIndex = ${conditionIndex}`);
436
-
437
- var updatedValue = _objectSpread({}, this.props.value); // console.log('updatedValue', updatedValue);
438
- // const conditions = updatedValue[`${typeCondition}Conditions`];
439
-
440
-
441
- var conditions = tabIndex === 1 ? updatedValue.contentConditions : updatedValue.styleConditions; // const conditions = JSON.parse(JSON.stringify(this.props.value[`${this.state.typeCondition}Conditions`]));
442
-
443
- if (this.state.advanced) {
444
- conditions[conditionIndex].condition = change.value;
445
- } else {
446
- var split = conditions[conditionIndex].condition.split(/[ ,]+/);
447
- var segment1 = split[0];
448
- var segment2 = split.length > 1 ? split[1] : '===';
449
- var segment3 = split.length > 2 ? split[2] : '0';
450
-
451
- switch (change.stringIndex) {
452
- case 0:
453
- conditions[conditionIndex].condition = "".concat(change.value, " ").concat(segment2, " ").concat(segment3);
454
- break;
455
-
456
- case 1:
457
- conditions[conditionIndex].condition = "".concat(segment1, " ").concat(change.value, " ").concat(segment3);
458
- break;
459
-
460
- case 2:
461
- conditions[conditionIndex].condition = "".concat(segment1, " ").concat(segment2, " ").concat(change.value);
462
- break;
463
-
464
- default:
465
- conditions[conditionIndex].condition = "".concat(segment1, " ").concat(segment2, " ").concat(segment3);
466
- break;
467
- }
468
- } // this.props.updateValue({ [`${this.state.typeCondition}Conditions`]: conditions });
469
-
470
-
471
- this.props.updateValue({
472
- styleConditions: updatedValue.styleConditions,
473
- contentConditions: updatedValue.contentConditions
474
- });
475
- }
476
-
477
- updateStyleIds(value) {
478
- var styleConditions = JSON.parse(JSON.stringify(this.props.value.styleConditions));
479
- styleConditions[this.state.conditionIndex].styleIds = value.styleIds;
480
- this.props.updateValue({
481
- styleConditions: styleConditions
482
- });
483
- }
484
-
485
- updateStyle(value) {
486
- var styleConditions = JSON.parse(JSON.stringify(this.props.value.styleConditions));
487
-
488
- if (Object.keys(value.style).length > 0) {
489
- styleConditions[this.state.conditionIndex].style = _objectSpread(_objectSpread({}, styleConditions[this.state.conditionIndex].style), value.style);
490
- Object.keys(styleConditions[this.state.conditionIndex].style).forEach(key => {
491
- if (styleConditions[this.state.conditionIndex].style[key] === 'delete') {
492
- delete styleConditions[this.state.conditionIndex].style[key];
493
- }
494
- });
495
- } else {
496
- styleConditions[this.state.conditionIndex].style = {};
497
- }
498
-
499
- this.props.updateValue({
500
- styleConditions: styleConditions
501
- });
502
- }
503
-
504
- updateContent(value) {
505
- var contentConditions = JSON.parse(JSON.stringify(this.props.value.contentConditions));
506
- contentConditions[this.state.conditionIndex].content = value.content;
507
- this.props.updateValue({
508
- contentConditions: contentConditions
509
- });
510
- }
511
-
512
- addCondition() {
513
- var conditions = JSON.parse(JSON.stringify(this.props.value));
514
- var index = null;
515
-
516
- if (this.state.tabIndex === 0) {
517
- conditions.styleConditions.push({
518
- condition: '1 > 0',
519
- style: {},
520
- styleIds: []
521
- });
522
- index = conditions.styleConditions.length - 1;
523
- } else {
524
- conditions.contentConditions.push({
525
- condition: '1 > 0',
526
- content: {
527
- type: 'text',
528
- text: ''
529
- }
530
- });
531
- index = conditions.contentConditions.length - 1;
532
- }
533
-
534
- this.props.updateValue({
535
- styleConditions: conditions.styleConditions,
536
- contentConditions: conditions.contentConditions
537
- });
538
- this.setState({
539
- conditionIndex: index,
540
- advanced: false
541
- });
542
- }
543
-
544
- copyCondition(condition) {
545
- var newValue = JSON.parse(JSON.stringify(this.props.value));
546
- var newCondition = JSON.parse(JSON.stringify(condition));
547
- delete newCondition.index;
548
- var conditions = newValue[this.state.tabIndex === 0 ? 'styleConditions' : 'contentConditions'];
549
- conditions.push(newCondition);
550
- var advanced = determineIfAdvanced(newCondition.condition);
551
- this.props.updateValue({
552
- styleConditions: newValue.styleConditions,
553
- contentConditions: newValue.contentConditions
554
- });
555
- this.setState(prevState => ({
556
- conditionIndex: conditions.length - 1,
557
- advanced: advanced
558
- }));
559
- }
560
-
561
- duplicateCondition(index) {
562
- var value = this.props.value;
563
- var tabIndex = this.state.tabIndex;
564
- var condition = value[tabIndex === 0 ? 'styleConditions' : 'contentConditions'][index];
565
- this.copyCondition(condition);
566
- }
567
-
568
- deleteCondition(index) {
569
- var conditions = JSON.parse(JSON.stringify(this.props.value));
570
- conditions[this.state.tabIndex === 0 ? 'styleConditions' : 'contentConditions'].splice(Number(index), 1);
571
- this.props.updateValue({
572
- styleConditions: conditions.styleConditions,
573
- contentConditions: conditions.contentConditions
574
- });
575
- this.setState({
576
- conditionIndex: null,
577
- advanced: false
578
- });
579
- }
580
-
581
- moveCondition(index, direction) {
582
- var conditions = JSON.parse(JSON.stringify(this.props.value));
583
-
584
- var _conditions$splice = conditions[this.state.tabIndex === 0 ? 'styleConditions' : 'contentConditions'].splice(Number(index), 1),
585
- _conditions$splice2 = _slicedToArray(_conditions$splice, 1),
586
- removed = _conditions$splice2[0];
587
-
588
- conditions[this.state.tabIndex === 0 ? 'styleConditions' : 'contentConditions'].splice(Number(index) + direction, 0, removed);
589
- this.props.updateValue({
590
- styleConditions: conditions.styleConditions,
591
- contentConditions: conditions.contentConditions
592
- });
593
- this.setState({
594
- conditionIndex: null,
595
- advanced: false
596
- });
597
- }
598
-
599
- onDragEnd(result) {
600
- var value = this.props.value;
601
- var tabIndex = this.state.tabIndex; // dropped outside the list
602
-
603
- if (!result.destination) {
604
- return;
605
- }
606
-
607
- var items = reorder(tabIndex === 0 ? value.styleConditions : value.contentConditions, result.source.index, result.destination.index);
608
-
609
- var newConditions = _objectSpread({}, value);
610
-
611
- if (tabIndex === 0) {
612
- newConditions.styleConditions = items;
613
- } else {
614
- newConditions.contentConditions = items;
615
- }
616
-
617
- this.props.updateValue({
618
- styleConditions: newConditions.styleConditions,
619
- contentConditions: newConditions.contentConditions
620
- }); // NOTE: The current conditionIndex kind of moves after a move...
621
- // This kind of does it but it just selects the moved cell.
622
-
623
- this.setState({
624
- conditionIndex: result.destination.index
625
- });
626
- }
627
-
628
- selectCondition(index) {
629
- var value = this.props.value;
630
- var tabIndex = this.state.tabIndex;
631
- var conditions = tabIndex === 1 ? value.contentConditions : value.styleConditions;
632
- var condition = conditions[index];
633
- var advanced = determineIfAdvanced(condition.condition);
634
- this.setState({
635
- conditionIndex: index,
636
- advanced: advanced
637
- });
638
- }
639
-
640
- renderConditionCard(obj) {
641
- var item = obj.item,
642
- handler = obj.handler;
643
- var _this$props = this.props,
644
- classes = _this$props.classes,
645
- intl = _this$props.intl;
646
- var _this$state2 = this.state,
647
- tabIndex = _this$state2.tabIndex,
648
- conditionIndex = _this$state2.conditionIndex;
649
- var divStyle = {
650
- border: '1px solid black',
651
- padding: 10,
652
- margin: 2,
653
- display: 'flex',
654
- alignItems: 'center',
655
- backgroundColor: item.index === conditionIndex ? '#55b7dc' : '#ffffff'
656
- };
657
- return /*#__PURE__*/_react.default.createElement("div", {
658
- role: "treeitem",
659
- "aria-hidden": true,
660
- style: divStyle,
661
- className: classes.selectable,
662
- onClick: () => this.selectCondition(item.index)
663
- }, /*#__PURE__*/_react.default.createElement("span", {
664
- style: {
665
- marginRight: 20,
666
- fontWeight: 'bold'
667
- }
668
- }, item.index === 0 ? 'IF' : 'ELSE IF'), /*#__PURE__*/_react.default.createElement("span", {
669
- style: {
670
- flexGrow: 1
671
- }
672
- }, determineIfAdvanced(item.condition) ? item.condition : formatCondition(item.condition)), tabIndex === 0 && this.stylePreviewCustomCell({
673
- row: item
674
- }), tabIndex === 1 && item.content && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
675
- style: {
676
- marginRight: 10
677
- }
678
- }, intl.formatMessage({
679
- id: "__".concat(item.content.type)
680
- })), contentPreviewCustomCell({
681
- row: item
682
- })), handler, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
683
- onClick: e => {
684
- e.stopPropagation();
685
- this.setState({
686
- menuIndex: item.index,
687
- menuAnchorEl: e.target
688
- });
689
- }
690
- }, /*#__PURE__*/_react.default.createElement(_MoreVert.default, null)));
691
- }
692
-
693
- render() {
694
- var _this$props2 = this.props,
695
- classes = _this$props2.classes,
696
- intl = _this$props2.intl,
697
- value = _this$props2.value,
698
- images = _this$props2.images,
699
- styles = _this$props2.styles,
700
- tags = _this$props2.tags,
701
- widgets = _this$props2.widgets,
702
- variables = _this$props2.variables;
703
- var _this$state3 = this.state,
704
- open = _this$state3.open,
705
- tabIndex = _this$state3.tabIndex,
706
- conditionIndex = _this$state3.conditionIndex,
707
- menuIndex = _this$state3.menuIndex,
708
- menuAnchorEl = _this$state3.menuAnchorEl,
709
- advanced = _this$state3.advanced;
710
- var currentCondition = null;
711
-
712
- if (conditionIndex !== null) {
713
- currentCondition = tabIndex === 0 ? value.styleConditions[conditionIndex] : value.contentConditions[conditionIndex];
714
- }
715
-
716
- var totalConditions = value.styleConditions.length + value.contentConditions.length;
717
- var nestItems = [];
718
-
719
- if (tabIndex === 0) {
720
- value.styleConditions.forEach((condition, index) => {
721
- nestItems.push(_objectSpread(_objectSpread({}, condition), {}, {
722
- index: index,
723
- id: String(index)
724
- }));
725
- });
726
- } else {
727
- value.contentConditions.forEach((condition, index) => {
728
- nestItems.push(_objectSpread(_objectSpread({}, condition), {}, {
729
- index: index,
730
- id: String(index)
731
- }));
732
- });
733
- }
734
-
735
- return /*#__PURE__*/_react.default.createElement(_Grid.default, {
736
- xs: 6,
737
- item: true
738
- }, /*#__PURE__*/_react.default.createElement(_Button.default, {
739
- variant: "contained",
740
- color: "secondary",
741
- size: "large",
742
- style: {
743
- width: '100%'
744
- },
745
- onClick: () => this.setState({
746
- open: true
747
- })
748
- }, /*#__PURE__*/_react.default.createElement(_CallSplit.default, {
749
- style: {
750
- marginRight: 10
751
- }
752
- }), "".concat(intl.formatMessage({
753
- id: '__conditions'
754
- })).concat(totalConditions > 0 ? " (".concat(totalConditions, ")") : '')), open && /*#__PURE__*/_react.default.createElement(_Dialog.default, {
755
- maxWidth: "xl",
756
- onClose: () => this.setState({
757
- open: false,
758
- conditionIndex: null,
759
- advanced: false
760
- }),
761
- fullWidth: true,
762
- open: true,
763
- classes: {
764
- paper: classes.dialog
765
- }
766
- }, /*#__PURE__*/_react.default.createElement(_versacallCoreLibraryReact.CoreToolbar, {
767
- title: intl.formatMessage({
768
- id: '__conditions_editor'
769
- }),
770
- handleClose: () => this.setState({
771
- open: false,
772
- conditionIndex: null,
773
- advanced: false
774
- })
775
- }, /*#__PURE__*/_react.default.createElement(_Button.default, {
776
- variant: "outlined",
777
- color: "primary",
778
- onClick: () => this.addCondition(),
779
- style: {
780
- marginRight: 10
781
- }
782
- }, /*#__PURE__*/_react.default.createElement(_Add.default, {
783
- className: classes.icon
784
- }), /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
785
- id: "__add_condition"
786
- })), /*#__PURE__*/_react.default.createElement(_Tabs.default, {
787
- value: tabIndex,
788
- onChange: (event, index) => this.setState({
789
- tabIndex: index,
790
- conditionIndex: null,
791
- advanced: false
792
- }),
793
- centered: true
794
- }, /*#__PURE__*/_react.default.createElement(_Tab.default, {
795
- id: "style",
796
- label: "".concat(intl.formatMessage({
797
- id: '__style'
798
- }), " (").concat(value.styleConditions.length, ")"),
799
- style: tabStyle(tabIndex === 0)
800
- }), /*#__PURE__*/_react.default.createElement(_Tab.default, {
801
- id: "content",
802
- label: "".concat(intl.formatMessage({
803
- id: '__content'
804
- }), " (").concat(value.contentConditions.length, ")"),
805
- style: tabStyle(tabIndex === 1)
806
- }))), /*#__PURE__*/_react.default.createElement("div", {
807
- style: style.root
808
- }, /*#__PURE__*/_react.default.createElement(_Grid.default, {
809
- spacing: 2,
810
- style: style.fullHeight,
811
- container: true
812
- }, /*#__PURE__*/_react.default.createElement(_Grid.default, {
813
- xs: 7,
814
- item: true
815
- }, /*#__PURE__*/_react.default.createElement("div", {
816
- style: _objectSpread(_objectSpread({}, style.paper), style.fullHeight)
817
- }, /*#__PURE__*/_react.default.createElement("div", {
818
- style: _objectSpread(_objectSpread({}, style.block), style.scrollHolder)
819
- }, /*#__PURE__*/_react.default.createElement("div", {
820
- style: style.scroll,
821
- className: _versacallCoreLibraryReact.ScrollbarStyles.scroll
822
- }, /*#__PURE__*/_react.default.createElement(_reactBeautifulDnd.DragDropContext, {
823
- onDragEnd: obj => this.onDragEnd(obj)
824
- }, /*#__PURE__*/_react.default.createElement(_reactBeautifulDnd.Droppable, {
825
- droppableId: "conditions"
826
- }, (provided, snapshot) => /*#__PURE__*/_react.default.createElement("div", _extends({}, provided.droppableProps, {
827
- ref: provided.innerRef,
828
- style: getListStyle(snapshot.isDraggingOver)
829
- }), nestItems.map((item, index) => /*#__PURE__*/_react.default.createElement(_reactBeautifulDnd.Draggable, {
830
- key: item.id,
831
- draggableId: item.id,
832
- index: index
833
- }, (dragProvided, dragSnapshot) => /*#__PURE__*/_react.default.createElement("div", _extends({
834
- ref: dragProvided.innerRef
835
- }, dragProvided.draggableProps, {
836
- style: getItemStyle(dragSnapshot.isDragging, dragProvided.draggableProps.style)
837
- }), this.renderConditionCard({
838
- item: item,
839
- handler: /*#__PURE__*/_react.default.createElement("div", dragProvided.dragHandleProps, /*#__PURE__*/_react.default.createElement(_OpenWith.default, {
840
- className: classes.anchor
841
- }))
842
- })))), provided.placeholder))))))), /*#__PURE__*/_react.default.createElement(_Grid.default, {
843
- xs: 5,
844
- item: true
845
- }, /*#__PURE__*/_react.default.createElement("div", {
846
- style: _objectSpread(_objectSpread({}, style.paper), style.fullHeight)
847
- }, /*#__PURE__*/_react.default.createElement("div", {
848
- style: _objectSpread(_objectSpread({}, style.block), style.scrollHolder)
849
- }, currentCondition && /*#__PURE__*/_react.default.createElement(_Paper.default, {
850
- style: style.scroll,
851
- className: _versacallCoreLibraryReact.ScrollbarStyles.scroll
852
- }, /*#__PURE__*/_react.default.createElement("div", {
853
- style: {
854
- padding: 10
855
- }
856
- }, /*#__PURE__*/_react.default.createElement(_Grid.default, {
857
- spacing: 2,
858
- container: true
859
- }, /*#__PURE__*/_react.default.createElement(_Grid.default, {
860
- item: true,
861
- xs: 1,
862
- style: {
863
- paddingTop: 26,
864
- textAlign: 'center'
865
- }
866
- }, "IF"), !advanced && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Grid.default, {
867
- xs: 4,
868
- item: true
869
- }, /*#__PURE__*/_react.default.createElement(_versacallCoreLibraryReact.CoreTextField, {
870
- id: "name",
871
- options: variables,
872
- fullWidth: true,
873
- value: currentCondition.condition.split(/[ ,]+/)[0],
874
- updateValue: e => this.updateCondition({
875
- value: e,
876
- stringIndex: 0
877
- }),
878
- selectOption: e => this.updateCondition({
879
- value: "~".concat(e.name),
880
- stringIndex: 0
881
- })
882
- })), /*#__PURE__*/_react.default.createElement(_Grid.default, {
883
- xs: 2,
884
- item: true
885
- }, /*#__PURE__*/_react.default.createElement(_TextField.default, {
886
- variant: "outlined",
887
- SelectProps: {
888
- native: true
889
- },
890
- value: currentCondition.condition.split(/[ ,]+/)[1],
891
- onChange: e => this.updateCondition({
892
- value: e.target.value,
893
- stringIndex: 1
894
- }),
895
- fullWidth: true,
896
- select: true
897
- }, operatorOptions.map(operatorOption => /*#__PURE__*/_react.default.createElement("option", {
898
- key: operatorOption.value,
899
- value: operatorOption.value
900
- }, operatorOption.label)))), /*#__PURE__*/_react.default.createElement(_Grid.default, {
901
- xs: 3,
902
- item: true
903
- }, /*#__PURE__*/_react.default.createElement(_versacallCoreLibraryReact.CoreTextField, {
904
- id: "name",
905
- options: variables,
906
- fullWidth: true,
907
- value: currentCondition.condition.split(/[ ,]+/)[2],
908
- updateValue: e => this.updateCondition({
909
- value: e,
910
- stringIndex: 2
911
- }),
912
- selectOption: e => this.updateCondition({
913
- value: "~".concat(e.name),
914
- stringIndex: 2
915
- })
916
- }))), advanced && /*#__PURE__*/_react.default.createElement(_Grid.default, {
917
- xs: 9,
918
- item: true
919
- }, /*#__PURE__*/_react.default.createElement(_versacallCoreLibraryReact.CoreTextField, {
920
- id: "name",
921
- options: variables,
922
- label: intl.formatMessage({
923
- id: '__advanced'
924
- }),
925
- fullWidth: true,
926
- value: currentCondition.condition,
927
- updateValue: e => this.updateCondition({
928
- value: e
929
- }),
930
- selectOption: e => this.updateCondition({
931
- value: "~".concat(e.name)
932
- })
933
- })), /*#__PURE__*/_react.default.createElement(_Grid.default, {
934
- align: "center",
935
- xs: 2,
936
- item: true
937
- }, /*#__PURE__*/_react.default.createElement(_FormControlLabel.default, {
938
- label: /*#__PURE__*/_react.default.createElement("span", {
939
- style: {
940
- fontSize: 'smaller',
941
- color: 'rgba(0, 0, 0, 0.67)'
942
- }
943
- }, intl.formatMessage({
944
- id: '__advanced'
945
- })),
946
- labelPlacement: "top",
947
- control: /*#__PURE__*/_react.default.createElement(_Switch.default, {
948
- color: "primary",
949
- checked: advanced,
950
- onChange: e => this.setState({
951
- advanced: e.target.checked
952
- })
953
- })
954
- }))), tabIndex === 0 && currentCondition && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
955
- style: style.styleBox
956
- }, /*#__PURE__*/_react.default.createElement(_DashboardsCellStyle.default, {
957
- style: currentCondition.style,
958
- updateStyle: content => this.updateStyle(content)
959
- })), /*#__PURE__*/_react.default.createElement(_Grid.default, {
960
- spacing: 2,
961
- container: true
962
- }, /*#__PURE__*/_react.default.createElement(_DashboardsCellGlobalStyles.default, {
963
- styles: styles,
964
- value: currentCondition.styleIds,
965
- updateValue: content => this.updateStyleIds(content)
966
- }))), tabIndex === 1 && currentCondition && /*#__PURE__*/_react.default.createElement(_Grid.default, {
967
- spacing: 2,
968
- style: {
969
- marginTop: 8
970
- },
971
- container: true
972
- }, /*#__PURE__*/_react.default.createElement(_DashboardsCellContent.default, {
973
- images: images,
974
- tags: tags,
975
- variables: variables,
976
- widgets: widgets,
977
- value: currentCondition.content,
978
- updateValue: content => this.updateContent(content)
979
- }))))))))), /*#__PURE__*/_react.default.createElement(_Menu.default, {
980
- id: "condition-action-menu",
981
- open: Boolean(menuAnchorEl),
982
- anchorEl: menuAnchorEl,
983
- classes: {
984
- paper: classes.menuPaper,
985
- list: classes.menuList
986
- },
987
- keepMounted: true,
988
- disableAutoFocusItem: true,
989
- onClose: () => this.setState({
990
- menuIndex: null,
991
- menuAnchorEl: null
992
- })
993
- }, /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
994
- onClick: () => {
995
- this.deleteCondition(menuIndex);
996
- this.setState({
997
- menuIndex: null,
998
- menuAnchorEl: null
999
- });
1000
- }
1001
- }, /*#__PURE__*/_react.default.createElement(_Delete.default, {
1002
- className: classes.icon
1003
- }), /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
1004
- id: "__delete"
1005
- })), /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
1006
- onClick: () => {
1007
- this.duplicateCondition(menuIndex);
1008
- this.setState({
1009
- menuIndex: null,
1010
- menuAnchorEl: null
1011
- });
1012
- }
1013
- }, /*#__PURE__*/_react.default.createElement(_FileCopy.default, {
1014
- className: classes.icon
1015
- }), /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
1016
- id: "__duplicate"
1017
- })))));
1018
- }
1019
-
1020
- }
1021
-
1022
- DashboardsCellGlobalConditions.propTypes = {
1023
- classes: _propTypes.default.shape().isRequired,
1024
- intl: _propTypes.default.shape().isRequired,
1025
- value: _propTypes.default.shape().isRequired,
1026
- updateValue: _propTypes.default.func.isRequired,
1027
- images: _propTypes.default.arrayOf(_propTypes.default.shape()),
1028
- styles: _propTypes.default.arrayOf(_propTypes.default.shape()),
1029
- tags: _propTypes.default.shape(),
1030
- widgets: _propTypes.default.arrayOf(_propTypes.default.shape()),
1031
- variables: _propTypes.default.arrayOf(_propTypes.default.shape())
1032
- };
1033
- DashboardsCellGlobalConditions.defaultProps = {
1034
- images: [],
1035
- styles: [],
1036
- tags: null,
1037
- widgets: [],
1038
- variables: []
1039
- };
1040
-
1041
- var _default = (0, _reactIntl.injectIntl)((0, _styles.withStyles)(muiStyles)(DashboardsCellGlobalConditions));
1042
-
1043
- exports.default = _default;