versacall-dashboards-library-react 2.0.46 → 2.0.47
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.
|
@@ -40,6 +40,9 @@ require("react-nestable-fork/dist/Nestable/Nestable.css");
|
|
|
40
40
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
41
41
|
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); }
|
|
42
42
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
43
|
+
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; }
|
|
44
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
45
|
+
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); }
|
|
43
46
|
// Constants
|
|
44
47
|
const OPERATOR_OPTIONS = [{
|
|
45
48
|
value: '===',
|
|
@@ -215,379 +218,379 @@ const determineIfAdvanced = condition => {
|
|
|
215
218
|
class DashboardsCellGlobalConditions extends _react.Component {
|
|
216
219
|
constructor(props) {
|
|
217
220
|
super(props);
|
|
218
|
-
this
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
if (this.props.styles.length > 0 && row.styleIds && row.styleIds.length > 0) {
|
|
240
|
-
for (let i = 0; i < newCell.styleIds.length; i++) {
|
|
241
|
-
const findStyle = this.props.styles.find(searchStyle => searchStyle.id === newCell.styleIds[i]);
|
|
242
|
-
if (findStyle) {
|
|
243
|
-
newCell.custom.style = {
|
|
244
|
-
...newCell.custom.style,
|
|
245
|
-
...findStyle.options
|
|
246
|
-
};
|
|
221
|
+
_defineProperty(this, "stylePreviewCustomCell", _ref2 => {
|
|
222
|
+
let {
|
|
223
|
+
row
|
|
224
|
+
} = _ref2;
|
|
225
|
+
const newCell = {
|
|
226
|
+
...row
|
|
227
|
+
};
|
|
228
|
+
newCell.custom = {
|
|
229
|
+
viewWidth: 120,
|
|
230
|
+
viewHeight: 120,
|
|
231
|
+
style: {}
|
|
232
|
+
};
|
|
233
|
+
if (this.props.styles.length > 0 && row.styleIds && row.styleIds.length > 0) {
|
|
234
|
+
for (let i = 0; i < newCell.styleIds.length; i++) {
|
|
235
|
+
const findStyle = this.props.styles.find(searchStyle => searchStyle.id === newCell.styleIds[i]);
|
|
236
|
+
if (findStyle) {
|
|
237
|
+
newCell.custom.style = {
|
|
238
|
+
...newCell.custom.style,
|
|
239
|
+
...findStyle.options
|
|
240
|
+
};
|
|
241
|
+
}
|
|
247
242
|
}
|
|
248
243
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
270
|
-
})
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
}));
|
|
279
|
-
};
|
|
280
|
-
actionsCustomCell = _ref4 => {
|
|
281
|
-
let {
|
|
282
|
-
row
|
|
283
|
-
} = _ref4;
|
|
284
|
-
const {
|
|
285
|
-
tabIndex
|
|
286
|
-
} = this.state;
|
|
287
|
-
const conditions = tabIndex === 0 ? this.props.value.styleConditions : this.props.value.contentConditions;
|
|
288
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, row.index !== 0 && /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
289
|
-
onClick: e => {
|
|
290
|
-
e.stopPropagation();
|
|
291
|
-
this.moveCondition(row.index, -1);
|
|
292
|
-
},
|
|
293
|
-
"aria-label": this.props.intl.formatMessage({
|
|
294
|
-
id: '__move_up'
|
|
295
|
-
})
|
|
296
|
-
}, /*#__PURE__*/_react.default.createElement(_ArrowUpward.default, null)), row.index !== String(conditions.length - 1) && /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
297
|
-
onClick: e => {
|
|
298
|
-
e.stopPropagation();
|
|
299
|
-
this.moveCondition(row.index, 1);
|
|
300
|
-
},
|
|
301
|
-
"aria-label": this.props.intl.formatMessage({
|
|
302
|
-
id: '__move_down'
|
|
303
|
-
})
|
|
304
|
-
}, /*#__PURE__*/_react.default.createElement(_ArrowDownward.default, null)), /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
305
|
-
onClick: e => {
|
|
306
|
-
e.stopPropagation();
|
|
307
|
-
this.copyCondition(row);
|
|
308
|
-
},
|
|
309
|
-
"aria-label": this.props.intl.formatMessage({
|
|
310
|
-
id: '__copy'
|
|
311
|
-
})
|
|
312
|
-
}, /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
313
|
-
title: this.props.intl.formatMessage({
|
|
314
|
-
id: '__copy'
|
|
315
|
-
})
|
|
316
|
-
}, /*#__PURE__*/_react.default.createElement(_FileCopy.default, null))), /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
317
|
-
onClick: e => {
|
|
318
|
-
e.stopPropagation();
|
|
319
|
-
this.deleteCondition(row.index);
|
|
320
|
-
},
|
|
321
|
-
"aria-label": this.props.intl.formatMessage({
|
|
322
|
-
id: '__delete'
|
|
323
|
-
})
|
|
324
|
-
}, /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
325
|
-
title: this.props.intl.formatMessage({
|
|
326
|
-
id: '__delete'
|
|
327
|
-
})
|
|
328
|
-
}, /*#__PURE__*/_react.default.createElement(_Delete.default, null))));
|
|
329
|
-
};
|
|
330
|
-
updateCondition = change => {
|
|
331
|
-
const {
|
|
332
|
-
conditionIndex,
|
|
333
|
-
tabIndex
|
|
334
|
-
} = this.state;
|
|
335
|
-
const updatedValue = {
|
|
336
|
-
...this.props.value
|
|
337
|
-
};
|
|
338
|
-
const conditions = tabIndex === 1 ? updatedValue.contentConditions : updatedValue.styleConditions;
|
|
339
|
-
if (this.state.advanced) {
|
|
340
|
-
conditions[conditionIndex].condition = change.value;
|
|
341
|
-
} else {
|
|
342
|
-
const split = conditions[conditionIndex].condition.split(/[ ,]+/);
|
|
343
|
-
const segment1 = split[0];
|
|
344
|
-
const segment2 = split.length > 1 ? split[1] : '===';
|
|
345
|
-
const segment3 = split.length > 2 ? split[2] : '0';
|
|
346
|
-
switch (change.stringIndex) {
|
|
347
|
-
case 0:
|
|
348
|
-
conditions[conditionIndex].condition = `${change.value} ${segment2} ${segment3}`;
|
|
349
|
-
break;
|
|
350
|
-
case 1:
|
|
351
|
-
conditions[conditionIndex].condition = `${segment1} ${change.value} ${segment3}`;
|
|
352
|
-
break;
|
|
353
|
-
case 2:
|
|
354
|
-
conditions[conditionIndex].condition = `${segment1} ${segment2} ${change.value}`;
|
|
355
|
-
break;
|
|
356
|
-
default:
|
|
357
|
-
conditions[conditionIndex].condition = `${segment1} ${segment2} ${segment3}`;
|
|
358
|
-
break;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
this.props.updateValue({
|
|
362
|
-
styleConditions: updatedValue.styleConditions,
|
|
363
|
-
contentConditions: updatedValue.contentConditions
|
|
244
|
+
newCell.custom.style = {
|
|
245
|
+
...newCell.custom.style,
|
|
246
|
+
...newCell.style
|
|
247
|
+
};
|
|
248
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
249
|
+
style: {
|
|
250
|
+
width: 120
|
|
251
|
+
}
|
|
252
|
+
}, /*#__PURE__*/_react.default.createElement(_DashboardsPreview.default, {
|
|
253
|
+
width: "120px",
|
|
254
|
+
height: "100px",
|
|
255
|
+
padding: "10px"
|
|
256
|
+
}, /*#__PURE__*/_react.default.createElement(_DashboardsCell.default, {
|
|
257
|
+
cell: {
|
|
258
|
+
content: {
|
|
259
|
+
type: 'text',
|
|
260
|
+
text: 'Hello'
|
|
261
|
+
},
|
|
262
|
+
custom: newCell.custom
|
|
263
|
+
}
|
|
264
|
+
})));
|
|
265
|
+
});
|
|
266
|
+
_defineProperty(this, "contentTypeCustomCell", _ref3 => {
|
|
267
|
+
let {
|
|
268
|
+
row
|
|
269
|
+
} = _ref3;
|
|
270
|
+
return /*#__PURE__*/_react.default.createElement("span", null, this.props.intl.formatMessage({
|
|
271
|
+
id: `__${row.content.type}`
|
|
272
|
+
}));
|
|
364
273
|
});
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
274
|
+
_defineProperty(this, "actionsCustomCell", _ref4 => {
|
|
275
|
+
let {
|
|
276
|
+
row
|
|
277
|
+
} = _ref4;
|
|
278
|
+
const {
|
|
279
|
+
tabIndex
|
|
280
|
+
} = this.state;
|
|
281
|
+
const conditions = tabIndex === 0 ? this.props.value.styleConditions : this.props.value.contentConditions;
|
|
282
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, row.index !== 0 && /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
283
|
+
onClick: e => {
|
|
284
|
+
e.stopPropagation();
|
|
285
|
+
this.moveCondition(row.index, -1);
|
|
286
|
+
},
|
|
287
|
+
"aria-label": this.props.intl.formatMessage({
|
|
288
|
+
id: '__move_up'
|
|
289
|
+
})
|
|
290
|
+
}, /*#__PURE__*/_react.default.createElement(_ArrowUpward.default, null)), row.index !== String(conditions.length - 1) && /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
291
|
+
onClick: e => {
|
|
292
|
+
e.stopPropagation();
|
|
293
|
+
this.moveCondition(row.index, 1);
|
|
294
|
+
},
|
|
295
|
+
"aria-label": this.props.intl.formatMessage({
|
|
296
|
+
id: '__move_down'
|
|
297
|
+
})
|
|
298
|
+
}, /*#__PURE__*/_react.default.createElement(_ArrowDownward.default, null)), /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
299
|
+
onClick: e => {
|
|
300
|
+
e.stopPropagation();
|
|
301
|
+
this.copyCondition(row);
|
|
302
|
+
},
|
|
303
|
+
"aria-label": this.props.intl.formatMessage({
|
|
304
|
+
id: '__copy'
|
|
305
|
+
})
|
|
306
|
+
}, /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
307
|
+
title: this.props.intl.formatMessage({
|
|
308
|
+
id: '__copy'
|
|
309
|
+
})
|
|
310
|
+
}, /*#__PURE__*/_react.default.createElement(_FileCopy.default, null))), /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
311
|
+
onClick: e => {
|
|
312
|
+
e.stopPropagation();
|
|
313
|
+
this.deleteCondition(row.index);
|
|
314
|
+
},
|
|
315
|
+
"aria-label": this.props.intl.formatMessage({
|
|
316
|
+
id: '__delete'
|
|
317
|
+
})
|
|
318
|
+
}, /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
319
|
+
title: this.props.intl.formatMessage({
|
|
320
|
+
id: '__delete'
|
|
321
|
+
})
|
|
322
|
+
}, /*#__PURE__*/_react.default.createElement(_Delete.default, null))));
|
|
371
323
|
});
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
...value
|
|
324
|
+
_defineProperty(this, "updateCondition", change => {
|
|
325
|
+
const {
|
|
326
|
+
conditionIndex,
|
|
327
|
+
tabIndex
|
|
328
|
+
} = this.state;
|
|
329
|
+
const updatedValue = {
|
|
330
|
+
...this.props.value
|
|
379
331
|
};
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
332
|
+
const conditions = tabIndex === 1 ? updatedValue.contentConditions : updatedValue.styleConditions;
|
|
333
|
+
if (this.state.advanced) {
|
|
334
|
+
conditions[conditionIndex].condition = change.value;
|
|
335
|
+
} else {
|
|
336
|
+
const split = conditions[conditionIndex].condition.split(/[ ,]+/);
|
|
337
|
+
const segment1 = split[0];
|
|
338
|
+
const segment2 = split.length > 1 ? split[1] : '===';
|
|
339
|
+
const segment3 = split.length > 2 ? split[2] : '0';
|
|
340
|
+
switch (change.stringIndex) {
|
|
341
|
+
case 0:
|
|
342
|
+
conditions[conditionIndex].condition = `${change.value} ${segment2} ${segment3}`;
|
|
343
|
+
break;
|
|
344
|
+
case 1:
|
|
345
|
+
conditions[conditionIndex].condition = `${segment1} ${change.value} ${segment3}`;
|
|
346
|
+
break;
|
|
347
|
+
case 2:
|
|
348
|
+
conditions[conditionIndex].condition = `${segment1} ${segment2} ${change.value}`;
|
|
349
|
+
break;
|
|
350
|
+
default:
|
|
351
|
+
conditions[conditionIndex].condition = `${segment1} ${segment2} ${segment3}`;
|
|
352
|
+
break;
|
|
383
353
|
}
|
|
354
|
+
}
|
|
355
|
+
this.props.updateValue({
|
|
356
|
+
styleConditions: updatedValue.styleConditions,
|
|
357
|
+
contentConditions: updatedValue.contentConditions
|
|
384
358
|
});
|
|
385
|
-
} else {
|
|
386
|
-
styleConditions[this.state.conditionIndex].style = {};
|
|
387
|
-
}
|
|
388
|
-
this.props.updateValue({
|
|
389
|
-
styleConditions
|
|
390
359
|
});
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
contentConditions
|
|
397
|
-
});
|
|
398
|
-
};
|
|
399
|
-
addCondition = () => {
|
|
400
|
-
const conditions = {
|
|
401
|
-
...this.props.value
|
|
402
|
-
};
|
|
403
|
-
let index = null;
|
|
404
|
-
if (this.state.tabIndex === 0) {
|
|
405
|
-
conditions.styleConditions.push({
|
|
406
|
-
condition: '1 > 0',
|
|
407
|
-
style: {},
|
|
408
|
-
styleIds: []
|
|
360
|
+
_defineProperty(this, "updateStyleIds", value => {
|
|
361
|
+
const styleConditions = [...this.props.value.styleConditions];
|
|
362
|
+
styleConditions[this.state.conditionIndex].styleIds = value.styleIds;
|
|
363
|
+
this.props.updateValue({
|
|
364
|
+
styleConditions
|
|
409
365
|
});
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
}
|
|
366
|
+
});
|
|
367
|
+
_defineProperty(this, "updateStyle", value => {
|
|
368
|
+
const styleConditions = [...this.props.value.styleConditions];
|
|
369
|
+
if (Object.keys(value.style).length > 0) {
|
|
370
|
+
styleConditions[this.state.conditionIndex].style = {
|
|
371
|
+
...styleConditions[this.state.conditionIndex].style,
|
|
372
|
+
...value.style
|
|
373
|
+
};
|
|
374
|
+
Object.keys(styleConditions[this.state.conditionIndex].style).forEach(key => {
|
|
375
|
+
if (styleConditions[this.state.conditionIndex].style[key] === 'delete') {
|
|
376
|
+
delete styleConditions[this.state.conditionIndex].style[key];
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
} else {
|
|
380
|
+
styleConditions[this.state.conditionIndex].style = {};
|
|
381
|
+
}
|
|
382
|
+
this.props.updateValue({
|
|
383
|
+
styleConditions
|
|
418
384
|
});
|
|
419
|
-
index = conditions.contentConditions.length - 1;
|
|
420
|
-
}
|
|
421
|
-
this.props.updateValue({
|
|
422
|
-
styleConditions: conditions.styleConditions,
|
|
423
|
-
contentConditions: conditions.contentConditions
|
|
424
385
|
});
|
|
425
|
-
this
|
|
426
|
-
|
|
427
|
-
|
|
386
|
+
_defineProperty(this, "updateContent", value => {
|
|
387
|
+
const contentConditions = [...this.props.value.contentConditions];
|
|
388
|
+
contentConditions[this.state.conditionIndex].content = value.content;
|
|
389
|
+
this.props.updateValue({
|
|
390
|
+
contentConditions
|
|
391
|
+
});
|
|
428
392
|
});
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
393
|
+
_defineProperty(this, "addCondition", () => {
|
|
394
|
+
const conditions = {
|
|
395
|
+
...this.props.value
|
|
396
|
+
};
|
|
397
|
+
let index = null;
|
|
398
|
+
if (this.state.tabIndex === 0) {
|
|
399
|
+
conditions.styleConditions.push({
|
|
400
|
+
condition: '1 > 0',
|
|
401
|
+
style: {},
|
|
402
|
+
styleIds: []
|
|
403
|
+
});
|
|
404
|
+
index = conditions.styleConditions.length - 1;
|
|
405
|
+
} else {
|
|
406
|
+
conditions.contentConditions.push({
|
|
407
|
+
condition: '1 > 0',
|
|
408
|
+
content: {
|
|
409
|
+
type: 'text',
|
|
410
|
+
text: ''
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
index = conditions.contentConditions.length - 1;
|
|
414
|
+
}
|
|
415
|
+
this.props.updateValue({
|
|
416
|
+
styleConditions: conditions.styleConditions,
|
|
417
|
+
contentConditions: conditions.contentConditions
|
|
418
|
+
});
|
|
419
|
+
this.setState({
|
|
420
|
+
conditionIndex: index,
|
|
421
|
+
advanced: false
|
|
422
|
+
});
|
|
444
423
|
});
|
|
445
|
-
this
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
conditions[this.state.tabIndex === 0 ? 'styleConditions' : 'contentConditions'].splice(Number(index), 1);
|
|
465
|
-
this.props.updateValue({
|
|
466
|
-
styleConditions: conditions.styleConditions,
|
|
467
|
-
contentConditions: conditions.contentConditions
|
|
424
|
+
_defineProperty(this, "copyCondition", condition => {
|
|
425
|
+
const newValue = {
|
|
426
|
+
...this.props.value
|
|
427
|
+
};
|
|
428
|
+
const newCondition = {
|
|
429
|
+
...condition
|
|
430
|
+
};
|
|
431
|
+
delete newCondition.index;
|
|
432
|
+
const conditions = newValue[this.state.tabIndex === 0 ? 'styleConditions' : 'contentConditions'];
|
|
433
|
+
conditions.push(newCondition);
|
|
434
|
+
const advanced = determineIfAdvanced(newCondition.condition);
|
|
435
|
+
this.props.updateValue({
|
|
436
|
+
styleConditions: newValue.styleConditions,
|
|
437
|
+
contentConditions: newValue.contentConditions
|
|
438
|
+
});
|
|
439
|
+
this.setState(prevState => ({
|
|
440
|
+
conditionIndex: conditions.length - 1,
|
|
441
|
+
advanced
|
|
442
|
+
}));
|
|
468
443
|
});
|
|
469
|
-
this
|
|
470
|
-
|
|
471
|
-
|
|
444
|
+
_defineProperty(this, "duplicateCondition", index => {
|
|
445
|
+
const {
|
|
446
|
+
value
|
|
447
|
+
} = this.props;
|
|
448
|
+
const {
|
|
449
|
+
tabIndex
|
|
450
|
+
} = this.state;
|
|
451
|
+
const condition = value[tabIndex === 0 ? 'styleConditions' : 'contentConditions'][index];
|
|
452
|
+
this.copyCondition(condition);
|
|
472
453
|
});
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
454
|
+
_defineProperty(this, "deleteCondition", index => {
|
|
455
|
+
const conditions = {
|
|
456
|
+
...this.props.value
|
|
457
|
+
};
|
|
458
|
+
conditions[this.state.tabIndex === 0 ? 'styleConditions' : 'contentConditions'].splice(Number(index), 1);
|
|
459
|
+
this.props.updateValue({
|
|
460
|
+
styleConditions: conditions.styleConditions,
|
|
461
|
+
contentConditions: conditions.contentConditions
|
|
462
|
+
});
|
|
463
|
+
this.setState({
|
|
464
|
+
conditionIndex: null,
|
|
465
|
+
advanced: false
|
|
466
|
+
});
|
|
484
467
|
});
|
|
485
|
-
this
|
|
486
|
-
|
|
487
|
-
|
|
468
|
+
_defineProperty(this, "moveCondition", (index, direction) => {
|
|
469
|
+
const conditions = {
|
|
470
|
+
...this.props.value
|
|
471
|
+
};
|
|
472
|
+
const conditionArray = conditions[this.state.tabIndex === 0 ? 'styleConditions' : 'contentConditions'];
|
|
473
|
+
const [removed] = conditionArray.splice(Number(index), 1);
|
|
474
|
+
conditionArray.splice(Number(index) + direction, 0, removed);
|
|
475
|
+
this.props.updateValue({
|
|
476
|
+
styleConditions: conditions.styleConditions,
|
|
477
|
+
contentConditions: conditions.contentConditions
|
|
478
|
+
});
|
|
479
|
+
this.setState({
|
|
480
|
+
conditionIndex: null,
|
|
481
|
+
advanced: false
|
|
482
|
+
});
|
|
488
483
|
});
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
484
|
+
_defineProperty(this, "onDragEnd", result => {
|
|
485
|
+
const {
|
|
486
|
+
value
|
|
487
|
+
} = this.props;
|
|
488
|
+
const {
|
|
489
|
+
tabIndex
|
|
490
|
+
} = this.state;
|
|
491
|
+
if (!result.destination) {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
const items = reorder(tabIndex === 0 ? value.styleConditions : value.contentConditions, result.source.index, result.destination.index);
|
|
495
|
+
const newConditions = {
|
|
496
|
+
...value
|
|
497
|
+
};
|
|
498
|
+
if (tabIndex === 0) {
|
|
499
|
+
newConditions.styleConditions = items;
|
|
500
|
+
} else {
|
|
501
|
+
newConditions.contentConditions = items;
|
|
502
|
+
}
|
|
503
|
+
this.props.updateValue({
|
|
504
|
+
styleConditions: newConditions.styleConditions,
|
|
505
|
+
contentConditions: newConditions.contentConditions
|
|
506
|
+
});
|
|
507
|
+
this.setState({
|
|
508
|
+
conditionIndex: result.destination.index
|
|
509
|
+
});
|
|
512
510
|
});
|
|
513
|
-
this
|
|
514
|
-
|
|
511
|
+
_defineProperty(this, "selectCondition", index => {
|
|
512
|
+
const {
|
|
513
|
+
value
|
|
514
|
+
} = this.props;
|
|
515
|
+
const {
|
|
516
|
+
tabIndex
|
|
517
|
+
} = this.state;
|
|
518
|
+
const conditions = tabIndex === 1 ? value.contentConditions : value.styleConditions;
|
|
519
|
+
const condition = conditions[index];
|
|
520
|
+
const advanced = determineIfAdvanced(condition.condition);
|
|
521
|
+
this.setState({
|
|
522
|
+
conditionIndex: index,
|
|
523
|
+
advanced
|
|
524
|
+
});
|
|
515
525
|
});
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
526
|
+
_defineProperty(this, "renderConditionCard", obj => {
|
|
527
|
+
const {
|
|
528
|
+
item,
|
|
529
|
+
handler
|
|
530
|
+
} = obj;
|
|
531
|
+
const {
|
|
532
|
+
classes,
|
|
533
|
+
intl
|
|
534
|
+
} = this.props;
|
|
535
|
+
const {
|
|
536
|
+
tabIndex,
|
|
537
|
+
conditionIndex
|
|
538
|
+
} = this.state;
|
|
539
|
+
const divStyle = {
|
|
540
|
+
border: '1px solid black',
|
|
541
|
+
padding: 10,
|
|
542
|
+
margin: 2,
|
|
543
|
+
display: 'flex',
|
|
544
|
+
alignItems: 'center',
|
|
545
|
+
backgroundColor: item.index === conditionIndex ? '#55b7dc' : '#ffffff'
|
|
546
|
+
};
|
|
547
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
548
|
+
role: "treeitem",
|
|
549
|
+
"aria-selected": item.index === conditionIndex,
|
|
550
|
+
style: divStyle,
|
|
551
|
+
className: classes.selectable,
|
|
552
|
+
onClick: () => this.selectCondition(item.index)
|
|
553
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
554
|
+
style: {
|
|
555
|
+
marginRight: 20,
|
|
556
|
+
fontWeight: 'bold'
|
|
557
|
+
}
|
|
558
|
+
}, item.index === 0 ? 'IF' : 'ELSE IF'), /*#__PURE__*/_react.default.createElement("span", {
|
|
559
|
+
style: {
|
|
560
|
+
flexGrow: 1
|
|
561
|
+
}
|
|
562
|
+
}, determineIfAdvanced(item.condition) ? item.condition : formatCondition(item.condition)), tabIndex === 0 && this.stylePreviewCustomCell({
|
|
563
|
+
row: item
|
|
564
|
+
}), tabIndex === 1 && item.content && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
565
|
+
style: {
|
|
566
|
+
marginRight: 10
|
|
567
|
+
}
|
|
568
|
+
}, intl.formatMessage({
|
|
569
|
+
id: `__${item.content.type}`
|
|
570
|
+
})), contentPreviewCustomCell({
|
|
571
|
+
row: item
|
|
572
|
+
})), handler, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
573
|
+
onClick: e => {
|
|
574
|
+
e.stopPropagation();
|
|
575
|
+
this.setState({
|
|
576
|
+
menuIndex: item.index,
|
|
577
|
+
menuAnchorEl: e.currentTarget
|
|
578
|
+
});
|
|
579
|
+
},
|
|
580
|
+
"aria-label": intl.formatMessage({
|
|
581
|
+
id: '__more_options'
|
|
582
|
+
})
|
|
583
|
+
}, /*#__PURE__*/_react.default.createElement(_MoreVert.default, null)));
|
|
530
584
|
});
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
classes,
|
|
539
|
-
intl
|
|
540
|
-
} = this.props;
|
|
541
|
-
const {
|
|
542
|
-
tabIndex,
|
|
543
|
-
conditionIndex
|
|
544
|
-
} = this.state;
|
|
545
|
-
const divStyle = {
|
|
546
|
-
border: '1px solid black',
|
|
547
|
-
padding: 10,
|
|
548
|
-
margin: 2,
|
|
549
|
-
display: 'flex',
|
|
550
|
-
alignItems: 'center',
|
|
551
|
-
backgroundColor: item.index === conditionIndex ? '#55b7dc' : '#ffffff'
|
|
585
|
+
this.state = {
|
|
586
|
+
open: false,
|
|
587
|
+
tabIndex: 0,
|
|
588
|
+
conditionIndex: null,
|
|
589
|
+
menuIndex: null,
|
|
590
|
+
menuAnchorEl: null,
|
|
591
|
+
advanced: false
|
|
552
592
|
};
|
|
553
|
-
|
|
554
|
-
role: "treeitem",
|
|
555
|
-
"aria-selected": item.index === conditionIndex,
|
|
556
|
-
style: divStyle,
|
|
557
|
-
className: classes.selectable,
|
|
558
|
-
onClick: () => this.selectCondition(item.index)
|
|
559
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
560
|
-
style: {
|
|
561
|
-
marginRight: 20,
|
|
562
|
-
fontWeight: 'bold'
|
|
563
|
-
}
|
|
564
|
-
}, item.index === 0 ? 'IF' : 'ELSE IF'), /*#__PURE__*/_react.default.createElement("span", {
|
|
565
|
-
style: {
|
|
566
|
-
flexGrow: 1
|
|
567
|
-
}
|
|
568
|
-
}, determineIfAdvanced(item.condition) ? item.condition : formatCondition(item.condition)), tabIndex === 0 && this.stylePreviewCustomCell({
|
|
569
|
-
row: item
|
|
570
|
-
}), tabIndex === 1 && item.content && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
571
|
-
style: {
|
|
572
|
-
marginRight: 10
|
|
573
|
-
}
|
|
574
|
-
}, intl.formatMessage({
|
|
575
|
-
id: `__${item.content.type}`
|
|
576
|
-
})), contentPreviewCustomCell({
|
|
577
|
-
row: item
|
|
578
|
-
})), handler, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
579
|
-
onClick: e => {
|
|
580
|
-
e.stopPropagation();
|
|
581
|
-
this.setState({
|
|
582
|
-
menuIndex: item.index,
|
|
583
|
-
menuAnchorEl: e.currentTarget
|
|
584
|
-
});
|
|
585
|
-
},
|
|
586
|
-
"aria-label": intl.formatMessage({
|
|
587
|
-
id: '__more_options'
|
|
588
|
-
})
|
|
589
|
-
}, /*#__PURE__*/_react.default.createElement(_MoreVert.default, null)));
|
|
590
|
-
};
|
|
593
|
+
}
|
|
591
594
|
render() {
|
|
592
595
|
const {
|
|
593
596
|
classes,
|
package/package.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"versacall": {
|
|
3
3
|
"title": "Versacall Dashboards Library React",
|
|
4
4
|
"applicationType": "react-library",
|
|
5
|
-
"build":
|
|
5
|
+
"build": 47
|
|
6
6
|
},
|
|
7
7
|
"name": "versacall-dashboards-library-react",
|
|
8
|
-
"version": "2.0.
|
|
8
|
+
"version": "2.0.47",
|
|
9
9
|
"description": "Versacall Dashboards Library",
|
|
10
10
|
"main": "dist/index.js",
|
|
11
11
|
"module": "dist/index.js",
|