@websy/websy-designs 1.3.0 → 1.3.2
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/helpers/v1/pdfHelper.js +13 -4
- package/dist/server/routes/v1/shop.js +52 -15
- package/dist/websy-designs-es6.debug.js +154 -62
- package/dist/websy-designs-es6.js +168 -60
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +154 -62
- package/dist/websy-designs.js +168 -60
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
package/dist/websy-designs.js
CHANGED
|
@@ -629,6 +629,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
629
629
|
var _this4 = this;
|
|
630
630
|
|
|
631
631
|
var isRange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
632
|
+
console.trace();
|
|
632
633
|
var maskEl = document.getElementById("".concat(this.elementId, "_mask"));
|
|
633
634
|
var contentEl = document.getElementById("".concat(this.elementId, "_content"));
|
|
634
635
|
var el = document.getElementById(this.elementId);
|
|
@@ -650,9 +651,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
650
651
|
hoursOut.push(this.options.hours[i]);
|
|
651
652
|
}
|
|
652
653
|
|
|
653
|
-
this.options.onChange(hoursOut, true);
|
|
654
|
+
this.options.onChange(hoursOut, true, this.selectedRange);
|
|
654
655
|
} else {
|
|
655
|
-
this.options.onChange(this.selectedRangeDates, true);
|
|
656
|
+
this.options.onChange(this.selectedRangeDates, true, this.selectedRange);
|
|
656
657
|
}
|
|
657
658
|
} else {
|
|
658
659
|
if (this.options.mode === 'hour') {
|
|
@@ -660,9 +661,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
660
661
|
return _this4.options.hours[h];
|
|
661
662
|
});
|
|
662
663
|
|
|
663
|
-
this.options.onChange(_hoursOut, true);
|
|
664
|
+
this.options.onChange(_hoursOut, true, this.selectedRange);
|
|
664
665
|
} else {
|
|
665
|
-
this.options.onChange(this.currentselection, isRange);
|
|
666
|
+
this.options.onChange(this.currentselection, isRange, this.selectedRange);
|
|
666
667
|
}
|
|
667
668
|
}
|
|
668
669
|
}
|
|
@@ -688,7 +689,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
688
689
|
} // d.setTime(d.getTime() + d.getTimezoneOffset() * 60000)
|
|
689
690
|
|
|
690
691
|
|
|
691
|
-
return new Date(d.
|
|
692
|
+
return new Date(d.setUTCHours(12, 0, 0, 0));
|
|
692
693
|
}
|
|
693
694
|
}, {
|
|
694
695
|
key: "handleClick",
|
|
@@ -828,9 +829,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
828
829
|
var rangeEnd = void 0;
|
|
829
830
|
|
|
830
831
|
if (this.options.mode === 'date') {
|
|
831
|
-
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + _i * this.oneDay));
|
|
832
|
-
|
|
833
|
-
d = d.getTime();
|
|
832
|
+
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + _i * this.oneDay)); // d.setUTCHours(12, 0, 0, 0)
|
|
833
|
+
|
|
834
|
+
d = d.getTime(); // console.log('highlighting', this.selectedRangeDates[0].getTime(), d)
|
|
835
|
+
|
|
834
836
|
rangeStart = this.selectedRangeDates[0].getTime();
|
|
835
837
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
836
838
|
} else if (this.options.mode === 'year') {
|
|
@@ -838,7 +840,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
838
840
|
rangeStart = this.selectedRangeDates[0];
|
|
839
841
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
|
|
840
842
|
} else if (this.options.mode === 'monthyear') {
|
|
841
|
-
d = new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + _i);
|
|
843
|
+
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + _i));
|
|
844
|
+
d = d.getTime();
|
|
845
|
+
console.log('highlighting', this.selectedRangeDates[0].getTime(), d);
|
|
842
846
|
rangeStart = this.selectedRangeDates[0].getTime();
|
|
843
847
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
844
848
|
} else if (this.options.mode === 'hour') {
|
|
@@ -885,9 +889,11 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
885
889
|
dateEl = document.getElementById("".concat(_this5.elementId, "_").concat(d, "_hour"));
|
|
886
890
|
}
|
|
887
891
|
|
|
888
|
-
dateEl
|
|
889
|
-
|
|
890
|
-
|
|
892
|
+
if (dateEl) {
|
|
893
|
+
dateEl.classList.add('selected');
|
|
894
|
+
dateEl.classList.add('first');
|
|
895
|
+
dateEl.classList.add('last');
|
|
896
|
+
}
|
|
891
897
|
});
|
|
892
898
|
}
|
|
893
899
|
}
|
|
@@ -1135,7 +1141,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1135
1141
|
|
|
1136
1142
|
html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-date-list'><ul>");
|
|
1137
1143
|
html += yearList.map(function (d) {
|
|
1138
|
-
return "<li id='".concat(_this6.elementId, "_").concat(d.id, "_year' class='websy-dp-date websy-dp-year ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.year, "</li>");
|
|
1144
|
+
return "<li id='".concat(_this6.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>");
|
|
1139
1145
|
}).join('');
|
|
1140
1146
|
html += "</ul></div>";
|
|
1141
1147
|
} else if (this.options.mode === 'monthyear') {
|
|
@@ -1155,7 +1161,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1155
1161
|
}
|
|
1156
1162
|
|
|
1157
1163
|
html += this.monthYears[year].map(function (d) {
|
|
1158
|
-
return "<li id='".concat(_this6.elementId, "_").concat(d.id, "_monthyear' data-year='").concat(d.year, "' class='websy-dp-date websy-dp-monthyear'>").concat(d.month, "</li>");
|
|
1164
|
+
return "<li id='".concat(_this6.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>");
|
|
1159
1165
|
}).join('');
|
|
1160
1166
|
html += "</ul>";
|
|
1161
1167
|
}
|
|
@@ -1263,16 +1269,6 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1263
1269
|
return d.getTime();
|
|
1264
1270
|
});
|
|
1265
1271
|
this.selectedRange = +index;
|
|
1266
|
-
var el = document.getElementById("".concat(this.elementId, "_header"));
|
|
1267
|
-
|
|
1268
|
-
if (el) {
|
|
1269
|
-
if (this.selectedRange === 0) {
|
|
1270
|
-
el.classList.remove('range-selected');
|
|
1271
|
-
} else {
|
|
1272
|
-
el.classList.add('range-selected');
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
1272
|
this.highlightRange();
|
|
1277
1273
|
this.updateRange();
|
|
1278
1274
|
this.close(confirm, true);
|
|
@@ -1284,16 +1280,17 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1284
1280
|
var _this8 = this;
|
|
1285
1281
|
|
|
1286
1282
|
this.selectedRange = -1;
|
|
1287
|
-
var isContinuousRange = true;
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
}
|
|
1283
|
+
var isContinuousRange = true; // if (rangeInput.length === 1) {
|
|
1284
|
+
// this.selectedRangeDates = [...rangeInput]
|
|
1285
|
+
// this.customRangeSelected = true
|
|
1286
|
+
// }
|
|
1287
|
+
// else if (rangeInput.length === 2) {
|
|
1288
|
+
// this.selectedRangeDates = [...rangeInput]
|
|
1289
|
+
// this.customRangeSelected = true
|
|
1290
|
+
// }
|
|
1296
1291
|
|
|
1292
|
+
this.selectedRangeDates = _toConsumableArray(rangeInput);
|
|
1293
|
+
this.customRangeSelected = true;
|
|
1297
1294
|
rangeInput.forEach(function (r, i) {
|
|
1298
1295
|
if (i > 0) {
|
|
1299
1296
|
if (_this8.options.mode === 'date' || _this8.options.mode === 'monthyear') {
|
|
@@ -1447,6 +1444,16 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1447
1444
|
if (labelEl) {
|
|
1448
1445
|
labelEl.innerHTML = range.label;
|
|
1449
1446
|
}
|
|
1447
|
+
|
|
1448
|
+
var headerEl = document.getElementById("".concat(this.elementId, "_header"));
|
|
1449
|
+
|
|
1450
|
+
if (headerEl) {
|
|
1451
|
+
if (this.selectedRange === 0) {
|
|
1452
|
+
headerEl.classList.remove('range-selected');
|
|
1453
|
+
} else {
|
|
1454
|
+
headerEl.classList.add('range-selected');
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1450
1457
|
}
|
|
1451
1458
|
}]);
|
|
1452
1459
|
|
|
@@ -1981,7 +1988,8 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
1981
1988
|
var DEFAULTS = {
|
|
1982
1989
|
items: [],
|
|
1983
1990
|
orientation: 'horizontal',
|
|
1984
|
-
dropPlaceholder: 'Drop item here'
|
|
1991
|
+
dropPlaceholder: 'Drop item here',
|
|
1992
|
+
accepts: 'application/wd-item'
|
|
1985
1993
|
};
|
|
1986
1994
|
this.busy = false;
|
|
1987
1995
|
this.options = _extends({}, DEFAULTS, options);
|
|
@@ -2047,7 +2055,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
2047
2055
|
item.id = WebsyDesigns.Utils.createIdentity();
|
|
2048
2056
|
}
|
|
2049
2057
|
|
|
2050
|
-
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 ");
|
|
2058
|
+
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 ");
|
|
2051
2059
|
|
|
2052
2060
|
if (item.component) {
|
|
2053
2061
|
html += "<div id='".concat(item.id, "_component'></div>");
|
|
@@ -2077,27 +2085,32 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
2077
2085
|
value: function handleDragStart(event) {
|
|
2078
2086
|
this.draggedId = event.target.getAttribute('data-id');
|
|
2079
2087
|
event.dataTransfer.effectAllowed = 'move';
|
|
2080
|
-
event.dataTransfer.setData(
|
|
2088
|
+
event.dataTransfer.setData(this.options.accepts, JSON.stringify({
|
|
2081
2089
|
el: event.target.id,
|
|
2082
2090
|
id: this.elementId,
|
|
2083
2091
|
itemId: this.draggedId
|
|
2084
|
-
}));
|
|
2092
|
+
}));
|
|
2093
|
+
event.target.classList.add('dragging'); // event.target.style.opacity = 0.5
|
|
2085
2094
|
|
|
2086
|
-
event.target.style.opacity = 0.5;
|
|
2087
2095
|
this.dragging = true;
|
|
2088
2096
|
}
|
|
2089
2097
|
}, {
|
|
2090
2098
|
key: "handleDragOver",
|
|
2091
2099
|
value: function handleDragOver(event) {
|
|
2092
|
-
// console.log('drag over', event.target.classList)
|
|
2093
2100
|
if (event.preventDefault) {
|
|
2094
2101
|
event.preventDefault();
|
|
2095
2102
|
}
|
|
2096
2103
|
|
|
2104
|
+
console.log('drag', event.target.classList);
|
|
2105
|
+
|
|
2097
2106
|
if (!event.target.classList.contains('droppable')) {
|
|
2098
2107
|
return;
|
|
2099
2108
|
}
|
|
2100
2109
|
|
|
2110
|
+
if (event.dataTransfer.types.indexOf(this.options.accepts) === -1) {
|
|
2111
|
+
return;
|
|
2112
|
+
}
|
|
2113
|
+
|
|
2101
2114
|
event.target.classList.add('drag-over');
|
|
2102
2115
|
}
|
|
2103
2116
|
}, {
|
|
@@ -2117,8 +2130,8 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
2117
2130
|
key: "handleDrop",
|
|
2118
2131
|
value: function handleDrop(event) {
|
|
2119
2132
|
// console.log('drag drop')
|
|
2120
|
-
// console.log(event.dataTransfer.getData('application/wd-item'))
|
|
2121
|
-
var data = JSON.parse(event.dataTransfer.getData(
|
|
2133
|
+
// console.log(event.dataTransfer.getData('application/wd-item'))
|
|
2134
|
+
var data = JSON.parse(event.dataTransfer.getData(this.options.accepts));
|
|
2122
2135
|
|
|
2123
2136
|
if (event.preventDefault) {
|
|
2124
2137
|
event.preventDefault();
|
|
@@ -2128,6 +2141,10 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
2128
2141
|
return;
|
|
2129
2142
|
}
|
|
2130
2143
|
|
|
2144
|
+
if (event.dataTransfer.types.indexOf(this.options.accepts) === -1) {
|
|
2145
|
+
return;
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2131
2148
|
var side = event.target.getAttribute('data-side');
|
|
2132
2149
|
var id = event.target.getAttribute('data-id');
|
|
2133
2150
|
var index = this.getItemIndex(id);
|
|
@@ -2185,6 +2202,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
2185
2202
|
value: function handleDragEnd(event) {
|
|
2186
2203
|
// console.log('drag end')
|
|
2187
2204
|
event.target.style.opacity = 1;
|
|
2205
|
+
event.target.classList.remove('dragging');
|
|
2188
2206
|
this.draggedId = null;
|
|
2189
2207
|
this.dragging = false;
|
|
2190
2208
|
var startEl = document.getElementById("".concat(this.elementId, "start_item"));
|
|
@@ -6200,12 +6218,20 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6200
6218
|
data.forEach(function (row) {
|
|
6201
6219
|
bodyHtml += "<tr class=\"websy-table-row\">";
|
|
6202
6220
|
row.forEach(function (cell, cellIndex) {
|
|
6221
|
+
if (typeof sizingColumns[cellIndex] === 'undefined') {
|
|
6222
|
+
return; // need to revisit this logic
|
|
6223
|
+
}
|
|
6224
|
+
|
|
6203
6225
|
var style = '';
|
|
6204
6226
|
|
|
6205
6227
|
if (cell.style) {
|
|
6206
6228
|
style += cell.style;
|
|
6207
6229
|
}
|
|
6208
6230
|
|
|
6231
|
+
if (useWidths === true) {
|
|
6232
|
+
style += "max-width: ".concat(sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth, "px!important;");
|
|
6233
|
+
}
|
|
6234
|
+
|
|
6209
6235
|
if (cell.backgroundColor) {
|
|
6210
6236
|
style += "background-color: ".concat(cell.backgroundColor, "; ");
|
|
6211
6237
|
|
|
@@ -6218,7 +6244,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6218
6244
|
style += "color: ".concat(cell.color, "; ");
|
|
6219
6245
|
}
|
|
6220
6246
|
|
|
6221
|
-
|
|
6247
|
+
console.log('rowspan', cell.rowspan);
|
|
6248
|
+
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) {
|
|
6222
6249
|
// bodyHtml += `
|
|
6223
6250
|
// style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
|
|
6224
6251
|
// width='${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}'
|
|
@@ -6377,10 +6404,16 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6377
6404
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
6378
6405
|
return a + (b.width || b.actualWidth);
|
|
6379
6406
|
}, 0);
|
|
6407
|
+
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
|
|
6408
|
+
return i >= _this40.pinnedColumns;
|
|
6409
|
+
}).reduce(function (a, b) {
|
|
6410
|
+
return a + (b.width || b.actualWidth);
|
|
6411
|
+
}, 0);
|
|
6380
6412
|
var outerSize = outerEl.getBoundingClientRect();
|
|
6381
6413
|
|
|
6382
6414
|
if (this.sizes.totalWidth < outerSize.width) {
|
|
6383
6415
|
this.sizes.totalWidth = 0;
|
|
6416
|
+
this.sizes.totalNonPinnedWidth = 0;
|
|
6384
6417
|
var equalWidth = outerSize.width / this.options.columns[this.options.columns.length - 1].length;
|
|
6385
6418
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6386
6419
|
if (!c.width) {
|
|
@@ -6391,6 +6424,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6391
6424
|
}
|
|
6392
6425
|
|
|
6393
6426
|
_this40.sizes.totalWidth += c.width || c.actualWidth;
|
|
6427
|
+
|
|
6428
|
+
if (i < _this40.pinnedColumns) {
|
|
6429
|
+
_this40.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6430
|
+
}
|
|
6431
|
+
|
|
6394
6432
|
equalWidth = (outerSize.width - _this40.sizes.totalWidth) / (_this40.options.columns[_this40.options.columns.length - 1].length - (i + 1));
|
|
6395
6433
|
});
|
|
6396
6434
|
} // take the height of the last cell as the official height for data cells
|
|
@@ -6412,10 +6450,14 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6412
6450
|
|
|
6413
6451
|
if (this.sizes.rowsToRender < this.totalRowCount) {
|
|
6414
6452
|
this.vScrollRequired = true;
|
|
6453
|
+
} else {
|
|
6454
|
+
this.vScrollRequired = false;
|
|
6415
6455
|
}
|
|
6416
6456
|
|
|
6417
6457
|
if (this.sizes.totalWidth > this.sizes.outer.width) {
|
|
6418
6458
|
this.hScrollRequired = true;
|
|
6459
|
+
} else {
|
|
6460
|
+
this.hScrollRequired = false;
|
|
6419
6461
|
}
|
|
6420
6462
|
|
|
6421
6463
|
this.options.allColumns = this.options.columns.map(function (c) {
|
|
@@ -6605,9 +6647,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6605
6647
|
if (this.hScrollRequired === true) {
|
|
6606
6648
|
hScrollEl.style.left = "".concat(this.sizes.table.width - this.sizes.scrollableWidth, "px");
|
|
6607
6649
|
hScrollEl.style.width = "".concat(this.sizes.scrollableWidth - 20, "px");
|
|
6608
|
-
hHandleEl.style.width = Math.max(this.options.minHandleSize, this.sizes.scrollableWidth * (this.sizes.scrollableWidth / this.sizes.
|
|
6650
|
+
hHandleEl.style.width = Math.max(this.options.minHandleSize, this.sizes.scrollableWidth * (this.sizes.scrollableWidth / this.sizes.totalNonPinnedWidth)) + 'px';
|
|
6609
6651
|
} else {
|
|
6610
|
-
hHandleEl.style.
|
|
6652
|
+
hHandleEl.style.width = '0px';
|
|
6611
6653
|
}
|
|
6612
6654
|
}
|
|
6613
6655
|
}
|
|
@@ -6648,8 +6690,6 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6648
6690
|
el.classList.add('has-error');
|
|
6649
6691
|
}
|
|
6650
6692
|
|
|
6651
|
-
var tableEl = document.getElementById("".concat(this.elementId, "_tableInner"));
|
|
6652
|
-
tableEl.classList.add('hidden');
|
|
6653
6693
|
var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
|
|
6654
6694
|
|
|
6655
6695
|
if (containerEl) {
|
|
@@ -6675,6 +6715,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6675
6715
|
}, {
|
|
6676
6716
|
key: "scrollX",
|
|
6677
6717
|
value: function scrollX(diff) {
|
|
6718
|
+
var el = document.getElementById("".concat(this.elementId, "_tableContainer"));
|
|
6719
|
+
|
|
6720
|
+
if (!el.classList.contains('scrolling')) {
|
|
6721
|
+
el.classList.add('scrolling');
|
|
6722
|
+
}
|
|
6723
|
+
|
|
6724
|
+
if (this.scrollTimeoutFn) {
|
|
6725
|
+
clearTimeout(this.scrollTimeoutFn);
|
|
6726
|
+
}
|
|
6727
|
+
|
|
6728
|
+
this.scrollTimeoutFn = setTimeout(function () {
|
|
6729
|
+
el.classList.remove('scrolling');
|
|
6730
|
+
}, 200);
|
|
6731
|
+
|
|
6732
|
+
if (this.hScrollRequired === false) {
|
|
6733
|
+
return;
|
|
6734
|
+
}
|
|
6735
|
+
|
|
6678
6736
|
var scrollContainerEl = document.getElementById("".concat(this.elementId, "_hScrollContainer"));
|
|
6679
6737
|
var scrollHandleEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
|
|
6680
6738
|
var handlePos;
|
|
@@ -6690,12 +6748,12 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6690
6748
|
scrollHandleEl.style.left = Math.min(scrollableSpace, Math.max(0, handlePos)) + 'px';
|
|
6691
6749
|
|
|
6692
6750
|
if (this.options.onScroll) {
|
|
6693
|
-
var actualLeft = (this.sizes.
|
|
6751
|
+
var actualLeft = (this.sizes.totalNonPinnedWidth - this.sizes.scrollableWidth) * (Math.min(scrollableSpace, Math.max(0, handlePos)) / scrollableSpace);
|
|
6694
6752
|
var cumulativeWidth = 0;
|
|
6695
6753
|
this.startCol = 0;
|
|
6696
6754
|
this.endCol = 0;
|
|
6697
6755
|
|
|
6698
|
-
for (var i =
|
|
6756
|
+
for (var i = this.pinnedColumns; i < this.options.allColumns[this.options.allColumns.length - 1].length; i++) {
|
|
6699
6757
|
cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth;
|
|
6700
6758
|
console.log('actualLeft', actualLeft, this.sizes.totalWidth, cumulativeWidth, cumulativeWidth + this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth);
|
|
6701
6759
|
|
|
@@ -6730,6 +6788,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6730
6788
|
}, {
|
|
6731
6789
|
key: "scrollY",
|
|
6732
6790
|
value: function scrollY(diff) {
|
|
6791
|
+
var el = document.getElementById("".concat(this.elementId, "_tableContainer"));
|
|
6792
|
+
|
|
6793
|
+
if (!el.classList.contains('scrolling')) {
|
|
6794
|
+
el.classList.add('scrolling');
|
|
6795
|
+
}
|
|
6796
|
+
|
|
6797
|
+
if (this.scrollTimeoutFn) {
|
|
6798
|
+
clearTimeout(this.scrollTimeoutFn);
|
|
6799
|
+
}
|
|
6800
|
+
|
|
6801
|
+
this.scrollTimeoutFn = setTimeout(function () {
|
|
6802
|
+
el.classList.remove('scrolling');
|
|
6803
|
+
}, 200);
|
|
6804
|
+
|
|
6805
|
+
if (this.vScrollRequired === false) {
|
|
6806
|
+
return;
|
|
6807
|
+
}
|
|
6808
|
+
|
|
6733
6809
|
var scrollContainerEl = document.getElementById("".concat(this.elementId, "_vScrollContainer"));
|
|
6734
6810
|
var scrollHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
|
|
6735
6811
|
var handlePos;
|
|
@@ -7716,11 +7792,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7716
7792
|
|
|
7717
7793
|
bars.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
7718
7794
|
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) {
|
|
7719
|
-
return d.color || series.color;
|
|
7795
|
+
return d.y.color || d.color || series.color;
|
|
7720
7796
|
});
|
|
7721
7797
|
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)
|
|
7722
7798
|
.attr('fill', function (d) {
|
|
7723
|
-
return d.color || series.color;
|
|
7799
|
+
return d.y.color || d.color || series.color;
|
|
7724
7800
|
}).attr('class', function (d) {
|
|
7725
7801
|
return "bar bar_".concat(series.key);
|
|
7726
7802
|
});
|
|
@@ -7740,28 +7816,55 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7740
7816
|
yAxis = 'bottomAxis';
|
|
7741
7817
|
}
|
|
7742
7818
|
|
|
7743
|
-
if (this.options.showLabels) {
|
|
7819
|
+
if (this.options.showLabels === true || series.showLabels === true) {
|
|
7744
7820
|
// need to add logic to handle positioning options
|
|
7745
7821
|
// e.g. Inside, Outide, Auto (this will also affect the available plot space)
|
|
7746
7822
|
// We currently only support 'Auto'
|
|
7747
7823
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
7748
7824
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
7749
|
-
labels.attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('class', "label_".concat(series.key)).
|
|
7750
|
-
return _this45.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.color || series.color);
|
|
7751
|
-
}).transition(this.transition).text(function (d) {
|
|
7825
|
+
labels.attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
7826
|
+
return _this45.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7827
|
+
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
7752
7828
|
return d.y.label || d.y.value;
|
|
7829
|
+
}).each(function (d, i) {
|
|
7830
|
+
if (that.options.orientation === 'horizontal') {
|
|
7831
|
+
if (that.options.grouping === 'stacked' && series.labelPosition !== 'outside') {
|
|
7832
|
+
this.setAttribute('text-anchor', 'middle');
|
|
7833
|
+
} else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
|
|
7834
|
+
this.setAttribute('text-anchor', 'end');
|
|
7835
|
+
this.setAttribute('x', +this.getAttribute('x') - 8);
|
|
7836
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
|
|
7837
|
+
} else if (series.labelPosition === 'outside') {
|
|
7838
|
+
this.setAttribute('text-anchor', 'start');
|
|
7839
|
+
this.setAttribute('x', +this.getAttribute('x') + 8);
|
|
7840
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
|
|
7841
|
+
} else {
|
|
7842
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
|
|
7843
|
+
}
|
|
7844
|
+
} else {
|
|
7845
|
+
if (that.plotheight - getLabelX.call(that, d) < (that.options.labelSize || that.options.fontSize)) {
|
|
7846
|
+
this.setAttribute('y', +this.getAttribute('y') + 8);
|
|
7847
|
+
}
|
|
7848
|
+
}
|
|
7753
7849
|
});
|
|
7754
|
-
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').
|
|
7755
|
-
return _this45.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.color || series.color);
|
|
7756
|
-
}).text(function (d) {
|
|
7850
|
+
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) {
|
|
7851
|
+
return _this45.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7852
|
+
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
7757
7853
|
return d.y.label || d.y.value;
|
|
7758
7854
|
}).each(function (d, i) {
|
|
7759
7855
|
if (that.options.orientation === 'horizontal') {
|
|
7760
|
-
if (that.options.grouping === 'stacked') {
|
|
7856
|
+
if (that.options.grouping === 'stacked' && series.labelPosition !== 'outside') {
|
|
7761
7857
|
this.setAttribute('text-anchor', 'middle');
|
|
7762
7858
|
} else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
|
|
7763
7859
|
this.setAttribute('text-anchor', 'end');
|
|
7764
7860
|
this.setAttribute('x', +this.getAttribute('x') - 8);
|
|
7861
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
|
|
7862
|
+
} else if (series.labelPosition === 'outside') {
|
|
7863
|
+
this.setAttribute('text-anchor', 'start');
|
|
7864
|
+
this.setAttribute('x', +this.getAttribute('x') + 8);
|
|
7865
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
|
|
7866
|
+
} else {
|
|
7867
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
|
|
7765
7868
|
}
|
|
7766
7869
|
} else {
|
|
7767
7870
|
if (that.plotheight - getLabelX.call(that, d) < (that.options.labelSize || that.options.fontSize)) {
|
|
@@ -7772,9 +7875,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7772
7875
|
}
|
|
7773
7876
|
|
|
7774
7877
|
function getLabelX(d) {
|
|
7878
|
+
var labelPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'inside';
|
|
7879
|
+
|
|
7775
7880
|
if (this.options.orientation === 'horizontal') {
|
|
7776
7881
|
if (this.options.grouping === 'stacked') {
|
|
7777
|
-
return this[yAxis](d.y.accumulative) + this[yAxis](d.y.value) / 2;
|
|
7882
|
+
return this[yAxis](d.y.accumulative) + this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1);
|
|
7778
7883
|
} else {
|
|
7779
7884
|
return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) + 4;
|
|
7780
7885
|
}
|
|
@@ -7784,10 +7889,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7784
7889
|
}
|
|
7785
7890
|
|
|
7786
7891
|
function getLabelY(d) {
|
|
7892
|
+
var labelPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'inside';
|
|
7893
|
+
|
|
7787
7894
|
if (this.options.orientation === 'horizontal') {
|
|
7788
7895
|
return this[xAxis](this.parseX(d.x.value)) + this[xAxis].bandwidth() / 2;
|
|
7789
7896
|
} else {
|
|
7790
|
-
if (this.options.grouping === 'stacked') {
|
|
7897
|
+
if (this.options.grouping === 'stacked') {
|
|
7898
|
+
return this[yAxis](d.y.accumulative) + this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1);
|
|
7791
7899
|
} else {
|
|
7792
7900
|
return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) - 4;
|
|
7793
7901
|
}
|