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,51 +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 _functions = require("../../functions");
|
|
15
|
-
|
|
16
11
|
var _DashboardsStatusBar = _interopRequireDefault(require("../DashboardsStatusBar"));
|
|
17
|
-
|
|
18
12
|
var _DashboardsEditor = _interopRequireDefault(require("../DashboardsEditor"));
|
|
19
|
-
|
|
20
13
|
var _DashboardsViewer = _interopRequireDefault(require("../DashboardsViewer"));
|
|
21
|
-
|
|
22
14
|
var _DashboardsCell = _interopRequireDefault(require("../DashboardsCell"));
|
|
23
|
-
|
|
24
15
|
var _DashboardsGrid = _interopRequireDefault(require("../DashboardsGrid"));
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
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."); }
|
|
35
|
-
|
|
36
|
-
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); }
|
|
37
|
-
|
|
38
|
-
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; }
|
|
39
|
-
|
|
40
|
-
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; }
|
|
41
|
-
|
|
42
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
43
|
-
|
|
44
|
-
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; }
|
|
45
|
-
|
|
46
|
-
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; }
|
|
47
|
-
|
|
48
|
-
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; }
|
|
49
|
-
|
|
50
|
-
var namespace = 'DashboardsMainTable';
|
|
51
|
-
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 = 'DashboardsMainTable';
|
|
24
|
+
const style = {
|
|
52
25
|
root: {
|
|
53
26
|
position: 'absolute',
|
|
54
27
|
width: '100%',
|
|
@@ -64,9 +37,8 @@ var style = {
|
|
|
64
37
|
position: 'relative'
|
|
65
38
|
}
|
|
66
39
|
};
|
|
67
|
-
|
|
68
40
|
function findDependencies(text) {
|
|
69
|
-
|
|
41
|
+
let dependencies = {
|
|
70
42
|
found: false,
|
|
71
43
|
list: []
|
|
72
44
|
};
|
|
@@ -77,23 +49,20 @@ function findDependencies(text) {
|
|
|
77
49
|
list: [...acc.list, '']
|
|
78
50
|
};
|
|
79
51
|
}
|
|
80
|
-
|
|
81
52
|
if (acc.found && /[A-Z0-9_]/.test(curr)) {
|
|
82
53
|
acc.list[acc.list.length - 1] = "".concat(acc.list[acc.list.length - 1]).concat(curr);
|
|
83
54
|
return acc;
|
|
84
55
|
}
|
|
85
|
-
|
|
86
56
|
acc.found = false;
|
|
87
57
|
return acc;
|
|
88
58
|
}, dependencies);
|
|
89
59
|
return dependencies.list;
|
|
90
60
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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;
|
|
97
66
|
if (dependencies.length > 0) {
|
|
98
67
|
variables.filter(variable => dependencies.includes(variable.name)).forEach(variable => {
|
|
99
68
|
// newText = newText.replace(new RegExp(`~${variable.name}`), `${calculated && variable.calculated !== '' ? variable.calculated : variable.value}`);
|
|
@@ -101,13 +70,11 @@ function replaceText(text, variables, calculated = true) {
|
|
|
101
70
|
missingDependencies = missingDependencies.filter(missingDependency => missingDependency !== variable.name);
|
|
102
71
|
});
|
|
103
72
|
}
|
|
104
|
-
|
|
105
73
|
return {
|
|
106
74
|
text: newText,
|
|
107
75
|
missingDependencies: missingDependencies.length
|
|
108
76
|
};
|
|
109
77
|
}
|
|
110
|
-
|
|
111
78
|
class DashboardsMainTable extends _react.Component {
|
|
112
79
|
constructor() {
|
|
113
80
|
super();
|
|
@@ -122,128 +89,104 @@ class DashboardsMainTable extends _react.Component {
|
|
|
122
89
|
gridTemplateColumns: 'auto'
|
|
123
90
|
};
|
|
124
91
|
}
|
|
125
|
-
|
|
126
92
|
componentDidMount() {
|
|
127
93
|
this.updateWindowInnerDimensionsBinded = this.updateWindowInnerDimensions.bind(this);
|
|
128
94
|
window.addEventListener('resize', this.updateWindowInnerDimensionsBinded);
|
|
129
95
|
this.updateWindowInnerDimensionsBinded();
|
|
130
96
|
this.updateRowsAndColumns();
|
|
131
97
|
}
|
|
132
|
-
|
|
133
98
|
componentDidUpdate(prevProps) {
|
|
134
99
|
if (prevProps.tableDashboard.rowProperties !== this.props.tableDashboard.rowProperties || prevProps.tableDashboard.columnProperties !== this.props.tableDashboard.columnProperties) {
|
|
135
100
|
this.updateRowsAndColumns();
|
|
136
101
|
}
|
|
137
|
-
|
|
138
102
|
if (prevProps.tableDashboard.ratio.stretch !== this.props.tableDashboard.ratio.stretch || prevProps.tableDashboard.ratio.width !== this.props.tableDashboard.ratio.width || prevProps.tableDashboard.ratio.height !== this.props.tableDashboard.ratio.height) {
|
|
139
103
|
this.updateViewDimensionsToState();
|
|
140
104
|
}
|
|
141
105
|
}
|
|
142
|
-
|
|
143
106
|
componentWillUnmount() {
|
|
144
107
|
window.removeEventListener('resize', this.updateWindowInnerDimensionsBinded);
|
|
145
108
|
}
|
|
146
|
-
|
|
147
109
|
updateWindowInnerDimensions() {
|
|
148
110
|
this.setState(prevState => prevState.windowInnerWidth !== window.innerWidth || prevState.windowInnerHeight !== window.innerHeight ? {
|
|
149
111
|
windowInnerWidth: window.innerWidth,
|
|
150
112
|
windowInnerHeight: window.innerHeight
|
|
151
113
|
} : null);
|
|
152
114
|
}
|
|
153
|
-
|
|
154
115
|
updateElementDimensions(element) {
|
|
155
116
|
if (element) {
|
|
156
117
|
this.setState(prevState => {
|
|
157
|
-
|
|
158
|
-
|
|
118
|
+
const size = element.getBoundingClientRect();
|
|
159
119
|
if (prevState.previewWidth !== Math.floor(size.width) || prevState.previewHeight !== Math.floor(size.height)) {
|
|
160
|
-
|
|
161
|
-
|
|
120
|
+
const previewWidth = Math.floor(size.width);
|
|
121
|
+
const previewHeight = Math.floor(size.height);
|
|
162
122
|
return _objectSpread({
|
|
163
123
|
previewWidth: previewWidth,
|
|
164
124
|
previewHeight: previewHeight
|
|
165
125
|
}, this.updateViewDimensions(previewWidth, previewHeight));
|
|
166
126
|
}
|
|
167
|
-
|
|
168
127
|
return null;
|
|
169
128
|
});
|
|
170
129
|
}
|
|
171
130
|
}
|
|
172
|
-
|
|
173
131
|
updateViewDimensions(previewWidth, previewHeight) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
132
|
+
let viewWidth = previewWidth;
|
|
133
|
+
let viewHeight = 0;
|
|
134
|
+
const allowedHeight = previewHeight;
|
|
178
135
|
if (this.props.tableDashboard.ratio.stretch) {
|
|
179
136
|
viewWidth = previewWidth;
|
|
180
137
|
viewHeight = previewHeight;
|
|
181
138
|
} else {
|
|
182
139
|
viewHeight = Math.floor(viewWidth / this.props.tableDashboard.ratio.width * this.props.tableDashboard.ratio.height);
|
|
183
|
-
|
|
184
140
|
if (viewHeight > allowedHeight) {
|
|
185
141
|
viewHeight = allowedHeight;
|
|
186
142
|
viewWidth = Math.floor(viewHeight / this.props.tableDashboard.ratio.height * this.props.tableDashboard.ratio.width);
|
|
187
143
|
}
|
|
188
144
|
}
|
|
189
|
-
|
|
190
145
|
return {
|
|
191
146
|
viewWidth: viewWidth,
|
|
192
147
|
viewHeight: viewHeight
|
|
193
148
|
};
|
|
194
149
|
}
|
|
195
|
-
|
|
196
150
|
updateViewDimensionsToState() {
|
|
197
151
|
this.setState(prevState => _objectSpread({}, this.updateViewDimensions(prevState.previewWidth, prevState.previewHeight)));
|
|
198
152
|
}
|
|
199
|
-
|
|
200
153
|
updateRowsAndColumns() {
|
|
201
154
|
this.setState({
|
|
202
155
|
gridTemplateRows: this.props.tableDashboard.rowProperties.reduce((acc, row) => "".concat(acc, " ").concat(row.height, "fr"), ''),
|
|
203
156
|
gridTemplateColumns: this.props.tableDashboard.columnProperties.reduce((acc, column) => "".concat(acc, " ").concat(column.width, "fr"), '')
|
|
204
157
|
});
|
|
205
158
|
}
|
|
206
|
-
|
|
207
159
|
updateTableDashboard(values) {
|
|
208
160
|
if (this.props.updateTableDashboard) {
|
|
209
161
|
this.props.updateTableDashboard(values);
|
|
210
162
|
}
|
|
211
163
|
}
|
|
212
|
-
|
|
213
164
|
updateSelected(selected) {
|
|
214
165
|
if (this.props.updateSelected) {
|
|
215
166
|
this.props.updateSelected(selected);
|
|
216
167
|
}
|
|
217
168
|
}
|
|
218
|
-
|
|
219
169
|
addRowOrColumn(type) {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
170
|
+
const cells = JSON.parse(JSON.stringify(this.props.tableDashboard.cells));
|
|
171
|
+
const rowProperties = JSON.parse(JSON.stringify(this.props.tableDashboard.rowProperties));
|
|
172
|
+
const columnProperties = JSON.parse(JSON.stringify(this.props.tableDashboard.columnProperties));
|
|
224
173
|
switch (type) {
|
|
225
174
|
case 'row':
|
|
226
175
|
rowProperties.push({
|
|
227
176
|
height: '100'
|
|
228
177
|
});
|
|
229
|
-
|
|
230
|
-
for (var i = 0; i < columnProperties.length; i++) {
|
|
178
|
+
for (let i = 0; i < columnProperties.length; i++) {
|
|
231
179
|
cells.push((0, _functions.generateTableCell)(rowProperties.length, i + 1, 1, 1));
|
|
232
180
|
}
|
|
233
|
-
|
|
234
181
|
break;
|
|
235
|
-
|
|
236
182
|
default:
|
|
237
183
|
columnProperties.push({
|
|
238
184
|
width: '100'
|
|
239
185
|
});
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
cells.push((0, _functions.generateTableCell)(_i + 1, columnProperties.length, 1, 1));
|
|
186
|
+
for (let i = 0; i < rowProperties.length; i++) {
|
|
187
|
+
cells.push((0, _functions.generateTableCell)(i + 1, columnProperties.length, 1, 1));
|
|
243
188
|
}
|
|
244
|
-
|
|
245
189
|
}
|
|
246
|
-
|
|
247
190
|
cells.sort(_functions.sortCells);
|
|
248
191
|
this.updateTableDashboard({
|
|
249
192
|
cells: cells,
|
|
@@ -256,21 +199,15 @@ class DashboardsMainTable extends _react.Component {
|
|
|
256
199
|
cells: []
|
|
257
200
|
});
|
|
258
201
|
}
|
|
259
|
-
|
|
260
202
|
moveCells(direction) {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
203
|
+
const cells = JSON.parse(JSON.stringify(this.props.tableDashboard.cells));
|
|
204
|
+
const rowProperties = JSON.parse(JSON.stringify(this.props.tableDashboard.rowProperties));
|
|
205
|
+
const columnProperties = JSON.parse(JSON.stringify(this.props.tableDashboard.columnProperties));
|
|
206
|
+
const initialSelected = JSON.parse(JSON.stringify(this.props.selected));
|
|
207
|
+
const selected = JSON.parse(JSON.stringify(this.props.selected));
|
|
267
208
|
if (initialSelected.row > 0) {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
var _rowProperties$splice = rowProperties.splice(index, 1),
|
|
271
|
-
_rowProperties$splice2 = _slicedToArray(_rowProperties$splice, 1),
|
|
272
|
-
removedRowProperty = _rowProperties$splice2[0];
|
|
273
|
-
|
|
209
|
+
let index = initialSelected.row - 1;
|
|
210
|
+
const [removedRowProperty] = rowProperties.splice(index, 1);
|
|
274
211
|
switch (direction) {
|
|
275
212
|
case 'up':
|
|
276
213
|
if (index > 0) {
|
|
@@ -281,9 +218,7 @@ class DashboardsMainTable extends _react.Component {
|
|
|
281
218
|
selected.row--;
|
|
282
219
|
index--;
|
|
283
220
|
}
|
|
284
|
-
|
|
285
221
|
break;
|
|
286
|
-
|
|
287
222
|
case 'down':
|
|
288
223
|
if (index < rowProperties.length) {
|
|
289
224
|
selected.cells = selected.cells.map(cell => _objectSpread(_objectSpread({}, cell), {}, {
|
|
@@ -293,49 +228,37 @@ class DashboardsMainTable extends _react.Component {
|
|
|
293
228
|
selected.row++;
|
|
294
229
|
index++;
|
|
295
230
|
}
|
|
296
|
-
|
|
297
231
|
break;
|
|
298
|
-
|
|
299
232
|
default:
|
|
300
233
|
}
|
|
301
|
-
|
|
302
234
|
rowProperties.splice(index, 0, removedRowProperty);
|
|
303
235
|
} else if (initialSelected.column > 0) {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
var _columnProperties$spl = columnProperties.splice(_index, 1),
|
|
307
|
-
_columnProperties$spl2 = _slicedToArray(_columnProperties$spl, 1),
|
|
308
|
-
removedColumnProperty = _columnProperties$spl2[0];
|
|
309
|
-
|
|
236
|
+
let index = initialSelected.column - 1;
|
|
237
|
+
const [removedColumnProperty] = columnProperties.splice(index, 1);
|
|
310
238
|
switch (direction) {
|
|
311
239
|
case 'left':
|
|
312
|
-
if (
|
|
240
|
+
if (index > 0) {
|
|
313
241
|
selected.cells = selected.cells.map(cell => _objectSpread(_objectSpread({}, cell), {}, {
|
|
314
242
|
column: cell.column - 1,
|
|
315
243
|
index: cell.index - 1
|
|
316
244
|
}));
|
|
317
245
|
selected.column--;
|
|
318
|
-
|
|
246
|
+
index--;
|
|
319
247
|
}
|
|
320
|
-
|
|
321
248
|
break;
|
|
322
|
-
|
|
323
249
|
case 'right':
|
|
324
|
-
if (
|
|
250
|
+
if (index < columnProperties.length) {
|
|
325
251
|
selected.cells = selected.cells.map(cell => _objectSpread(_objectSpread({}, cell), {}, {
|
|
326
252
|
column: cell.column + 1,
|
|
327
253
|
index: cell.index + 1
|
|
328
254
|
}));
|
|
329
255
|
selected.column++;
|
|
330
|
-
|
|
256
|
+
index++;
|
|
331
257
|
}
|
|
332
|
-
|
|
333
258
|
break;
|
|
334
|
-
|
|
335
259
|
default:
|
|
336
260
|
}
|
|
337
|
-
|
|
338
|
-
columnProperties.splice(_index, 0, removedColumnProperty);
|
|
261
|
+
columnProperties.splice(index, 0, removedColumnProperty);
|
|
339
262
|
} else if (initialSelected.cells.length === 1) {
|
|
340
263
|
switch (direction) {
|
|
341
264
|
case 'up':
|
|
@@ -343,66 +266,51 @@ class DashboardsMainTable extends _react.Component {
|
|
|
343
266
|
selected.cells[0].row--;
|
|
344
267
|
selected.cells[0].index -= columnProperties.length;
|
|
345
268
|
}
|
|
346
|
-
|
|
347
269
|
break;
|
|
348
|
-
|
|
349
270
|
case 'down':
|
|
350
271
|
if (selected.cells[0].row < rowProperties.length) {
|
|
351
272
|
selected.cells[0].row++;
|
|
352
273
|
selected.cells[0].index += columnProperties.length;
|
|
353
274
|
}
|
|
354
|
-
|
|
355
275
|
break;
|
|
356
|
-
|
|
357
276
|
case 'left':
|
|
358
277
|
if (selected.cells[0].column - 1 > 0) {
|
|
359
278
|
selected.cells[0].column--;
|
|
360
279
|
selected.cells[0].index--;
|
|
361
280
|
}
|
|
362
|
-
|
|
363
281
|
break;
|
|
364
|
-
|
|
365
282
|
case 'right':
|
|
366
283
|
if (selected.cells[0].column < columnProperties.length) {
|
|
367
284
|
selected.cells[0].column++;
|
|
368
285
|
selected.cells[0].index++;
|
|
369
286
|
}
|
|
370
|
-
|
|
371
287
|
break;
|
|
372
|
-
|
|
373
288
|
default:
|
|
374
289
|
}
|
|
375
290
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
var currentCell = JSON.parse(JSON.stringify(cells[initialSelected.cells[i].index]));
|
|
381
|
-
var nextCell = JSON.parse(JSON.stringify(cells[selected.cells[i].index]));
|
|
382
|
-
|
|
291
|
+
let canMove = true;
|
|
292
|
+
for (let i = 0; i < selected.cells.length; i++) {
|
|
293
|
+
const currentCell = JSON.parse(JSON.stringify(cells[initialSelected.cells[i].index]));
|
|
294
|
+
const nextCell = JSON.parse(JSON.stringify(cells[selected.cells[i].index]));
|
|
383
295
|
if (currentCell.rowSpan !== 1 || currentCell.columnSpan !== 1 || nextCell.rowSpan !== 1 || nextCell.columnSpan !== 1) {
|
|
384
296
|
canMove = false;
|
|
385
297
|
break;
|
|
386
298
|
}
|
|
387
299
|
}
|
|
388
|
-
|
|
389
300
|
if (canMove) {
|
|
390
|
-
for (
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
cells[initialSelected.cells[_i2].index] = _nextCell;
|
|
400
|
-
cells[selected.cells[_i2].index] = _currentCell;
|
|
301
|
+
for (let i = 0; i < selected.cells.length; i++) {
|
|
302
|
+
const currentCell = JSON.parse(JSON.stringify(cells[initialSelected.cells[i].index]));
|
|
303
|
+
const nextCell = JSON.parse(JSON.stringify(cells[selected.cells[i].index]));
|
|
304
|
+
nextCell.row = currentCell.row;
|
|
305
|
+
nextCell.column = currentCell.column;
|
|
306
|
+
currentCell.row = selected.cells[i].row;
|
|
307
|
+
currentCell.column = selected.cells[i].column;
|
|
308
|
+
cells[initialSelected.cells[i].index] = nextCell;
|
|
309
|
+
cells[selected.cells[i].index] = currentCell;
|
|
401
310
|
}
|
|
402
311
|
} else {
|
|
403
312
|
return;
|
|
404
313
|
}
|
|
405
|
-
|
|
406
314
|
this.updateTableDashboard({
|
|
407
315
|
cells: cells,
|
|
408
316
|
rowProperties: rowProperties,
|
|
@@ -410,70 +318,60 @@ class DashboardsMainTable extends _react.Component {
|
|
|
410
318
|
});
|
|
411
319
|
this.updateSelected(selected);
|
|
412
320
|
}
|
|
413
|
-
|
|
414
321
|
render() {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
322
|
+
const methodName = 'render()';
|
|
323
|
+
const {
|
|
324
|
+
core,
|
|
325
|
+
styles,
|
|
326
|
+
widgets,
|
|
327
|
+
viewers,
|
|
328
|
+
gap,
|
|
329
|
+
variables,
|
|
330
|
+
showEditor,
|
|
331
|
+
viewColor,
|
|
332
|
+
previewColor,
|
|
333
|
+
tableDashboard,
|
|
334
|
+
selected
|
|
335
|
+
} = this.props;
|
|
336
|
+
const {
|
|
337
|
+
viewWidth,
|
|
338
|
+
viewHeight,
|
|
339
|
+
previewHeight,
|
|
340
|
+
gridTemplateRows,
|
|
341
|
+
gridTemplateColumns
|
|
342
|
+
} = this.state;
|
|
343
|
+
const tableDashboardProcessed = JSON.parse(JSON.stringify(tableDashboard));
|
|
344
|
+
const variablesProcessed = (0, _functions.calculateDashboardVariables)(variables, tableDashboardProcessed.variables);
|
|
436
345
|
tableDashboardProcessed.cells = tableDashboardProcessed.cells.filter(cell => !(cell.rowSpan === 0 || cell.columnSpan === 0)).map(cell => {
|
|
437
|
-
|
|
346
|
+
const newCell = JSON.parse(JSON.stringify(cell));
|
|
438
347
|
newCell.custom = {
|
|
439
348
|
viewWidth: viewWidth,
|
|
440
349
|
viewHeight: viewHeight,
|
|
441
350
|
style: {}
|
|
442
351
|
};
|
|
443
|
-
|
|
444
352
|
if (styles.length > 0 && newCell.styleIds.length > 0) {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
353
|
+
for (let i = 0; i < newCell.styleIds.length; i++) {
|
|
354
|
+
const findStyle = styles.find(searchStyle => searchStyle.id === newCell.styleIds[i]);
|
|
448
355
|
if (findStyle) {
|
|
449
356
|
newCell.custom.style = _objectSpread(_objectSpread({}, newCell.custom.style), findStyle.options);
|
|
450
357
|
}
|
|
451
|
-
};
|
|
452
|
-
|
|
453
|
-
for (var i = 0; i < newCell.styleIds.length; i++) {
|
|
454
|
-
_loop(i);
|
|
455
358
|
}
|
|
456
359
|
}
|
|
457
|
-
|
|
458
360
|
newCell.custom.style = _objectSpread(_objectSpread({}, newCell.custom.style), newCell.style);
|
|
459
|
-
|
|
460
361
|
if (!showEditor) {
|
|
461
|
-
for (
|
|
462
|
-
|
|
463
|
-
|
|
362
|
+
for (let i = 0; i < newCell.styleConditions.length; i++) {
|
|
363
|
+
const replacedText = replaceText(newCell.styleConditions[i].condition, variablesProcessed);
|
|
464
364
|
if (replacedText.missingDependencies === 0) {
|
|
465
365
|
try {
|
|
466
366
|
// eslint-disable-next-line no-eval
|
|
467
367
|
if (window.eval(replacedText.text)) {
|
|
468
|
-
newCell.styleConditions[
|
|
469
|
-
|
|
470
|
-
|
|
368
|
+
newCell.styleConditions[i].styleIds.forEach(styleId => {
|
|
369
|
+
const findStyle = styles.find(aStyle => aStyle.id === styleId);
|
|
471
370
|
if (findStyle) {
|
|
472
371
|
newCell.custom.style = _objectSpread(_objectSpread({}, newCell.custom.style), findStyle.options);
|
|
473
372
|
}
|
|
474
373
|
});
|
|
475
|
-
|
|
476
|
-
newCell.custom.style = _objectSpread(_objectSpread({}, newCell.custom.style), newCell.styleConditions[_i3].style);
|
|
374
|
+
newCell.custom.style = _objectSpread(_objectSpread({}, newCell.custom.style), newCell.styleConditions[i].style);
|
|
477
375
|
break;
|
|
478
376
|
}
|
|
479
377
|
} catch (error) {
|
|
@@ -481,32 +379,27 @@ class DashboardsMainTable extends _react.Component {
|
|
|
481
379
|
}
|
|
482
380
|
}
|
|
483
381
|
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
if (_replacedText.missingDependencies === 0) {
|
|
382
|
+
for (let i = 0; i < newCell.contentConditions.length; i++) {
|
|
383
|
+
const replacedText = replaceText(newCell.contentConditions[i].condition, variablesProcessed);
|
|
384
|
+
if (replacedText.missingDependencies === 0) {
|
|
489
385
|
try {
|
|
490
386
|
// eslint-disable-next-line no-eval
|
|
491
|
-
if (window.eval(
|
|
492
|
-
newCell.content = JSON.parse(JSON.stringify(newCell.contentConditions[
|
|
387
|
+
if (window.eval(replacedText.text)) {
|
|
388
|
+
newCell.content = JSON.parse(JSON.stringify(newCell.contentConditions[i].content));
|
|
493
389
|
break;
|
|
494
390
|
}
|
|
495
391
|
} catch (error) {
|
|
496
|
-
core.log('error', namespace, methodName, "Error window.eval(".concat(
|
|
392
|
+
core.log('error', namespace, methodName, "Error window.eval(".concat(replacedText.text, ")"));
|
|
497
393
|
}
|
|
498
394
|
}
|
|
499
395
|
}
|
|
500
|
-
|
|
501
396
|
if (newCell.content.type === 'text') {
|
|
502
397
|
newCell.content.text = replaceText(newCell.content.text, variablesProcessed, false).text;
|
|
503
398
|
}
|
|
504
|
-
|
|
505
399
|
if (newCell.content.type === 'widget') {
|
|
506
400
|
newCell.content.properties = JSON.parse(replaceText(JSON.stringify(newCell.content.properties), variablesProcessed).text);
|
|
507
401
|
}
|
|
508
402
|
}
|
|
509
|
-
|
|
510
403
|
return newCell;
|
|
511
404
|
});
|
|
512
405
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -556,13 +449,11 @@ class DashboardsMainTable extends _react.Component {
|
|
|
556
449
|
columnProperties: tableDashboard.columnProperties,
|
|
557
450
|
updateSelected: _selected => this.updateSelected(_selected)
|
|
558
451
|
}, tableDashboardProcessed.cells.map(cell => {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
452
|
+
const widget = cell.content.type === 'widget' ? widgets.find(aWidget => aWidget.id === cell.content.id) : null;
|
|
453
|
+
let viewer = null;
|
|
562
454
|
if (widget && widget.plugInType !== 'component') {
|
|
563
455
|
viewer = viewers.find(aViewer => aViewer.metadata.plugInType === widget.plugInType);
|
|
564
456
|
}
|
|
565
|
-
|
|
566
457
|
return /*#__PURE__*/_react.default.createElement(_DashboardsCell.default, {
|
|
567
458
|
cell: cell,
|
|
568
459
|
widget: widget,
|
|
@@ -578,9 +469,7 @@ class DashboardsMainTable extends _react.Component {
|
|
|
578
469
|
height: Math.floor(previewHeight * 0.05)
|
|
579
470
|
})) : null));
|
|
580
471
|
}
|
|
581
|
-
|
|
582
472
|
}
|
|
583
|
-
|
|
584
473
|
DashboardsMainTable.propTypes = {
|
|
585
474
|
gap: _propTypes.default.string,
|
|
586
475
|
showEditor: _propTypes.default.bool,
|
|
@@ -620,7 +509,4 @@ DashboardsMainTable.defaultProps = {
|
|
|
620
509
|
cells: []
|
|
621
510
|
}
|
|
622
511
|
};
|
|
623
|
-
|
|
624
|
-
var _default = (0, _versacallCoreLibraryReact.withCore)(DashboardsMainTable);
|
|
625
|
-
|
|
626
|
-
exports.default = _default;
|
|
512
|
+
var _default = exports.default = (0, _versacallCoreLibraryReact.withCore)(DashboardsMainTable);
|
|
@@ -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 _DashboardsMainTable.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
|
|
13
12
|
var _DashboardsMainTable = _interopRequireDefault(require("./DashboardsMainTable"));
|
|
14
|
-
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|