versacall-dashboards-library-react 2.0.39 → 2.0.41
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/DashboardsCell/DashboardsCell.js +54 -104
- package/dist/components/DashboardsCell/index.js +2 -4
- package/dist/components/DashboardsCellContent/DashboardsCellContent.js +29 -62
- package/dist/components/DashboardsCellContent/index.js +2 -4
- package/dist/components/DashboardsCellFindAndReplace/DashboardsCellFindAndReplace.js +27 -57
- package/dist/components/DashboardsCellFindAndReplace/index.js +2 -4
- package/dist/components/DashboardsCellGlobalActions/DashboardsCellGlobalActions.js +151 -155
- package/dist/components/DashboardsCellGlobalActions/index.js +2 -4
- package/dist/components/DashboardsCellGlobalConditions/DashboardsCellGlobalConditions.js +463 -563
- package/dist/components/DashboardsCellGlobalConditions/DashboardsCellGlobalConditionsNestable.js +109 -199
- package/dist/components/DashboardsCellGlobalConditions/DashboardsCellGlobalConditionsOld.js +87 -173
- package/dist/components/DashboardsCellGlobalConditions/index.js +2 -4
- package/dist/components/DashboardsCellGlobalStyles/DashboardsCellGlobalStyles.js +28 -78
- package/dist/components/DashboardsCellGlobalStyles/index.js +2 -4
- package/dist/components/DashboardsCellMergeUnmerge/DashboardsCellMergeUnmerge.js +33 -65
- package/dist/components/DashboardsCellMergeUnmerge/index.js +2 -4
- package/dist/components/DashboardsCellPosition/DashboardsCellPosition.js +5 -11
- package/dist/components/DashboardsCellPosition/index.js +2 -4
- package/dist/components/DashboardsCellSize/DashboardsCellSize.js +7 -16
- package/dist/components/DashboardsCellSize/index.js +2 -4
- package/dist/components/DashboardsCellStyle/DashboardsCellStyle.js +5 -21
- package/dist/components/DashboardsCellStyle/index.js +2 -4
- package/dist/components/DashboardsCellStyleAlignItems/DashboardsCellStyleAlignItems.js +12 -28
- package/dist/components/DashboardsCellStyleAlignItems/index.js +2 -4
- package/dist/components/DashboardsCellStyleBackgroundColor/DashboardsCellStyleBackgroundColor.js +15 -52
- package/dist/components/DashboardsCellStyleBackgroundColor/index.js +2 -4
- package/dist/components/DashboardsCellStyleClear/DashboardsCellStyleClear.js +4 -12
- package/dist/components/DashboardsCellStyleClear/index.js +2 -4
- package/dist/components/DashboardsCellStyleColor/DashboardsCellStyleColor.js +15 -52
- package/dist/components/DashboardsCellStyleColor/index.js +2 -4
- package/dist/components/DashboardsCellStyleDisplay/DashboardsCellStyleDisplay.js +6 -15
- package/dist/components/DashboardsCellStyleDisplay/index.js +2 -4
- package/dist/components/DashboardsCellStyleFontFamily/DashboardsCellStyleFontFamily.js +6 -15
- package/dist/components/DashboardsCellStyleFontFamily/index.js +2 -4
- package/dist/components/DashboardsCellStyleFontSize/DashboardsCellStyleFontSize.js +8 -19
- package/dist/components/DashboardsCellStyleFontSize/index.js +2 -4
- package/dist/components/DashboardsCellStyleJustifyContent/DashboardsCellStyleJustifyContent.js +12 -28
- package/dist/components/DashboardsCellStyleJustifyContent/index.js +2 -4
- package/dist/components/DashboardsCellStyleObjectFit/DashboardsCellStyleObjectFit.js +6 -15
- package/dist/components/DashboardsCellStyleObjectFit/index.js +2 -4
- package/dist/components/DashboardsCellStylePadding/DashboardsCellStylePadding.js +7 -16
- package/dist/components/DashboardsCellStylePadding/index.js +2 -4
- package/dist/components/DashboardsCellStyleWeightStyleDecoration/DashboardsCellStyleWeightStyleDecoration.js +12 -28
- package/dist/components/DashboardsCellStyleWeightStyleDecoration/index.js +2 -4
- package/dist/components/DashboardsCopyAndPaste/DashboardsCopyAndPaste.js +19 -40
- package/dist/components/DashboardsCopyAndPaste/index.js +2 -4
- package/dist/components/DashboardsEditor/DashboardsEditor.js +34 -68
- package/dist/components/DashboardsEditor/index.js +2 -4
- package/dist/components/DashboardsGlobalStylesPicker/DashboardsGlobalStylesPicker.js +13 -25
- package/dist/components/DashboardsGlobalStylesPicker/index.js +2 -4
- package/dist/components/DashboardsGrid/DashboardsGrid.js +21 -33
- package/dist/components/DashboardsGrid/index.js +2 -4
- package/dist/components/DashboardsMainFreehand/DashboardsMainFreehand.js +65 -130
- package/dist/components/DashboardsMainFreehand/index.js +2 -4
- package/dist/components/DashboardsMainMessaging/DashboardsMainMessaging.js +86 -203
- package/dist/components/DashboardsMainMessaging/index.js +2 -4
- package/dist/components/DashboardsMainTable/DashboardsMainTable.js +94 -208
- package/dist/components/DashboardsMainTable/index.js +2 -4
- package/dist/components/DashboardsPreview/DashboardsPreview.js +18 -32
- package/dist/components/DashboardsPreview/index.js +2 -4
- package/dist/components/DashboardsRatio/DashboardsRatio.js +18 -64
- package/dist/components/DashboardsRatio/DashboardsRatioOld.js +12 -27
- package/dist/components/DashboardsRatio/index.js +2 -4
- package/dist/components/DashboardsStatusBar/DashboardsStatusBar.js +16 -30
- package/dist/components/DashboardsStatusBar/index.js +2 -4
- package/dist/components/DashboardsUndoRedo/DashboardsUndoRedo.js +13 -42
- package/dist/components/DashboardsUndoRedo/index.js +2 -4
- package/dist/components/DashboardsViewer/DashboardsViewer.js +12 -19
- package/dist/components/DashboardsViewer/index.js +2 -4
- package/dist/components/DashboardsWidthHeight/DashboardsWidthHeight.js +8 -18
- package/dist/components/DashboardsWidthHeight/index.js +2 -4
- package/dist/components/WidgetParameters/WidgetParameters.js +32 -74
- package/dist/components/WidgetParameters/index.js +2 -4
- package/dist/components/index.js +41 -77
- package/dist/constants/defaultFreehandCell.js +2 -3
- package/dist/constants/defaultFreehandDashboard.js +2 -3
- package/dist/constants/defaultMessagingDashboard.js +2 -3
- package/dist/constants/defaultStyle.js +2 -3
- package/dist/constants/defaultTableCell.js +2 -3
- package/dist/constants/defaultTableDashboard.js +2 -3
- package/dist/constants/index.js +7 -14
- package/dist/functions/addTranslations.js +7 -14
- package/dist/functions/calculateDashboardVariables.js +24 -48
- package/dist/functions/convertColorObject.js +0 -1
- package/dist/functions/convertColorString.js +2 -4
- package/dist/functions/convertPercentToInt.js +0 -1
- package/dist/functions/convertSecondsToElapsedTime.js +8 -13
- package/dist/functions/generateFreehandCell.js +3 -6
- package/dist/functions/generateFreehandDashboard.js +2 -6
- package/dist/functions/generateMessagingDashboard.js +1 -3
- package/dist/functions/generateSelected.js +1 -4
- package/dist/functions/generateTableCell.js +1 -3
- package/dist/functions/generateTableDashboard.js +7 -15
- package/dist/functions/index.js +15 -30
- package/dist/functions/mergeSelected.js +3 -5
- package/dist/functions/sortCells.js +0 -5
- package/dist/index.js +3 -9
- package/dist/translations/en.json +2 -1
- package/package.json +2 -2
|
@@ -4,39 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _versacallCoreLibraryReact = require("versacall-core-library-react");
|
|
11
|
-
|
|
12
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
10
|
var _reactIntl = require("react-intl");
|
|
15
|
-
|
|
16
11
|
var _functions = require("../../functions");
|
|
17
|
-
|
|
18
12
|
var _DashboardsStatusBar = _interopRequireDefault(require("../DashboardsStatusBar"));
|
|
19
|
-
|
|
20
13
|
var _DashboardsEditor = _interopRequireDefault(require("../DashboardsEditor"));
|
|
21
|
-
|
|
22
14
|
var _DashboardsViewer = _interopRequireDefault(require("../DashboardsViewer"));
|
|
23
|
-
|
|
24
15
|
var _DashboardsCell = _interopRequireDefault(require("../DashboardsCell"));
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
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; }
|
|
35
|
-
|
|
36
|
-
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; }
|
|
37
|
-
|
|
38
|
-
var namespace = 'DashboardsMainFreehand';
|
|
39
|
-
var style = {
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
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); }
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
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; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
22
|
+
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); }
|
|
23
|
+
const namespace = 'DashboardsMainFreehand';
|
|
24
|
+
const style = {
|
|
40
25
|
root: {
|
|
41
26
|
position: 'absolute',
|
|
42
27
|
width: '100%',
|
|
@@ -52,9 +37,8 @@ var style = {
|
|
|
52
37
|
position: 'relative'
|
|
53
38
|
}
|
|
54
39
|
};
|
|
55
|
-
|
|
56
40
|
function findDependencies(text) {
|
|
57
|
-
|
|
41
|
+
let dependencies = {
|
|
58
42
|
found: false,
|
|
59
43
|
list: []
|
|
60
44
|
};
|
|
@@ -65,23 +49,20 @@ function findDependencies(text) {
|
|
|
65
49
|
list: [...acc.list, '']
|
|
66
50
|
};
|
|
67
51
|
}
|
|
68
|
-
|
|
69
52
|
if (acc.found && /[A-Z0-9_]/.test(curr)) {
|
|
70
53
|
acc.list[acc.list.length - 1] = "".concat(acc.list[acc.list.length - 1]).concat(curr);
|
|
71
54
|
return acc;
|
|
72
55
|
}
|
|
73
|
-
|
|
74
56
|
acc.found = false;
|
|
75
57
|
return acc;
|
|
76
58
|
}, dependencies);
|
|
77
59
|
return dependencies.list;
|
|
78
60
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
61
|
+
function replaceText(text, variables) {
|
|
62
|
+
let calculated = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
63
|
+
let newText = String(text);
|
|
64
|
+
const dependencies = findDependencies(newText);
|
|
65
|
+
let missingDependencies = dependencies;
|
|
85
66
|
if (dependencies.length > 0) {
|
|
86
67
|
variables.filter(variable => dependencies.includes(variable.name)).forEach(variable => {
|
|
87
68
|
// newText = newText.replace(new RegExp(`~${variable.name}`), `${calculated && variable.calculated !== '' ? variable.calculated : variable.value}`);
|
|
@@ -89,13 +70,11 @@ function replaceText(text, variables, calculated = true) {
|
|
|
89
70
|
missingDependencies = missingDependencies.filter(missingDependency => missingDependency !== variable.name);
|
|
90
71
|
});
|
|
91
72
|
}
|
|
92
|
-
|
|
93
73
|
return {
|
|
94
74
|
text: newText,
|
|
95
75
|
missingDependencies: missingDependencies.length
|
|
96
76
|
};
|
|
97
77
|
}
|
|
98
|
-
|
|
99
78
|
class DashboardsMainFreehand extends _react.Component {
|
|
100
79
|
constructor() {
|
|
101
80
|
super();
|
|
@@ -109,82 +88,68 @@ class DashboardsMainFreehand extends _react.Component {
|
|
|
109
88
|
newCellIndex: 1
|
|
110
89
|
};
|
|
111
90
|
}
|
|
112
|
-
|
|
113
91
|
componentDidMount() {
|
|
114
92
|
this.updateWindowInnerDimensionsBinded = this.updateWindowInnerDimensions.bind(this);
|
|
115
93
|
window.addEventListener('resize', this.updateWindowInnerDimensionsBinded);
|
|
116
94
|
this.updateWindowInnerDimensionsBinded();
|
|
117
95
|
}
|
|
118
|
-
|
|
119
96
|
componentDidUpdate(prevProps) {
|
|
120
97
|
if (prevProps.freehandDashboard.ratio.stretch !== this.props.freehandDashboard.ratio.stretch || prevProps.freehandDashboard.ratio.width !== this.props.freehandDashboard.ratio.width || prevProps.freehandDashboard.ratio.height !== this.props.freehandDashboard.ratio.height) {
|
|
121
98
|
this.updateViewDimensionsToState();
|
|
122
99
|
}
|
|
123
100
|
}
|
|
124
|
-
|
|
125
101
|
componentWillUnmount() {
|
|
126
102
|
window.removeEventListener('resize', this.updateWindowInnerDimensionsBinded);
|
|
127
103
|
}
|
|
128
|
-
|
|
129
104
|
updateWindowInnerDimensions() {
|
|
130
105
|
this.setState(prevState => prevState.windowInnerWidth !== window.innerWidth || prevState.windowInnerHeight !== window.innerHeight ? {
|
|
131
106
|
windowInnerWidth: window.innerWidth,
|
|
132
107
|
windowInnerHeight: window.innerHeight
|
|
133
108
|
} : null);
|
|
134
109
|
}
|
|
135
|
-
|
|
136
110
|
updateElementDimensions(element) {
|
|
137
111
|
if (element) {
|
|
138
112
|
this.setState(prevState => {
|
|
139
|
-
|
|
140
|
-
|
|
113
|
+
const size = element.getBoundingClientRect();
|
|
141
114
|
if (prevState.previewWidth !== Math.floor(size.width) || prevState.previewHeight !== Math.floor(size.height)) {
|
|
142
|
-
|
|
143
|
-
|
|
115
|
+
const previewWidth = Math.floor(size.width);
|
|
116
|
+
const previewHeight = Math.floor(size.height);
|
|
144
117
|
return _objectSpread({
|
|
145
118
|
previewWidth: previewWidth,
|
|
146
119
|
previewHeight: previewHeight
|
|
147
120
|
}, this.updateViewDimensions(previewWidth, previewHeight));
|
|
148
121
|
}
|
|
149
|
-
|
|
150
122
|
return null;
|
|
151
123
|
});
|
|
152
124
|
}
|
|
153
125
|
}
|
|
154
|
-
|
|
155
126
|
updateViewDimensions(previewWidth, previewHeight) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
127
|
+
let viewWidth = previewWidth;
|
|
128
|
+
let viewHeight = 0;
|
|
129
|
+
const allowedHeight = previewHeight;
|
|
160
130
|
if (this.props.freehandDashboard.ratio.stretch) {
|
|
161
131
|
viewWidth = previewWidth;
|
|
162
132
|
viewHeight = previewHeight;
|
|
163
133
|
} else {
|
|
164
134
|
viewHeight = Math.floor(viewWidth / this.props.freehandDashboard.ratio.width * this.props.freehandDashboard.ratio.height);
|
|
165
|
-
|
|
166
135
|
if (viewHeight > allowedHeight) {
|
|
167
136
|
viewHeight = allowedHeight;
|
|
168
137
|
viewWidth = Math.floor(viewHeight / this.props.freehandDashboard.ratio.height * this.props.freehandDashboard.ratio.width);
|
|
169
138
|
}
|
|
170
139
|
}
|
|
171
|
-
|
|
172
140
|
return {
|
|
173
141
|
viewWidth: viewWidth,
|
|
174
142
|
viewHeight: viewHeight
|
|
175
143
|
};
|
|
176
144
|
}
|
|
177
|
-
|
|
178
145
|
updateViewDimensionsToState() {
|
|
179
146
|
this.setState(prevState => _objectSpread({}, this.updateViewDimensions(prevState.previewWidth, prevState.previewHeight)));
|
|
180
147
|
}
|
|
181
|
-
|
|
182
148
|
updateFreehandDashboard(values) {
|
|
183
149
|
if (this.props.updateFreehandDashboard) {
|
|
184
150
|
this.props.updateFreehandDashboard(values);
|
|
185
151
|
}
|
|
186
152
|
}
|
|
187
|
-
|
|
188
153
|
updateSelected(index) {
|
|
189
154
|
if (this.props.updateSelected) {
|
|
190
155
|
this.props.updateSelected({
|
|
@@ -194,10 +159,11 @@ class DashboardsMainFreehand extends _react.Component {
|
|
|
194
159
|
});
|
|
195
160
|
}
|
|
196
161
|
}
|
|
197
|
-
|
|
198
162
|
addCell() {
|
|
199
|
-
|
|
200
|
-
|
|
163
|
+
const {
|
|
164
|
+
newCellIndex
|
|
165
|
+
} = this.state;
|
|
166
|
+
const cells = JSON.parse(JSON.stringify(this.props.freehandDashboard.cells));
|
|
201
167
|
cells.push((0, _functions.generateFreehandCell)(10, 10, 10, 50, 50, "New Cell ".concat(newCellIndex)));
|
|
202
168
|
this.updateFreehandDashboard({
|
|
203
169
|
cells: cells
|
|
@@ -207,96 +173,79 @@ class DashboardsMainFreehand extends _react.Component {
|
|
|
207
173
|
newCellIndex: newCellIndex + 1
|
|
208
174
|
});
|
|
209
175
|
}
|
|
210
|
-
|
|
211
176
|
moveCells(direction) {
|
|
212
|
-
|
|
213
|
-
|
|
177
|
+
const cells = JSON.parse(JSON.stringify(this.props.freehandDashboard.cells));
|
|
214
178
|
switch (direction) {
|
|
215
179
|
case 'left':
|
|
216
180
|
cells[this.props.selected.cells[0]].x--;
|
|
217
181
|
break;
|
|
218
|
-
|
|
219
182
|
case 'right':
|
|
220
183
|
cells[this.props.selected.cells[0]].x++;
|
|
221
184
|
break;
|
|
222
|
-
|
|
223
185
|
case 'up':
|
|
224
186
|
cells[this.props.selected.cells[0]].y--;
|
|
225
187
|
break;
|
|
226
|
-
|
|
227
188
|
case 'down':
|
|
228
189
|
cells[this.props.selected.cells[0]].y++;
|
|
229
190
|
break;
|
|
230
|
-
|
|
231
191
|
default:
|
|
232
192
|
}
|
|
233
|
-
|
|
234
193
|
this.updateFreehandDashboard({
|
|
235
194
|
cells: cells
|
|
236
195
|
});
|
|
237
196
|
}
|
|
238
|
-
|
|
239
197
|
render() {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
198
|
+
const methodName = 'render()';
|
|
199
|
+
const {
|
|
200
|
+
core,
|
|
201
|
+
intl,
|
|
202
|
+
styles,
|
|
203
|
+
widgets,
|
|
204
|
+
viewers,
|
|
205
|
+
variables,
|
|
206
|
+
showEditor,
|
|
207
|
+
viewColor,
|
|
208
|
+
previewColor,
|
|
209
|
+
freehandDashboard,
|
|
210
|
+
selected
|
|
211
|
+
} = this.props;
|
|
212
|
+
const {
|
|
213
|
+
viewWidth,
|
|
214
|
+
viewHeight,
|
|
215
|
+
previewHeight
|
|
216
|
+
} = this.state;
|
|
217
|
+
const freehandDashboardProcessed = JSON.parse(JSON.stringify(freehandDashboard));
|
|
218
|
+
const variablesProcessed = (0, _functions.calculateDashboardVariables)(variables, freehandDashboardProcessed.variables);
|
|
259
219
|
freehandDashboardProcessed.cells = freehandDashboardProcessed.cells.map(cell => {
|
|
260
|
-
|
|
220
|
+
const newCell = JSON.parse(JSON.stringify(cell));
|
|
261
221
|
newCell.custom = {
|
|
262
222
|
viewWidth: viewWidth,
|
|
263
223
|
viewHeight: viewHeight,
|
|
264
224
|
style: {}
|
|
265
225
|
};
|
|
266
|
-
|
|
267
226
|
if (styles.length > 0 && newCell.styleIds.length > 0) {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
227
|
+
for (let i = 0; i < newCell.styleIds.length; i++) {
|
|
228
|
+
const findStyle = styles.find(searchStyle => searchStyle.id === newCell.styleIds[i]);
|
|
271
229
|
if (findStyle) {
|
|
272
230
|
newCell.custom.style = _objectSpread(_objectSpread({}, newCell.custom.style), findStyle.options);
|
|
273
231
|
}
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
for (var i = 0; i < newCell.styleIds.length; i++) {
|
|
277
|
-
_loop(i);
|
|
278
232
|
}
|
|
279
233
|
}
|
|
280
|
-
|
|
281
234
|
newCell.custom.style = _objectSpread(_objectSpread({}, newCell.custom.style), newCell.style);
|
|
282
|
-
|
|
283
235
|
if (!showEditor) {
|
|
284
|
-
for (
|
|
285
|
-
|
|
286
|
-
|
|
236
|
+
for (let i = 0; i < newCell.styleConditions.length; i++) {
|
|
237
|
+
const replacedText = replaceText(newCell.styleConditions[i].condition, variablesProcessed);
|
|
287
238
|
if (replacedText.missingDependencies === 0) {
|
|
288
239
|
try {
|
|
289
240
|
// eslint-disable-next-line no-eval
|
|
290
241
|
if (window.eval(replacedText.text)) {
|
|
291
|
-
newCell.styleConditions[
|
|
292
|
-
|
|
293
|
-
|
|
242
|
+
newCell.styleConditions[i].styleIds.forEach(styleId => {
|
|
243
|
+
const findStyle = styles.find(aStyle => aStyle.id === styleId);
|
|
294
244
|
if (findStyle) {
|
|
295
245
|
newCell.custom.style = _objectSpread(_objectSpread({}, newCell.custom.style), findStyle.options);
|
|
296
246
|
}
|
|
297
247
|
});
|
|
298
|
-
|
|
299
|
-
newCell.custom.style = _objectSpread(_objectSpread({}, newCell.custom.style), newCell.styleConditions[_i].style);
|
|
248
|
+
newCell.custom.style = _objectSpread(_objectSpread({}, newCell.custom.style), newCell.styleConditions[i].style);
|
|
300
249
|
break;
|
|
301
250
|
}
|
|
302
251
|
} catch (error) {
|
|
@@ -304,36 +253,30 @@ class DashboardsMainFreehand extends _react.Component {
|
|
|
304
253
|
}
|
|
305
254
|
}
|
|
306
255
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
if (_replacedText.missingDependencies === 0) {
|
|
256
|
+
for (let i = 0; i < newCell.contentConditions.length; i++) {
|
|
257
|
+
const replacedText = replaceText(newCell.contentConditions[i].condition, variablesProcessed);
|
|
258
|
+
if (replacedText.missingDependencies === 0) {
|
|
312
259
|
try {
|
|
313
260
|
// eslint-disable-next-line no-eval
|
|
314
|
-
if (window.eval(
|
|
315
|
-
newCell.content = JSON.parse(JSON.stringify(newCell.contentConditions[
|
|
261
|
+
if (window.eval(replacedText.text)) {
|
|
262
|
+
newCell.content = JSON.parse(JSON.stringify(newCell.contentConditions[i].content));
|
|
316
263
|
break;
|
|
317
264
|
}
|
|
318
265
|
} catch (error) {
|
|
319
|
-
core.log('error', namespace, methodName, "Error window.eval(".concat(
|
|
266
|
+
core.log('error', namespace, methodName, "Error window.eval(".concat(replacedText.text, ")"));
|
|
320
267
|
}
|
|
321
268
|
}
|
|
322
269
|
}
|
|
323
|
-
|
|
324
270
|
if (newCell.content.type === 'text') {
|
|
325
271
|
newCell.content.text = replaceText(newCell.content.text, variablesProcessed, false).text;
|
|
326
272
|
}
|
|
327
|
-
|
|
328
273
|
if (newCell.content.type === 'widget') {
|
|
329
274
|
newCell.content.properties = JSON.parse(replaceText(JSON.stringify(newCell.content.properties), variablesProcessed).text);
|
|
330
275
|
}
|
|
331
|
-
|
|
332
276
|
if (newCell.content.type === 'url') {
|
|
333
277
|
newCell.content.url = replaceText(newCell.content.url, variablesProcessed, false).text;
|
|
334
278
|
}
|
|
335
279
|
}
|
|
336
|
-
|
|
337
280
|
return newCell;
|
|
338
281
|
});
|
|
339
282
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -370,14 +313,12 @@ class DashboardsMainFreehand extends _react.Component {
|
|
|
370
313
|
justifyContent: freehandDashboard.ratio.horizontalAlignment,
|
|
371
314
|
showEditor: showEditor
|
|
372
315
|
}, /*#__PURE__*/_react.default.createElement("div", null, freehandDashboardProcessed.cells.map((cell, index) => {
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
316
|
+
const isSelected = showEditor && selected.cells.includes("".concat(index));
|
|
317
|
+
const widget = cell.content.type === 'widget' ? widgets.find(aWidget => aWidget.id === cell.content.id) : null;
|
|
318
|
+
let viewer = null;
|
|
377
319
|
if (widget && widget.plugInType !== 'component') {
|
|
378
320
|
viewer = viewers.find(aViewer => aViewer.metadata.plugInType === widget.plugInType);
|
|
379
321
|
}
|
|
380
|
-
|
|
381
322
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
382
323
|
role: "button",
|
|
383
324
|
tabIndex: index,
|
|
@@ -392,7 +333,6 @@ class DashboardsMainFreehand extends _react.Component {
|
|
|
392
333
|
},
|
|
393
334
|
onClick: event => {
|
|
394
335
|
this.updateSelected(["".concat(index)]);
|
|
395
|
-
|
|
396
336
|
if (!showEditor && cell.actionType && this.props.onCellAction) {
|
|
397
337
|
event.stopPropagation();
|
|
398
338
|
this.props.onCellAction(event, index, cell);
|
|
@@ -424,9 +364,7 @@ class DashboardsMainFreehand extends _react.Component {
|
|
|
424
364
|
height: Math.floor(previewHeight * 0.05)
|
|
425
365
|
})) : null));
|
|
426
366
|
}
|
|
427
|
-
|
|
428
367
|
}
|
|
429
|
-
|
|
430
368
|
DashboardsMainFreehand.propTypes = {
|
|
431
369
|
intl: _propTypes.default.shape().isRequired,
|
|
432
370
|
showEditor: _propTypes.default.bool,
|
|
@@ -460,7 +398,4 @@ DashboardsMainFreehand.defaultProps = {
|
|
|
460
398
|
},
|
|
461
399
|
onCellAction: null
|
|
462
400
|
};
|
|
463
|
-
|
|
464
|
-
var _default = (0, _reactIntl.injectIntl)((0, _versacallCoreLibraryReact.withCore)(DashboardsMainFreehand));
|
|
465
|
-
|
|
466
|
-
exports.default = _default;
|
|
401
|
+
var _default = exports.default = (0, _reactIntl.injectIntl)((0, _versacallCoreLibraryReact.withCore)(DashboardsMainFreehand));
|
|
@@ -5,11 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
Object.defineProperty(exports, "default", {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: function
|
|
8
|
+
get: function () {
|
|
9
9
|
return _DashboardsMainFreehand.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
|
|
13
12
|
var _DashboardsMainFreehand = _interopRequireDefault(require("./DashboardsMainFreehand"));
|
|
14
|
-
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|