@websy/websy-designs 1.3.0 → 1.3.1
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/server/routes/v1/shop.js +52 -15
- package/dist/websy-designs-es6.debug.js +134 -55
- package/dist/websy-designs-es6.js +146 -54
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +134 -55
- package/dist/websy-designs.js +146 -54
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -414,6 +414,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
414
414
|
var _this2 = this;
|
|
415
415
|
|
|
416
416
|
var isRange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
417
|
+
console.trace();
|
|
417
418
|
var maskEl = document.getElementById("".concat(this.elementId, "_mask"));
|
|
418
419
|
var contentEl = document.getElementById("".concat(this.elementId, "_content"));
|
|
419
420
|
var el = document.getElementById(this.elementId);
|
|
@@ -435,9 +436,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
435
436
|
hoursOut.push(this.options.hours[i]);
|
|
436
437
|
}
|
|
437
438
|
|
|
438
|
-
this.options.onChange(hoursOut, true);
|
|
439
|
+
this.options.onChange(hoursOut, true, this.selectedRange);
|
|
439
440
|
} else {
|
|
440
|
-
this.options.onChange(this.selectedRangeDates, true);
|
|
441
|
+
this.options.onChange(this.selectedRangeDates, true, this.selectedRange);
|
|
441
442
|
}
|
|
442
443
|
} else {
|
|
443
444
|
if (this.options.mode === 'hour') {
|
|
@@ -445,9 +446,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
445
446
|
return _this2.options.hours[h];
|
|
446
447
|
});
|
|
447
448
|
|
|
448
|
-
this.options.onChange(_hoursOut, true);
|
|
449
|
+
this.options.onChange(_hoursOut, true, this.selectedRange);
|
|
449
450
|
} else {
|
|
450
|
-
this.options.onChange(this.currentselection, isRange);
|
|
451
|
+
this.options.onChange(this.currentselection, isRange, this.selectedRange);
|
|
451
452
|
}
|
|
452
453
|
}
|
|
453
454
|
}
|
|
@@ -473,7 +474,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
473
474
|
} // d.setTime(d.getTime() + d.getTimezoneOffset() * 60000)
|
|
474
475
|
|
|
475
476
|
|
|
476
|
-
return new Date(d.
|
|
477
|
+
return new Date(d.setUTCHours(12, 0, 0, 0));
|
|
477
478
|
}
|
|
478
479
|
}, {
|
|
479
480
|
key: "handleClick",
|
|
@@ -614,7 +615,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
614
615
|
|
|
615
616
|
if (this.options.mode === 'date') {
|
|
616
617
|
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + _i * this.oneDay));
|
|
617
|
-
d.
|
|
618
|
+
d.setUTCHours(12, 0, 0, 0);
|
|
618
619
|
d = d.getTime();
|
|
619
620
|
rangeStart = this.selectedRangeDates[0].getTime();
|
|
620
621
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
@@ -670,9 +671,11 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
670
671
|
dateEl = document.getElementById("".concat(_this3.elementId, "_").concat(d, "_hour"));
|
|
671
672
|
}
|
|
672
673
|
|
|
673
|
-
dateEl
|
|
674
|
-
|
|
675
|
-
|
|
674
|
+
if (dateEl) {
|
|
675
|
+
dateEl.classList.add('selected');
|
|
676
|
+
dateEl.classList.add('first');
|
|
677
|
+
dateEl.classList.add('last');
|
|
678
|
+
}
|
|
676
679
|
});
|
|
677
680
|
}
|
|
678
681
|
}
|
|
@@ -920,7 +923,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
920
923
|
|
|
921
924
|
html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-date-list'><ul>");
|
|
922
925
|
html += yearList.map(function (d) {
|
|
923
|
-
return "<li id='".concat(_this4.elementId, "_").concat(d.id, "_year' class='websy-dp-date websy-dp-year ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.year, "</li>");
|
|
926
|
+
return "<li id='".concat(_this4.elementId, "_").concat(d.id, "_year' data-id='").concat(d.id, "' class='websy-dp-date websy-dp-year ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.year, "</li>");
|
|
924
927
|
}).join('');
|
|
925
928
|
html += "</ul></div>";
|
|
926
929
|
} else if (this.options.mode === 'monthyear') {
|
|
@@ -940,7 +943,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
940
943
|
}
|
|
941
944
|
|
|
942
945
|
html += this.monthYears[year].map(function (d) {
|
|
943
|
-
return "<li id='".concat(_this4.elementId, "_").concat(d.id, "_monthyear' data-year='").concat(d.year, "' class='websy-dp-date websy-dp-monthyear'>").concat(d.month, "</li>");
|
|
946
|
+
return "<li id='".concat(_this4.elementId, "_").concat(d.id, "_monthyear' data-id='").concat(d.id, "' data-year='").concat(d.year, "' class='websy-dp-date websy-dp-monthyear'>").concat(d.month, "</li>");
|
|
944
947
|
}).join('');
|
|
945
948
|
html += "</ul>";
|
|
946
949
|
}
|
|
@@ -1048,16 +1051,6 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1048
1051
|
return d.getTime();
|
|
1049
1052
|
});
|
|
1050
1053
|
this.selectedRange = +index;
|
|
1051
|
-
var el = document.getElementById("".concat(this.elementId, "_header"));
|
|
1052
|
-
|
|
1053
|
-
if (el) {
|
|
1054
|
-
if (this.selectedRange === 0) {
|
|
1055
|
-
el.classList.remove('range-selected');
|
|
1056
|
-
} else {
|
|
1057
|
-
el.classList.add('range-selected');
|
|
1058
|
-
}
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1061
1054
|
this.highlightRange();
|
|
1062
1055
|
this.updateRange();
|
|
1063
1056
|
this.close(confirm, true);
|
|
@@ -1069,16 +1062,17 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1069
1062
|
var _this6 = this;
|
|
1070
1063
|
|
|
1071
1064
|
this.selectedRange = -1;
|
|
1072
|
-
var isContinuousRange = true;
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
}
|
|
1065
|
+
var isContinuousRange = true; // if (rangeInput.length === 1) {
|
|
1066
|
+
// this.selectedRangeDates = [...rangeInput]
|
|
1067
|
+
// this.customRangeSelected = true
|
|
1068
|
+
// }
|
|
1069
|
+
// else if (rangeInput.length === 2) {
|
|
1070
|
+
// this.selectedRangeDates = [...rangeInput]
|
|
1071
|
+
// this.customRangeSelected = true
|
|
1072
|
+
// }
|
|
1081
1073
|
|
|
1074
|
+
this.selectedRangeDates = _toConsumableArray(rangeInput);
|
|
1075
|
+
this.customRangeSelected = true;
|
|
1082
1076
|
rangeInput.forEach(function (r, i) {
|
|
1083
1077
|
if (i > 0) {
|
|
1084
1078
|
if (_this6.options.mode === 'date' || _this6.options.mode === 'monthyear') {
|
|
@@ -1232,6 +1226,16 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1232
1226
|
if (labelEl) {
|
|
1233
1227
|
labelEl.innerHTML = range.label;
|
|
1234
1228
|
}
|
|
1229
|
+
|
|
1230
|
+
var headerEl = document.getElementById("".concat(this.elementId, "_header"));
|
|
1231
|
+
|
|
1232
|
+
if (headerEl) {
|
|
1233
|
+
if (this.selectedRange === 0) {
|
|
1234
|
+
headerEl.classList.remove('range-selected');
|
|
1235
|
+
} else {
|
|
1236
|
+
headerEl.classList.add('range-selected');
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1235
1239
|
}
|
|
1236
1240
|
}]);
|
|
1237
1241
|
|
|
@@ -1251,7 +1255,8 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
1251
1255
|
var DEFAULTS = {
|
|
1252
1256
|
items: [],
|
|
1253
1257
|
orientation: 'horizontal',
|
|
1254
|
-
dropPlaceholder: 'Drop item here'
|
|
1258
|
+
dropPlaceholder: 'Drop item here',
|
|
1259
|
+
accepts: 'application/wd-item'
|
|
1255
1260
|
};
|
|
1256
1261
|
this.busy = false;
|
|
1257
1262
|
this.options = _extends({}, DEFAULTS, options);
|
|
@@ -1317,7 +1322,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
1317
1322
|
item.id = WebsyDesigns.Utils.createIdentity();
|
|
1318
1323
|
}
|
|
1319
1324
|
|
|
1320
|
-
var html = "\n <div id='".concat(item.id, "_item' class='websy-dragdrop-item' draggable='true' data-id='").concat(item.id, "'> \n <div id='").concat(item.id, "_itemInner' class='websy-dragdrop-item-inner' data-id='").concat(item.id, "'>\n ");
|
|
1325
|
+
var html = "\n <div id='".concat(item.id, "_item' class='websy-dragdrop-item ").concat((item.classes || []).join(' '), "' draggable='true' data-id='").concat(item.id, "'> \n <div id='").concat(item.id, "_itemInner' class='websy-dragdrop-item-inner' data-id='").concat(item.id, "'>\n ");
|
|
1321
1326
|
|
|
1322
1327
|
if (item.component) {
|
|
1323
1328
|
html += "<div id='".concat(item.id, "_component'></div>");
|
|
@@ -1347,27 +1352,32 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
1347
1352
|
value: function handleDragStart(event) {
|
|
1348
1353
|
this.draggedId = event.target.getAttribute('data-id');
|
|
1349
1354
|
event.dataTransfer.effectAllowed = 'move';
|
|
1350
|
-
event.dataTransfer.setData(
|
|
1355
|
+
event.dataTransfer.setData(this.options.accepts, JSON.stringify({
|
|
1351
1356
|
el: event.target.id,
|
|
1352
1357
|
id: this.elementId,
|
|
1353
1358
|
itemId: this.draggedId
|
|
1354
|
-
}));
|
|
1359
|
+
}));
|
|
1360
|
+
event.target.classList.add('dragging'); // event.target.style.opacity = 0.5
|
|
1355
1361
|
|
|
1356
|
-
event.target.style.opacity = 0.5;
|
|
1357
1362
|
this.dragging = true;
|
|
1358
1363
|
}
|
|
1359
1364
|
}, {
|
|
1360
1365
|
key: "handleDragOver",
|
|
1361
1366
|
value: function handleDragOver(event) {
|
|
1362
|
-
// console.log('drag over', event.target.classList)
|
|
1363
1367
|
if (event.preventDefault) {
|
|
1364
1368
|
event.preventDefault();
|
|
1365
1369
|
}
|
|
1366
1370
|
|
|
1371
|
+
console.log('drag', event.target.classList);
|
|
1372
|
+
|
|
1367
1373
|
if (!event.target.classList.contains('droppable')) {
|
|
1368
1374
|
return;
|
|
1369
1375
|
}
|
|
1370
1376
|
|
|
1377
|
+
if (event.dataTransfer.types.indexOf(this.options.accepts) === -1) {
|
|
1378
|
+
return;
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1371
1381
|
event.target.classList.add('drag-over');
|
|
1372
1382
|
}
|
|
1373
1383
|
}, {
|
|
@@ -1387,8 +1397,8 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
1387
1397
|
key: "handleDrop",
|
|
1388
1398
|
value: function handleDrop(event) {
|
|
1389
1399
|
// console.log('drag drop')
|
|
1390
|
-
// console.log(event.dataTransfer.getData('application/wd-item'))
|
|
1391
|
-
var data = JSON.parse(event.dataTransfer.getData(
|
|
1400
|
+
// console.log(event.dataTransfer.getData('application/wd-item'))
|
|
1401
|
+
var data = JSON.parse(event.dataTransfer.getData(this.options.accepts));
|
|
1392
1402
|
|
|
1393
1403
|
if (event.preventDefault) {
|
|
1394
1404
|
event.preventDefault();
|
|
@@ -1398,6 +1408,10 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
1398
1408
|
return;
|
|
1399
1409
|
}
|
|
1400
1410
|
|
|
1411
|
+
if (event.dataTransfer.types.indexOf(this.options.accepts) === -1) {
|
|
1412
|
+
return;
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1401
1415
|
var side = event.target.getAttribute('data-side');
|
|
1402
1416
|
var id = event.target.getAttribute('data-id');
|
|
1403
1417
|
var index = this.getItemIndex(id);
|
|
@@ -1455,6 +1469,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
1455
1469
|
value: function handleDragEnd(event) {
|
|
1456
1470
|
// console.log('drag end')
|
|
1457
1471
|
event.target.style.opacity = 1;
|
|
1472
|
+
event.target.classList.remove('dragging');
|
|
1458
1473
|
this.draggedId = null;
|
|
1459
1474
|
this.dragging = false;
|
|
1460
1475
|
var startEl = document.getElementById("".concat(this.elementId, "start_item"));
|
|
@@ -5806,12 +5821,20 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5806
5821
|
data.forEach(function (row) {
|
|
5807
5822
|
bodyHtml += "<tr class=\"websy-table-row\">";
|
|
5808
5823
|
row.forEach(function (cell, cellIndex) {
|
|
5824
|
+
if (typeof sizingColumns[cellIndex] === 'undefined') {
|
|
5825
|
+
return; // need to revisit this logic
|
|
5826
|
+
}
|
|
5827
|
+
|
|
5809
5828
|
var style = '';
|
|
5810
5829
|
|
|
5811
5830
|
if (cell.style) {
|
|
5812
5831
|
style += cell.style;
|
|
5813
5832
|
}
|
|
5814
5833
|
|
|
5834
|
+
if (useWidths === true) {
|
|
5835
|
+
style += "max-width: ".concat(sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth, "px!important;");
|
|
5836
|
+
}
|
|
5837
|
+
|
|
5815
5838
|
if (cell.backgroundColor) {
|
|
5816
5839
|
style += "background-color: ".concat(cell.backgroundColor, "; ");
|
|
5817
5840
|
|
|
@@ -5824,7 +5847,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5824
5847
|
style += "color: ".concat(cell.color, "; ");
|
|
5825
5848
|
}
|
|
5826
5849
|
|
|
5827
|
-
|
|
5850
|
+
console.log('rowspan', cell.rowspan);
|
|
5851
|
+
bodyHtml += "<td \n class='websy-table-cell ".concat((cell.classes || []).join(' '), "'\n style='").concat(style, "'\n data-info='").concat(cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n "); // if (useWidths === true) {
|
|
5828
5852
|
// bodyHtml += `
|
|
5829
5853
|
// style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
|
|
5830
5854
|
// width='${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}'
|
|
@@ -5983,10 +6007,16 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5983
6007
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
5984
6008
|
return a + (b.width || b.actualWidth);
|
|
5985
6009
|
}, 0);
|
|
6010
|
+
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
|
|
6011
|
+
return i >= _this37.pinnedColumns;
|
|
6012
|
+
}).reduce(function (a, b) {
|
|
6013
|
+
return a + (b.width || b.actualWidth);
|
|
6014
|
+
}, 0);
|
|
5986
6015
|
var outerSize = outerEl.getBoundingClientRect();
|
|
5987
6016
|
|
|
5988
6017
|
if (this.sizes.totalWidth < outerSize.width) {
|
|
5989
6018
|
this.sizes.totalWidth = 0;
|
|
6019
|
+
this.sizes.totalNonPinnedWidth = 0;
|
|
5990
6020
|
var equalWidth = outerSize.width / this.options.columns[this.options.columns.length - 1].length;
|
|
5991
6021
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
5992
6022
|
if (!c.width) {
|
|
@@ -5997,6 +6027,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5997
6027
|
}
|
|
5998
6028
|
|
|
5999
6029
|
_this37.sizes.totalWidth += c.width || c.actualWidth;
|
|
6030
|
+
|
|
6031
|
+
if (i < _this37.pinnedColumns) {
|
|
6032
|
+
_this37.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6033
|
+
}
|
|
6034
|
+
|
|
6000
6035
|
equalWidth = (outerSize.width - _this37.sizes.totalWidth) / (_this37.options.columns[_this37.options.columns.length - 1].length - (i + 1));
|
|
6001
6036
|
});
|
|
6002
6037
|
} // take the height of the last cell as the official height for data cells
|
|
@@ -6018,10 +6053,14 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6018
6053
|
|
|
6019
6054
|
if (this.sizes.rowsToRender < this.totalRowCount) {
|
|
6020
6055
|
this.vScrollRequired = true;
|
|
6056
|
+
} else {
|
|
6057
|
+
this.vScrollRequired = false;
|
|
6021
6058
|
}
|
|
6022
6059
|
|
|
6023
6060
|
if (this.sizes.totalWidth > this.sizes.outer.width) {
|
|
6024
6061
|
this.hScrollRequired = true;
|
|
6062
|
+
} else {
|
|
6063
|
+
this.hScrollRequired = false;
|
|
6025
6064
|
}
|
|
6026
6065
|
|
|
6027
6066
|
this.options.allColumns = this.options.columns.map(function (c) {
|
|
@@ -6211,9 +6250,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6211
6250
|
if (this.hScrollRequired === true) {
|
|
6212
6251
|
hScrollEl.style.left = "".concat(this.sizes.table.width - this.sizes.scrollableWidth, "px");
|
|
6213
6252
|
hScrollEl.style.width = "".concat(this.sizes.scrollableWidth - 20, "px");
|
|
6214
|
-
hHandleEl.style.width = Math.max(this.options.minHandleSize, this.sizes.scrollableWidth * (this.sizes.scrollableWidth / this.sizes.
|
|
6253
|
+
hHandleEl.style.width = Math.max(this.options.minHandleSize, this.sizes.scrollableWidth * (this.sizes.scrollableWidth / this.sizes.totalNonPinnedWidth)) + 'px';
|
|
6215
6254
|
} else {
|
|
6216
|
-
hHandleEl.style.
|
|
6255
|
+
hHandleEl.style.width = '0px';
|
|
6217
6256
|
}
|
|
6218
6257
|
}
|
|
6219
6258
|
}
|
|
@@ -6254,8 +6293,6 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6254
6293
|
el.classList.add('has-error');
|
|
6255
6294
|
}
|
|
6256
6295
|
|
|
6257
|
-
var tableEl = document.getElementById("".concat(this.elementId, "_tableInner"));
|
|
6258
|
-
tableEl.classList.add('hidden');
|
|
6259
6296
|
var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
|
|
6260
6297
|
|
|
6261
6298
|
if (containerEl) {
|
|
@@ -6281,6 +6318,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6281
6318
|
}, {
|
|
6282
6319
|
key: "scrollX",
|
|
6283
6320
|
value: function scrollX(diff) {
|
|
6321
|
+
var el = document.getElementById("".concat(this.elementId, "_tableContainer"));
|
|
6322
|
+
|
|
6323
|
+
if (!el.classList.contains('scrolling')) {
|
|
6324
|
+
el.classList.add('scrolling');
|
|
6325
|
+
}
|
|
6326
|
+
|
|
6327
|
+
if (this.scrollTimeoutFn) {
|
|
6328
|
+
clearTimeout(this.scrollTimeoutFn);
|
|
6329
|
+
}
|
|
6330
|
+
|
|
6331
|
+
this.scrollTimeoutFn = setTimeout(function () {
|
|
6332
|
+
el.classList.remove('scrolling');
|
|
6333
|
+
}, 200);
|
|
6334
|
+
|
|
6335
|
+
if (this.hScrollRequired === false) {
|
|
6336
|
+
return;
|
|
6337
|
+
}
|
|
6338
|
+
|
|
6284
6339
|
var scrollContainerEl = document.getElementById("".concat(this.elementId, "_hScrollContainer"));
|
|
6285
6340
|
var scrollHandleEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
|
|
6286
6341
|
var handlePos;
|
|
@@ -6296,12 +6351,12 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6296
6351
|
scrollHandleEl.style.left = Math.min(scrollableSpace, Math.max(0, handlePos)) + 'px';
|
|
6297
6352
|
|
|
6298
6353
|
if (this.options.onScroll) {
|
|
6299
|
-
var actualLeft = (this.sizes.
|
|
6354
|
+
var actualLeft = (this.sizes.totalNonPinnedWidth - this.sizes.scrollableWidth) * (Math.min(scrollableSpace, Math.max(0, handlePos)) / scrollableSpace);
|
|
6300
6355
|
var cumulativeWidth = 0;
|
|
6301
6356
|
this.startCol = 0;
|
|
6302
6357
|
this.endCol = 0;
|
|
6303
6358
|
|
|
6304
|
-
for (var i =
|
|
6359
|
+
for (var i = this.pinnedColumns; i < this.options.allColumns[this.options.allColumns.length - 1].length; i++) {
|
|
6305
6360
|
cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth;
|
|
6306
6361
|
console.log('actualLeft', actualLeft, this.sizes.totalWidth, cumulativeWidth, cumulativeWidth + this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth);
|
|
6307
6362
|
|
|
@@ -6336,6 +6391,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6336
6391
|
}, {
|
|
6337
6392
|
key: "scrollY",
|
|
6338
6393
|
value: function scrollY(diff) {
|
|
6394
|
+
var el = document.getElementById("".concat(this.elementId, "_tableContainer"));
|
|
6395
|
+
|
|
6396
|
+
if (!el.classList.contains('scrolling')) {
|
|
6397
|
+
el.classList.add('scrolling');
|
|
6398
|
+
}
|
|
6399
|
+
|
|
6400
|
+
if (this.scrollTimeoutFn) {
|
|
6401
|
+
clearTimeout(this.scrollTimeoutFn);
|
|
6402
|
+
}
|
|
6403
|
+
|
|
6404
|
+
this.scrollTimeoutFn = setTimeout(function () {
|
|
6405
|
+
el.classList.remove('scrolling');
|
|
6406
|
+
}, 200);
|
|
6407
|
+
|
|
6408
|
+
if (this.vScrollRequired === false) {
|
|
6409
|
+
return;
|
|
6410
|
+
}
|
|
6411
|
+
|
|
6339
6412
|
var scrollContainerEl = document.getElementById("".concat(this.elementId, "_vScrollContainer"));
|
|
6340
6413
|
var scrollHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
|
|
6341
6414
|
var handlePos;
|
|
@@ -7322,11 +7395,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7322
7395
|
|
|
7323
7396
|
bars.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
7324
7397
|
bars.attr('width', getBarWidth.bind(this)).attr('height', getBarHeight.bind(this)).attr('x', getBarX.bind(this)).attr('y', getBarY.bind(this)).transition(this.transition).attr('fill', function (d) {
|
|
7325
|
-
return d.color || series.color;
|
|
7398
|
+
return d.y.color || d.color || series.color;
|
|
7326
7399
|
});
|
|
7327
7400
|
bars.enter().append('rect').attr('width', getBarWidth.bind(this)).attr('height', getBarHeight.bind(this)).attr('x', getBarX.bind(this)).attr('y', getBarY.bind(this)) // .transition(this.transition)
|
|
7328
7401
|
.attr('fill', function (d) {
|
|
7329
|
-
return d.color || series.color;
|
|
7402
|
+
return d.y.color || d.color || series.color;
|
|
7330
7403
|
}).attr('class', function (d) {
|
|
7331
7404
|
return "bar bar_".concat(series.key);
|
|
7332
7405
|
});
|
|
@@ -7346,20 +7419,36 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7346
7419
|
yAxis = 'bottomAxis';
|
|
7347
7420
|
}
|
|
7348
7421
|
|
|
7349
|
-
if (this.options.showLabels) {
|
|
7422
|
+
if (this.options.showLabels === true || series.showLabels === true) {
|
|
7350
7423
|
// need to add logic to handle positioning options
|
|
7351
7424
|
// e.g. Inside, Outide, Auto (this will also affect the available plot space)
|
|
7352
7425
|
// We currently only support 'Auto'
|
|
7353
7426
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
7354
7427
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
7355
|
-
labels.attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('class', "label_".concat(series.key)).
|
|
7356
|
-
return _this42.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.color || series.color);
|
|
7357
|
-
}).transition(this.transition).text(function (d) {
|
|
7428
|
+
labels.attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
7429
|
+
return _this42.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7430
|
+
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
7358
7431
|
return d.y.label || d.y.value;
|
|
7432
|
+
}).each(function (d, i) {
|
|
7433
|
+
if (that.options.orientation === 'horizontal') {
|
|
7434
|
+
if (that.options.grouping === 'stacked') {
|
|
7435
|
+
this.setAttribute('text-anchor', 'middle');
|
|
7436
|
+
} else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
|
|
7437
|
+
this.setAttribute('text-anchor', 'end');
|
|
7438
|
+
this.setAttribute('x', +this.getAttribute('x') - 8);
|
|
7439
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
|
|
7440
|
+
} else {
|
|
7441
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
|
|
7442
|
+
}
|
|
7443
|
+
} else {
|
|
7444
|
+
if (that.plotheight - getLabelX.call(that, d) < (that.options.labelSize || that.options.fontSize)) {
|
|
7445
|
+
this.setAttribute('y', +this.getAttribute('y') + 8);
|
|
7446
|
+
}
|
|
7447
|
+
}
|
|
7359
7448
|
});
|
|
7360
|
-
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').
|
|
7361
|
-
return _this42.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.color || series.color);
|
|
7362
|
-
}).text(function (d) {
|
|
7449
|
+
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
7450
|
+
return _this42.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7451
|
+
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
7363
7452
|
return d.y.label || d.y.value;
|
|
7364
7453
|
}).each(function (d, i) {
|
|
7365
7454
|
if (that.options.orientation === 'horizontal') {
|
|
@@ -7368,6 +7457,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7368
7457
|
} else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
|
|
7369
7458
|
this.setAttribute('text-anchor', 'end');
|
|
7370
7459
|
this.setAttribute('x', +this.getAttribute('x') - 8);
|
|
7460
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
|
|
7461
|
+
} else {
|
|
7462
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
|
|
7371
7463
|
}
|
|
7372
7464
|
} else {
|
|
7373
7465
|
if (that.plotheight - getLabelX.call(that, d) < (that.options.labelSize || that.options.fontSize)) {
|