@websy/websy-designs 1.2.33 → 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/helpers/v1/pgHelper.js +13 -5
- package/dist/server/routes/v1/api.js +11 -1
- package/dist/server/routes/v1/shop.js +52 -15
- package/dist/websy-designs-es6.debug.js +253 -107
- package/dist/websy-designs-es6.js +461 -293
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +306 -108
- package/dist/websy-designs.js +410 -186
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/index.js +1 -0
- package/package.json +1 -1
package/dist/websy-designs.js
CHANGED
|
@@ -53,6 +53,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
53
53
|
WebsySignup
|
|
54
54
|
ResponsiveText
|
|
55
55
|
WebsyDragDrop
|
|
56
|
+
WebsySearch
|
|
56
57
|
Pager
|
|
57
58
|
*/
|
|
58
59
|
|
|
@@ -628,6 +629,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
628
629
|
var _this4 = this;
|
|
629
630
|
|
|
630
631
|
var isRange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
632
|
+
console.trace();
|
|
631
633
|
var maskEl = document.getElementById("".concat(this.elementId, "_mask"));
|
|
632
634
|
var contentEl = document.getElementById("".concat(this.elementId, "_content"));
|
|
633
635
|
var el = document.getElementById(this.elementId);
|
|
@@ -649,9 +651,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
649
651
|
hoursOut.push(this.options.hours[i]);
|
|
650
652
|
}
|
|
651
653
|
|
|
652
|
-
this.options.onChange(hoursOut, true);
|
|
654
|
+
this.options.onChange(hoursOut, true, this.selectedRange);
|
|
653
655
|
} else {
|
|
654
|
-
this.options.onChange(this.selectedRangeDates, true);
|
|
656
|
+
this.options.onChange(this.selectedRangeDates, true, this.selectedRange);
|
|
655
657
|
}
|
|
656
658
|
} else {
|
|
657
659
|
if (this.options.mode === 'hour') {
|
|
@@ -659,9 +661,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
659
661
|
return _this4.options.hours[h];
|
|
660
662
|
});
|
|
661
663
|
|
|
662
|
-
this.options.onChange(_hoursOut, true);
|
|
664
|
+
this.options.onChange(_hoursOut, true, this.selectedRange);
|
|
663
665
|
} else {
|
|
664
|
-
this.options.onChange(this.currentselection, isRange);
|
|
666
|
+
this.options.onChange(this.currentselection, isRange, this.selectedRange);
|
|
665
667
|
}
|
|
666
668
|
}
|
|
667
669
|
}
|
|
@@ -684,9 +686,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
684
686
|
value: function floorDate(d) {
|
|
685
687
|
if (typeof d === 'number') {
|
|
686
688
|
d = new Date(d);
|
|
687
|
-
}
|
|
689
|
+
} // d.setTime(d.getTime() + d.getTimezoneOffset() * 60000)
|
|
690
|
+
|
|
688
691
|
|
|
689
|
-
return new Date(d.
|
|
692
|
+
return new Date(d.setUTCHours(12, 0, 0, 0));
|
|
690
693
|
}
|
|
691
694
|
}, {
|
|
692
695
|
key: "handleClick",
|
|
@@ -703,11 +706,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
703
706
|
var index = event.target.getAttribute('data-index');
|
|
704
707
|
this.selectRange(index);
|
|
705
708
|
this.updateRange(index);
|
|
706
|
-
} else if (event.target.classList.contains('websy-dp-date')) {//
|
|
707
|
-
// return
|
|
708
|
-
// }
|
|
709
|
-
// const timestamp = event.target.id.split('_')[0]
|
|
710
|
-
// this.selectDate(+timestamp)
|
|
709
|
+
} else if (event.target.classList.contains('websy-dp-date')) {//
|
|
711
710
|
} else if (event.target.classList.contains('websy-dp-confirm')) {
|
|
712
711
|
this.close(true);
|
|
713
712
|
} else if (event.target.classList.contains('websy-dp-cancel')) {
|
|
@@ -741,7 +740,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
741
740
|
value: function handleMouseDown(event) {
|
|
742
741
|
if (this.shiftPressed === true && this.currentselection.length > 0) {
|
|
743
742
|
this.mouseDownId = this.currentselection[this.currentselection.length - 1];
|
|
744
|
-
|
|
743
|
+
var dateId = event.target.getAttribute('data-id');
|
|
744
|
+
this.selectDate(+dateId);
|
|
745
745
|
} else {
|
|
746
746
|
this.mouseDown = true;
|
|
747
747
|
this.dragging = false;
|
|
@@ -756,7 +756,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
756
756
|
this.customRangeSelected = false;
|
|
757
757
|
}
|
|
758
758
|
|
|
759
|
-
this.mouseDownId = +event.target.
|
|
759
|
+
this.mouseDownId = +event.target.getAttribute('data-id');
|
|
760
760
|
this.selectDate(this.mouseDownId);
|
|
761
761
|
}
|
|
762
762
|
}
|
|
@@ -770,9 +770,11 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
770
770
|
return;
|
|
771
771
|
}
|
|
772
772
|
|
|
773
|
-
|
|
773
|
+
var dateId = +event.target.getAttribute('data-id');
|
|
774
|
+
|
|
775
|
+
if (dateId !== this.mouseDownId) {
|
|
774
776
|
this.dragging = true;
|
|
775
|
-
this.selectDate(
|
|
777
|
+
this.selectDate(dateId);
|
|
776
778
|
}
|
|
777
779
|
}
|
|
778
780
|
}
|
|
@@ -828,6 +830,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
828
830
|
|
|
829
831
|
if (this.options.mode === 'date') {
|
|
830
832
|
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + _i * this.oneDay));
|
|
833
|
+
d.setUTCHours(12, 0, 0, 0);
|
|
831
834
|
d = d.getTime();
|
|
832
835
|
rangeStart = this.selectedRangeDates[0].getTime();
|
|
833
836
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
@@ -883,9 +886,11 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
883
886
|
dateEl = document.getElementById("".concat(_this5.elementId, "_").concat(d, "_hour"));
|
|
884
887
|
}
|
|
885
888
|
|
|
886
|
-
dateEl
|
|
887
|
-
|
|
888
|
-
|
|
889
|
+
if (dateEl) {
|
|
890
|
+
dateEl.classList.add('selected');
|
|
891
|
+
dateEl.classList.add('first');
|
|
892
|
+
dateEl.classList.add('last');
|
|
893
|
+
}
|
|
889
894
|
});
|
|
890
895
|
}
|
|
891
896
|
}
|
|
@@ -1120,7 +1125,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1120
1125
|
}
|
|
1121
1126
|
|
|
1122
1127
|
html += months[key].map(function (d) {
|
|
1123
|
-
return "<li id='".concat(_this6.elementId, "_").concat(d.id, "_date' class='websy-dp-date ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.dayOfMonth, "</li>");
|
|
1128
|
+
return "<li id='".concat(_this6.elementId, "_").concat(d.id, "_date' data-id='").concat(d.id, "' class='websy-dp-date ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.dayOfMonth, "</li>");
|
|
1124
1129
|
}).join('');
|
|
1125
1130
|
html += "\n </ul>\n </div>\n ";
|
|
1126
1131
|
}
|
|
@@ -1133,7 +1138,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1133
1138
|
|
|
1134
1139
|
html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-date-list'><ul>");
|
|
1135
1140
|
html += yearList.map(function (d) {
|
|
1136
|
-
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>");
|
|
1141
|
+
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>");
|
|
1137
1142
|
}).join('');
|
|
1138
1143
|
html += "</ul></div>";
|
|
1139
1144
|
} else if (this.options.mode === 'monthyear') {
|
|
@@ -1153,7 +1158,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1153
1158
|
}
|
|
1154
1159
|
|
|
1155
1160
|
html += this.monthYears[year].map(function (d) {
|
|
1156
|
-
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>");
|
|
1161
|
+
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>");
|
|
1157
1162
|
}).join('');
|
|
1158
1163
|
html += "</ul>";
|
|
1159
1164
|
}
|
|
@@ -1257,18 +1262,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1257
1262
|
|
|
1258
1263
|
if (this.options.ranges[this.options.mode][index]) {
|
|
1259
1264
|
this.selectedRangeDates = _toConsumableArray(this.options.ranges[this.options.mode][index].range);
|
|
1260
|
-
this.currentselection =
|
|
1265
|
+
this.currentselection = this.options.ranges[this.options.mode][index].range.map(function (d) {
|
|
1266
|
+
return d.getTime();
|
|
1267
|
+
});
|
|
1261
1268
|
this.selectedRange = +index;
|
|
1262
|
-
var el = document.getElementById("".concat(this.elementId, "_header"));
|
|
1263
|
-
|
|
1264
|
-
if (el) {
|
|
1265
|
-
if (this.selectedRange === 0) {
|
|
1266
|
-
el.classList.remove('range-selected');
|
|
1267
|
-
} else {
|
|
1268
|
-
el.classList.add('range-selected');
|
|
1269
|
-
}
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
1269
|
this.highlightRange();
|
|
1273
1270
|
this.updateRange();
|
|
1274
1271
|
this.close(confirm, true);
|
|
@@ -1280,16 +1277,17 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1280
1277
|
var _this8 = this;
|
|
1281
1278
|
|
|
1282
1279
|
this.selectedRange = -1;
|
|
1283
|
-
var isContinuousRange = true;
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
}
|
|
1280
|
+
var isContinuousRange = true; // if (rangeInput.length === 1) {
|
|
1281
|
+
// this.selectedRangeDates = [...rangeInput]
|
|
1282
|
+
// this.customRangeSelected = true
|
|
1283
|
+
// }
|
|
1284
|
+
// else if (rangeInput.length === 2) {
|
|
1285
|
+
// this.selectedRangeDates = [...rangeInput]
|
|
1286
|
+
// this.customRangeSelected = true
|
|
1287
|
+
// }
|
|
1292
1288
|
|
|
1289
|
+
this.selectedRangeDates = _toConsumableArray(rangeInput);
|
|
1290
|
+
this.customRangeSelected = true;
|
|
1293
1291
|
rangeInput.forEach(function (r, i) {
|
|
1294
1292
|
if (i > 0) {
|
|
1295
1293
|
if (_this8.options.mode === 'date' || _this8.options.mode === 'monthyear') {
|
|
@@ -1443,6 +1441,16 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1443
1441
|
if (labelEl) {
|
|
1444
1442
|
labelEl.innerHTML = range.label;
|
|
1445
1443
|
}
|
|
1444
|
+
|
|
1445
|
+
var headerEl = document.getElementById("".concat(this.elementId, "_header"));
|
|
1446
|
+
|
|
1447
|
+
if (headerEl) {
|
|
1448
|
+
if (this.selectedRange === 0) {
|
|
1449
|
+
headerEl.classList.remove('range-selected');
|
|
1450
|
+
} else {
|
|
1451
|
+
headerEl.classList.add('range-selected');
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1446
1454
|
}
|
|
1447
1455
|
}]);
|
|
1448
1456
|
|
|
@@ -1813,14 +1821,17 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1813
1821
|
}, {
|
|
1814
1822
|
key: "updateHeader",
|
|
1815
1823
|
value: function updateHeader(item) {
|
|
1816
|
-
var _this12 = this;
|
|
1817
|
-
|
|
1818
1824
|
var el = document.getElementById(this.elementId);
|
|
1819
1825
|
var headerEl = document.getElementById("".concat(this.elementId, "_header"));
|
|
1820
1826
|
var headerLabelEl = document.getElementById("".concat(this.elementId, "_headerLabel"));
|
|
1821
1827
|
var labelEl = document.getElementById("".concat(this.elementId, "_selectedItems"));
|
|
1822
1828
|
var inputEl = document.getElementById("".concat(this.elementId, "_input"));
|
|
1823
1829
|
var itemEls = el.querySelectorAll(".websy-dropdown-item");
|
|
1830
|
+
var dataToUse = this._originalData;
|
|
1831
|
+
|
|
1832
|
+
if (this.options.onSearch) {
|
|
1833
|
+
dataToUse = this.options.items;
|
|
1834
|
+
}
|
|
1824
1835
|
|
|
1825
1836
|
for (var i = 0; i < itemEls.length; i++) {
|
|
1826
1837
|
itemEls[i].classList.remove('active');
|
|
@@ -1860,17 +1871,17 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1860
1871
|
} else if (this.selectedItems.length > 1) {
|
|
1861
1872
|
if (this.options.showCompleteSelectedList === true) {
|
|
1862
1873
|
var selectedLabels = this.selectedItems.map(function (s) {
|
|
1863
|
-
return
|
|
1874
|
+
return dataToUse[s].label || dataToUse[s].value;
|
|
1864
1875
|
}).join(this.options.multiValueDelimiter);
|
|
1865
1876
|
var selectedValues = this.selectedItems.map(function (s) {
|
|
1866
|
-
return
|
|
1877
|
+
return dataToUse[s].value || dataToUse[s].label;
|
|
1867
1878
|
}).join(this.options.multiValueDelimiter);
|
|
1868
1879
|
labelEl.innerHTML = selectedLabels;
|
|
1869
1880
|
labelEl.setAttribute('data-info', selectedLabels);
|
|
1870
1881
|
inputEl.value = selectedValues;
|
|
1871
1882
|
} else {
|
|
1872
1883
|
var _selectedValues = this.selectedItems.map(function (s) {
|
|
1873
|
-
return
|
|
1884
|
+
return dataToUse[s].value || dataToUse[s].label;
|
|
1874
1885
|
}).join(this.options.multiValueDelimiter);
|
|
1875
1886
|
|
|
1876
1887
|
labelEl.innerHTML = "".concat(this.selectedItems.length, " selected");
|
|
@@ -1887,6 +1898,12 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1887
1898
|
}, {
|
|
1888
1899
|
key: "updateSelected",
|
|
1889
1900
|
value: function updateSelected(index) {
|
|
1901
|
+
var dataToUse = this._originalData && this._originalData.length > 0 ? this._originalData : this.options.items;
|
|
1902
|
+
|
|
1903
|
+
if (this.options.onSearch) {
|
|
1904
|
+
dataToUse = this.options.items;
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1890
1907
|
if (typeof index !== 'undefined' && index !== null) {
|
|
1891
1908
|
var pos = this.selectedItems.indexOf(index);
|
|
1892
1909
|
|
|
@@ -1902,11 +1919,11 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1902
1919
|
} // const item = this.options.items[index]
|
|
1903
1920
|
|
|
1904
1921
|
|
|
1905
|
-
var item =
|
|
1922
|
+
var item = dataToUse[index];
|
|
1906
1923
|
this.updateHeader(item);
|
|
1907
1924
|
|
|
1908
1925
|
if (item && this.options.onItemSelected) {
|
|
1909
|
-
this.options.onItemSelected(item, this.selectedItems,
|
|
1926
|
+
this.options.onItemSelected(item, this.selectedItems, dataToUse, this.options);
|
|
1910
1927
|
}
|
|
1911
1928
|
|
|
1912
1929
|
if (this.options.closeAfterSelection === true) {
|
|
@@ -1926,6 +1943,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1926
1943
|
d.index = i;
|
|
1927
1944
|
}
|
|
1928
1945
|
|
|
1946
|
+
d.currentIndex = i;
|
|
1929
1947
|
return d;
|
|
1930
1948
|
});
|
|
1931
1949
|
var headerEl = document.getElementById("".concat(this.elementId, "_header"));
|
|
@@ -1936,16 +1954,18 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1936
1954
|
|
|
1937
1955
|
var el = document.getElementById("".concat(this.elementId, "_items"));
|
|
1938
1956
|
|
|
1939
|
-
if (el
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
this.options.items
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1957
|
+
if (el) {
|
|
1958
|
+
if (el.childElementCount === 0) {
|
|
1959
|
+
this.render();
|
|
1960
|
+
} else {
|
|
1961
|
+
if (this.options.items.length === 0) {
|
|
1962
|
+
this.options.items = [{
|
|
1963
|
+
label: this.options.noItemsText || 'No Items'
|
|
1964
|
+
}];
|
|
1965
|
+
}
|
|
1947
1966
|
|
|
1948
|
-
|
|
1967
|
+
this.renderItems();
|
|
1968
|
+
}
|
|
1949
1969
|
}
|
|
1950
1970
|
},
|
|
1951
1971
|
get: function get() {
|
|
@@ -1965,7 +1985,8 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
1965
1985
|
var DEFAULTS = {
|
|
1966
1986
|
items: [],
|
|
1967
1987
|
orientation: 'horizontal',
|
|
1968
|
-
dropPlaceholder: 'Drop item here'
|
|
1988
|
+
dropPlaceholder: 'Drop item here',
|
|
1989
|
+
accepts: 'application/wd-item'
|
|
1969
1990
|
};
|
|
1970
1991
|
this.busy = false;
|
|
1971
1992
|
this.options = _extends({}, DEFAULTS, options);
|
|
@@ -1991,8 +2012,6 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
1991
2012
|
}
|
|
1992
2013
|
|
|
1993
2014
|
GlobalPubSub.subscribe(this.elementId, 'requestForDDItem', this.handleRequestForItem.bind(this));
|
|
1994
|
-
console.log('constructor dd');
|
|
1995
|
-
console.trace();
|
|
1996
2015
|
GlobalPubSub.subscribe(this.elementId, 'add', this.addItem.bind(this));
|
|
1997
2016
|
this.render();
|
|
1998
2017
|
}
|
|
@@ -2033,7 +2052,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
2033
2052
|
item.id = WebsyDesigns.Utils.createIdentity();
|
|
2034
2053
|
}
|
|
2035
2054
|
|
|
2036
|
-
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 ");
|
|
2055
|
+
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 ");
|
|
2037
2056
|
|
|
2038
2057
|
if (item.component) {
|
|
2039
2058
|
html += "<div id='".concat(item.id, "_component'></div>");
|
|
@@ -2063,35 +2082,38 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
2063
2082
|
value: function handleDragStart(event) {
|
|
2064
2083
|
this.draggedId = event.target.getAttribute('data-id');
|
|
2065
2084
|
event.dataTransfer.effectAllowed = 'move';
|
|
2066
|
-
event.dataTransfer.setData(
|
|
2085
|
+
event.dataTransfer.setData(this.options.accepts, JSON.stringify({
|
|
2067
2086
|
el: event.target.id,
|
|
2068
2087
|
id: this.elementId,
|
|
2069
2088
|
itemId: this.draggedId
|
|
2070
2089
|
}));
|
|
2071
|
-
|
|
2072
|
-
|
|
2090
|
+
event.target.classList.add('dragging'); // event.target.style.opacity = 0.5
|
|
2091
|
+
|
|
2073
2092
|
this.dragging = true;
|
|
2074
2093
|
}
|
|
2075
2094
|
}, {
|
|
2076
2095
|
key: "handleDragOver",
|
|
2077
2096
|
value: function handleDragOver(event) {
|
|
2078
|
-
console.log('drag over', event.target.classList);
|
|
2079
|
-
|
|
2080
2097
|
if (event.preventDefault) {
|
|
2081
2098
|
event.preventDefault();
|
|
2082
2099
|
}
|
|
2083
2100
|
|
|
2101
|
+
console.log('drag', event.target.classList);
|
|
2102
|
+
|
|
2084
2103
|
if (!event.target.classList.contains('droppable')) {
|
|
2085
2104
|
return;
|
|
2086
2105
|
}
|
|
2087
2106
|
|
|
2107
|
+
if (event.dataTransfer.types.indexOf(this.options.accepts) === -1) {
|
|
2108
|
+
return;
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2088
2111
|
event.target.classList.add('drag-over');
|
|
2089
2112
|
}
|
|
2090
2113
|
}, {
|
|
2091
2114
|
key: "handleDragLeave",
|
|
2092
2115
|
value: function handleDragLeave(event) {
|
|
2093
|
-
console.log('drag leave', event.target.classList)
|
|
2094
|
-
|
|
2116
|
+
// console.log('drag leave', event.target.classList)
|
|
2095
2117
|
if (!event.target.classList.contains('droppable')) {
|
|
2096
2118
|
return;
|
|
2097
2119
|
}
|
|
@@ -2104,9 +2126,9 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
2104
2126
|
}, {
|
|
2105
2127
|
key: "handleDrop",
|
|
2106
2128
|
value: function handleDrop(event) {
|
|
2107
|
-
console.log('drag drop')
|
|
2108
|
-
console.log(event.dataTransfer.getData('application/wd-item'))
|
|
2109
|
-
var data = JSON.parse(event.dataTransfer.getData(
|
|
2129
|
+
// console.log('drag drop')
|
|
2130
|
+
// console.log(event.dataTransfer.getData('application/wd-item'))
|
|
2131
|
+
var data = JSON.parse(event.dataTransfer.getData(this.options.accepts));
|
|
2110
2132
|
|
|
2111
2133
|
if (event.preventDefault) {
|
|
2112
2134
|
event.preventDefault();
|
|
@@ -2116,6 +2138,10 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
2116
2138
|
return;
|
|
2117
2139
|
}
|
|
2118
2140
|
|
|
2141
|
+
if (event.dataTransfer.types.indexOf(this.options.accepts) === -1) {
|
|
2142
|
+
return;
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2119
2145
|
var side = event.target.getAttribute('data-side');
|
|
2120
2146
|
var id = event.target.getAttribute('data-id');
|
|
2121
2147
|
var index = this.getItemIndex(id);
|
|
@@ -2127,7 +2153,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
2127
2153
|
}
|
|
2128
2154
|
|
|
2129
2155
|
if (draggedIndex === -1) {
|
|
2130
|
-
console.log('requestForDDItem')
|
|
2156
|
+
// console.log('requestForDDItem')
|
|
2131
2157
|
GlobalPubSub.publish(data.id, 'requestForDDItem', {
|
|
2132
2158
|
group: this.options.group,
|
|
2133
2159
|
source: data.id,
|
|
@@ -2171,8 +2197,9 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
2171
2197
|
}, {
|
|
2172
2198
|
key: "handleDragEnd",
|
|
2173
2199
|
value: function handleDragEnd(event) {
|
|
2174
|
-
console.log('drag end')
|
|
2200
|
+
// console.log('drag end')
|
|
2175
2201
|
event.target.style.opacity = 1;
|
|
2202
|
+
event.target.classList.remove('dragging');
|
|
2176
2203
|
this.draggedId = null;
|
|
2177
2204
|
this.dragging = false;
|
|
2178
2205
|
var startEl = document.getElementById("".concat(this.elementId, "start_item"));
|
|
@@ -2241,7 +2268,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
2241
2268
|
}, {
|
|
2242
2269
|
key: "render",
|
|
2243
2270
|
value: function render() {
|
|
2244
|
-
var
|
|
2271
|
+
var _this12 = this;
|
|
2245
2272
|
|
|
2246
2273
|
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
2247
2274
|
|
|
@@ -2249,7 +2276,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
2249
2276
|
this.measureItems();
|
|
2250
2277
|
var html = "\n <div id='".concat(this.elementId, "start_item' class='websy-dragdrop-item ").concat(this.options.items.length === 0 ? 'empty' : '', "' data-id='").concat(this.elementId, "start'>\n <div id='").concat(this.elementId, "start_dropZone' class='websy-drop-zone droppable' data-index='start' data-side='start' data-id='").concat(this.elementId, "start' data-placeholder='").concat(this.options.dropPlaceholder, "'></div>\n </div>\n ");
|
|
2251
2278
|
html += this.options.items.map(function (d, i) {
|
|
2252
|
-
return
|
|
2279
|
+
return _this12.createItemHtml(_this12.elementId, i, d);
|
|
2253
2280
|
}).join('');
|
|
2254
2281
|
el.innerHTML = html;
|
|
2255
2282
|
this.options.items.forEach(function (item, i) {
|
|
@@ -2328,16 +2355,16 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2328
2355
|
}, {
|
|
2329
2356
|
key: "checkRecaptcha",
|
|
2330
2357
|
value: function checkRecaptcha() {
|
|
2331
|
-
var
|
|
2358
|
+
var _this13 = this;
|
|
2332
2359
|
|
|
2333
2360
|
return new Promise(function (resolve, reject) {
|
|
2334
|
-
if (
|
|
2361
|
+
if (_this13.options.useRecaptcha === true) {
|
|
2335
2362
|
// if (this.recaptchaValue) {
|
|
2336
2363
|
grecaptcha.ready(function () {
|
|
2337
2364
|
grecaptcha.execute(ENVIRONMENT.RECAPTCHA_KEY, {
|
|
2338
2365
|
action: 'submit'
|
|
2339
2366
|
}).then(function (token) {
|
|
2340
|
-
|
|
2367
|
+
_this13.apiService.add('google/checkrecaptcha', {
|
|
2341
2368
|
grecaptcharesponse: token
|
|
2342
2369
|
}).then(function (response) {
|
|
2343
2370
|
if (response.success && response.success === true) {
|
|
@@ -2400,14 +2427,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2400
2427
|
}, {
|
|
2401
2428
|
key: "processComponents",
|
|
2402
2429
|
value: function processComponents(components, callbackFn) {
|
|
2403
|
-
var
|
|
2430
|
+
var _this14 = this;
|
|
2404
2431
|
|
|
2405
2432
|
if (components.length === 0) {
|
|
2406
2433
|
callbackFn();
|
|
2407
2434
|
} else {
|
|
2408
2435
|
components.forEach(function (c) {
|
|
2409
2436
|
if (typeof WebsyDesigns[c.component] !== 'undefined') {
|
|
2410
|
-
c.instance = new WebsyDesigns[c.component]("".concat(
|
|
2437
|
+
c.instance = new WebsyDesigns[c.component]("".concat(_this14.elementId, "_input_").concat(c.field, "_component"), c.options);
|
|
2411
2438
|
} else {// some user feedback here
|
|
2412
2439
|
}
|
|
2413
2440
|
});
|
|
@@ -2428,7 +2455,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2428
2455
|
}, {
|
|
2429
2456
|
key: "render",
|
|
2430
2457
|
value: function render(update, data) {
|
|
2431
|
-
var
|
|
2458
|
+
var _this15 = this;
|
|
2432
2459
|
|
|
2433
2460
|
var el = document.getElementById(this.elementId);
|
|
2434
2461
|
var componentsToProcess = [];
|
|
@@ -2438,11 +2465,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2438
2465
|
this.options.fields.forEach(function (f, i) {
|
|
2439
2466
|
if (f.component) {
|
|
2440
2467
|
componentsToProcess.push(f);
|
|
2441
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <div id='").concat(
|
|
2468
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <div id='").concat(_this15.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
|
|
2442
2469
|
} else if (f.type === 'longtext') {
|
|
2443
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <textarea\n id=\"").concat(
|
|
2470
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <textarea\n id=\"").concat(_this15.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n name=\"").concat(f.field, "\" \n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea\"\n ></textarea>\n </div><!--\n ");
|
|
2444
2471
|
} else {
|
|
2445
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <input \n id=\"").concat(
|
|
2472
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <input \n id=\"").concat(_this15.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat(f.type || 'text', "\" \n class=\"websy-input\" \n ").concat((f.attributes || []).join(' '), "\n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.value || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? f.value : '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n </div><!--\n ");
|
|
2446
2473
|
}
|
|
2447
2474
|
});
|
|
2448
2475
|
html += "\n --><button class=\"websy-btn submit ".concat(this.options.submit.classes || '', "\">").concat(this.options.submit.text || 'Save', "</button>").concat(this.options.cancel ? '<!--' : '', "\n ");
|
|
@@ -2459,7 +2486,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2459
2486
|
|
|
2460
2487
|
el.innerHTML = html;
|
|
2461
2488
|
this.processComponents(componentsToProcess, function () {
|
|
2462
|
-
if (
|
|
2489
|
+
if (_this15.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {// this.recaptchaReady()
|
|
2463
2490
|
}
|
|
2464
2491
|
});
|
|
2465
2492
|
}
|
|
@@ -2467,7 +2494,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2467
2494
|
}, {
|
|
2468
2495
|
key: "submitForm",
|
|
2469
2496
|
value: function submitForm() {
|
|
2470
|
-
var
|
|
2497
|
+
var _this16 = this;
|
|
2471
2498
|
|
|
2472
2499
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
2473
2500
|
|
|
@@ -2481,32 +2508,32 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2481
2508
|
data[key] = value;
|
|
2482
2509
|
});
|
|
2483
2510
|
|
|
2484
|
-
if (
|
|
2485
|
-
var
|
|
2511
|
+
if (_this16.options.url) {
|
|
2512
|
+
var _this16$apiService;
|
|
2486
2513
|
|
|
2487
|
-
var params = [
|
|
2514
|
+
var params = [_this16.options.url];
|
|
2488
2515
|
|
|
2489
|
-
if (
|
|
2490
|
-
params.push(
|
|
2516
|
+
if (_this16.options.mode === 'update') {
|
|
2517
|
+
params.push(_this16.options.id);
|
|
2491
2518
|
}
|
|
2492
2519
|
|
|
2493
2520
|
params.push(data);
|
|
2494
2521
|
|
|
2495
|
-
(
|
|
2496
|
-
if (
|
|
2522
|
+
(_this16$apiService = _this16.apiService)[_this16.options.mode].apply(_this16$apiService, params).then(function (result) {
|
|
2523
|
+
if (_this16.options.clearAfterSave === true) {
|
|
2497
2524
|
// this.render()
|
|
2498
2525
|
formEl.reset();
|
|
2499
2526
|
}
|
|
2500
2527
|
|
|
2501
|
-
|
|
2528
|
+
_this16.options.onSuccess.call(_this16, result);
|
|
2502
2529
|
}, function (err) {
|
|
2503
2530
|
console.log('Error submitting form data:', err);
|
|
2504
2531
|
|
|
2505
|
-
|
|
2532
|
+
_this16.options.onError.call(_this16, err);
|
|
2506
2533
|
});
|
|
2507
|
-
} else if (
|
|
2508
|
-
|
|
2509
|
-
if (
|
|
2534
|
+
} else if (_this16.options.submitFn) {
|
|
2535
|
+
_this16.options.submitFn(data, function () {
|
|
2536
|
+
if (_this16.options.clearAfterSave === true) {
|
|
2510
2537
|
// this.render()
|
|
2511
2538
|
formEl.reset();
|
|
2512
2539
|
}
|
|
@@ -2526,17 +2553,17 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2526
2553
|
}, {
|
|
2527
2554
|
key: "data",
|
|
2528
2555
|
set: function set(d) {
|
|
2529
|
-
var
|
|
2556
|
+
var _this17 = this;
|
|
2530
2557
|
|
|
2531
2558
|
if (!this.options.fields) {
|
|
2532
2559
|
this.options.fields = [];
|
|
2533
2560
|
}
|
|
2534
2561
|
|
|
2535
2562
|
var _loop = function _loop(key) {
|
|
2536
|
-
|
|
2563
|
+
_this17.options.fields.forEach(function (f) {
|
|
2537
2564
|
if (f.field === key) {
|
|
2538
2565
|
f.value = d[key];
|
|
2539
|
-
var el = document.getElementById("".concat(
|
|
2566
|
+
var el = document.getElementById("".concat(_this17.elementId, "_input_").concat(f.field));
|
|
2540
2567
|
el.value = f.value;
|
|
2541
2568
|
}
|
|
2542
2569
|
});
|
|
@@ -2915,7 +2942,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2915
2942
|
|
|
2916
2943
|
var Pager = /*#__PURE__*/function () {
|
|
2917
2944
|
function Pager(elementId, options) {
|
|
2918
|
-
var
|
|
2945
|
+
var _this18 = this;
|
|
2919
2946
|
|
|
2920
2947
|
_classCallCheck(this, Pager);
|
|
2921
2948
|
|
|
@@ -2968,8 +2995,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2968
2995
|
allowClear: false,
|
|
2969
2996
|
disableSearch: true,
|
|
2970
2997
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
2971
|
-
if (
|
|
2972
|
-
|
|
2998
|
+
if (_this18.options.onChangePageSize) {
|
|
2999
|
+
_this18.options.onChangePageSize(selectedItem.value);
|
|
2973
3000
|
}
|
|
2974
3001
|
}
|
|
2975
3002
|
});
|
|
@@ -2993,13 +3020,13 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2993
3020
|
}, {
|
|
2994
3021
|
key: "render",
|
|
2995
3022
|
value: function render() {
|
|
2996
|
-
var
|
|
3023
|
+
var _this19 = this;
|
|
2997
3024
|
|
|
2998
3025
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
2999
3026
|
|
|
3000
3027
|
if (el) {
|
|
3001
3028
|
var pages = this.options.pages.map(function (item, index) {
|
|
3002
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
3029
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this19.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
3003
3030
|
});
|
|
3004
3031
|
var startIndex = 0;
|
|
3005
3032
|
|
|
@@ -3067,58 +3094,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3067
3094
|
_createClass(WebsyPDFButton, [{
|
|
3068
3095
|
key: "handleClick",
|
|
3069
3096
|
value: function handleClick(event) {
|
|
3070
|
-
var
|
|
3097
|
+
var _this20 = this;
|
|
3071
3098
|
|
|
3072
3099
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
3073
3100
|
this.loader.show();
|
|
3074
3101
|
setTimeout(function () {
|
|
3075
|
-
if (
|
|
3076
|
-
var el = document.getElementById(
|
|
3102
|
+
if (_this20.options.targetId) {
|
|
3103
|
+
var el = document.getElementById(_this20.options.targetId);
|
|
3077
3104
|
|
|
3078
3105
|
if (el) {
|
|
3079
3106
|
var pdfData = {
|
|
3080
3107
|
options: {}
|
|
3081
3108
|
};
|
|
3082
3109
|
|
|
3083
|
-
if (
|
|
3084
|
-
pdfData.options = _extends({},
|
|
3110
|
+
if (_this20.options.pdfOptions) {
|
|
3111
|
+
pdfData.options = _extends({}, _this20.options.pdfOptions);
|
|
3085
3112
|
}
|
|
3086
3113
|
|
|
3087
|
-
if (
|
|
3088
|
-
if (
|
|
3089
|
-
var headerEl = document.getElementById(
|
|
3114
|
+
if (_this20.options.header) {
|
|
3115
|
+
if (_this20.options.header.elementId) {
|
|
3116
|
+
var headerEl = document.getElementById(_this20.options.header.elementId);
|
|
3090
3117
|
|
|
3091
3118
|
if (headerEl) {
|
|
3092
3119
|
pdfData.header = headerEl.outerHTML;
|
|
3093
3120
|
|
|
3094
|
-
if (
|
|
3095
|
-
pdfData.options.headerCSS =
|
|
3121
|
+
if (_this20.options.header.css) {
|
|
3122
|
+
pdfData.options.headerCSS = _this20.options.header.css;
|
|
3096
3123
|
}
|
|
3097
3124
|
}
|
|
3098
|
-
} else if (
|
|
3099
|
-
pdfData.header =
|
|
3125
|
+
} else if (_this20.options.header.html) {
|
|
3126
|
+
pdfData.header = _this20.options.header.html;
|
|
3100
3127
|
|
|
3101
|
-
if (
|
|
3102
|
-
pdfData.options.headerCSS =
|
|
3128
|
+
if (_this20.options.header.css) {
|
|
3129
|
+
pdfData.options.headerCSS = _this20.options.header.css;
|
|
3103
3130
|
}
|
|
3104
3131
|
} else {
|
|
3105
|
-
pdfData.header =
|
|
3132
|
+
pdfData.header = _this20.options.header;
|
|
3106
3133
|
}
|
|
3107
3134
|
}
|
|
3108
3135
|
|
|
3109
|
-
if (
|
|
3110
|
-
if (
|
|
3111
|
-
var footerEl = document.getElementById(
|
|
3136
|
+
if (_this20.options.footer) {
|
|
3137
|
+
if (_this20.options.footer.elementId) {
|
|
3138
|
+
var footerEl = document.getElementById(_this20.options.footer.elementId);
|
|
3112
3139
|
|
|
3113
3140
|
if (footerEl) {
|
|
3114
3141
|
pdfData.footer = footerEl.outerHTML;
|
|
3115
3142
|
|
|
3116
|
-
if (
|
|
3117
|
-
pdfData.options.footerCSS =
|
|
3143
|
+
if (_this20.options.footer.css) {
|
|
3144
|
+
pdfData.options.footerCSS = _this20.options.footer.css;
|
|
3118
3145
|
}
|
|
3119
3146
|
}
|
|
3120
3147
|
} else {
|
|
3121
|
-
pdfData.footer =
|
|
3148
|
+
pdfData.footer = _this20.options.footer;
|
|
3122
3149
|
}
|
|
3123
3150
|
}
|
|
3124
3151
|
|
|
@@ -3127,31 +3154,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3127
3154
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
3128
3155
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
3129
3156
|
|
|
3130
|
-
|
|
3157
|
+
_this20.service.add('', pdfData, {
|
|
3131
3158
|
responseType: 'blob'
|
|
3132
3159
|
}).then(function (response) {
|
|
3133
|
-
|
|
3160
|
+
_this20.loader.hide();
|
|
3134
3161
|
|
|
3135
3162
|
var blob = new Blob([response], {
|
|
3136
3163
|
type: 'application/pdf'
|
|
3137
3164
|
});
|
|
3138
3165
|
var msg = "\n <div class='text-center websy-pdf-download'>\n <div>Your file is ready to download</div>\n <a href='".concat(URL.createObjectURL(blob), "' target='_blank'\n ");
|
|
3139
3166
|
|
|
3140
|
-
if (
|
|
3167
|
+
if (_this20.options.directDownload === true) {
|
|
3141
3168
|
var fileName;
|
|
3142
3169
|
|
|
3143
|
-
if (typeof
|
|
3144
|
-
fileName =
|
|
3170
|
+
if (typeof _this20.options.fileName === 'function') {
|
|
3171
|
+
fileName = _this20.options.fileName() || 'Export';
|
|
3145
3172
|
} else {
|
|
3146
|
-
fileName =
|
|
3173
|
+
fileName = _this20.options.fileName || 'Export';
|
|
3147
3174
|
}
|
|
3148
3175
|
|
|
3149
3176
|
msg += "download='".concat(fileName, ".pdf'");
|
|
3150
3177
|
}
|
|
3151
3178
|
|
|
3152
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
3179
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this20.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
3153
3180
|
|
|
3154
|
-
|
|
3181
|
+
_this20.popup.show({
|
|
3155
3182
|
message: msg,
|
|
3156
3183
|
mask: true
|
|
3157
3184
|
});
|
|
@@ -3319,9 +3346,9 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3319
3346
|
this.subscriptions[id][method](data);
|
|
3320
3347
|
}
|
|
3321
3348
|
} else {
|
|
3322
|
-
if (this.subscriptions[
|
|
3323
|
-
this.subscriptions[
|
|
3324
|
-
fn(
|
|
3349
|
+
if (this.subscriptions[id]) {
|
|
3350
|
+
this.subscriptions[id].forEach(function (fn) {
|
|
3351
|
+
fn(method);
|
|
3325
3352
|
});
|
|
3326
3353
|
}
|
|
3327
3354
|
}
|
|
@@ -3338,11 +3365,11 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3338
3365
|
this.subscriptions[id][method] = fn;
|
|
3339
3366
|
}
|
|
3340
3367
|
} else {
|
|
3341
|
-
if (!this.subscriptions[
|
|
3342
|
-
this.subscriptions[
|
|
3368
|
+
if (!this.subscriptions[id]) {
|
|
3369
|
+
this.subscriptions[id] = [];
|
|
3343
3370
|
}
|
|
3344
3371
|
|
|
3345
|
-
this.subscriptions[
|
|
3372
|
+
this.subscriptions[id].push(method);
|
|
3346
3373
|
}
|
|
3347
3374
|
}
|
|
3348
3375
|
}]);
|
|
@@ -3352,7 +3379,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3352
3379
|
|
|
3353
3380
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
3354
3381
|
function ResponsiveText(elementId, options) {
|
|
3355
|
-
var
|
|
3382
|
+
var _this21 = this;
|
|
3356
3383
|
|
|
3357
3384
|
_classCallCheck(this, ResponsiveText);
|
|
3358
3385
|
|
|
@@ -3365,7 +3392,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3365
3392
|
this.elementId = elementId;
|
|
3366
3393
|
this.canvas = document.createElement('canvas');
|
|
3367
3394
|
window.addEventListener('resize', function () {
|
|
3368
|
-
return
|
|
3395
|
+
return _this21.render();
|
|
3369
3396
|
});
|
|
3370
3397
|
var el = document.getElementById(this.elementId);
|
|
3371
3398
|
|
|
@@ -3584,7 +3611,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3584
3611
|
|
|
3585
3612
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3586
3613
|
function WebsyResultList(elementId, options) {
|
|
3587
|
-
var
|
|
3614
|
+
var _this22 = this;
|
|
3588
3615
|
|
|
3589
3616
|
_classCallCheck(this, WebsyResultList);
|
|
3590
3617
|
|
|
@@ -3612,9 +3639,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3612
3639
|
|
|
3613
3640
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3614
3641
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3615
|
-
|
|
3642
|
+
_this22.options.template = templateString;
|
|
3616
3643
|
|
|
3617
|
-
|
|
3644
|
+
_this22.render();
|
|
3618
3645
|
});
|
|
3619
3646
|
} else {
|
|
3620
3647
|
this.render();
|
|
@@ -3633,7 +3660,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3633
3660
|
}, {
|
|
3634
3661
|
key: "buildHTML",
|
|
3635
3662
|
value: function buildHTML(d) {
|
|
3636
|
-
var
|
|
3663
|
+
var _this23 = this;
|
|
3637
3664
|
|
|
3638
3665
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3639
3666
|
var html = "";
|
|
@@ -3641,7 +3668,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3641
3668
|
if (this.options.template) {
|
|
3642
3669
|
if (d.length > 0) {
|
|
3643
3670
|
d.forEach(function (row, ix) {
|
|
3644
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(
|
|
3671
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(_this23.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
3645
3672
|
|
|
3646
3673
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3647
3674
|
|
|
@@ -3761,7 +3788,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3761
3788
|
}, {
|
|
3762
3789
|
key: "handleClick",
|
|
3763
3790
|
value: function handleClick(event) {
|
|
3764
|
-
var
|
|
3791
|
+
var _this24 = this;
|
|
3765
3792
|
|
|
3766
3793
|
if (event.target.classList.contains('clickable')) {
|
|
3767
3794
|
var l = event.target.getAttribute('data-event');
|
|
@@ -3779,8 +3806,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3779
3806
|
l = l[0];
|
|
3780
3807
|
params = params.map(function (p) {
|
|
3781
3808
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
3782
|
-
if (
|
|
3783
|
-
p =
|
|
3809
|
+
if (_this24.rows[+id]) {
|
|
3810
|
+
p = _this24.rows[+id][p];
|
|
3784
3811
|
}
|
|
3785
3812
|
} else if (typeof p === 'string') {
|
|
3786
3813
|
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
@@ -3802,13 +3829,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3802
3829
|
}, {
|
|
3803
3830
|
key: "render",
|
|
3804
3831
|
value: function render() {
|
|
3805
|
-
var
|
|
3832
|
+
var _this25 = this;
|
|
3806
3833
|
|
|
3807
3834
|
if (this.options.entity) {
|
|
3808
3835
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
3809
|
-
|
|
3836
|
+
_this25.rows = results.rows;
|
|
3810
3837
|
|
|
3811
|
-
|
|
3838
|
+
_this25.resize();
|
|
3812
3839
|
});
|
|
3813
3840
|
} else {
|
|
3814
3841
|
this.resize();
|
|
@@ -3887,14 +3914,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3887
3914
|
_createClass(WebsyRouter, [{
|
|
3888
3915
|
key: "addGroup",
|
|
3889
3916
|
value: function addGroup(group) {
|
|
3890
|
-
var
|
|
3917
|
+
var _this26 = this;
|
|
3891
3918
|
|
|
3892
3919
|
if (!this.groups[group]) {
|
|
3893
3920
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3894
3921
|
|
|
3895
3922
|
if (els) {
|
|
3896
3923
|
this.getClosestParent(els[0], function (parent) {
|
|
3897
|
-
|
|
3924
|
+
_this26.groups[group] = {
|
|
3898
3925
|
activeView: '',
|
|
3899
3926
|
views: [],
|
|
3900
3927
|
parent: parent.getAttribute('data-view')
|
|
@@ -4219,12 +4246,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4219
4246
|
}, {
|
|
4220
4247
|
key: "showComponents",
|
|
4221
4248
|
value: function showComponents(view) {
|
|
4222
|
-
var
|
|
4249
|
+
var _this27 = this;
|
|
4223
4250
|
|
|
4224
4251
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4225
4252
|
this.options.views[view].components.forEach(function (c) {
|
|
4226
4253
|
if (typeof c.instance === 'undefined') {
|
|
4227
|
-
|
|
4254
|
+
_this27.prepComponent(c.elementId, c.options);
|
|
4228
4255
|
|
|
4229
4256
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4230
4257
|
} else if (c.instance.render) {
|
|
@@ -4515,6 +4542,59 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4515
4542
|
|
|
4516
4543
|
return WebsyRouter;
|
|
4517
4544
|
}();
|
|
4545
|
+
|
|
4546
|
+
var WebsySearch = /*#__PURE__*/function () {
|
|
4547
|
+
function WebsySearch(elementId, options) {
|
|
4548
|
+
_classCallCheck(this, WebsySearch);
|
|
4549
|
+
|
|
4550
|
+
this.elementId = elementId;
|
|
4551
|
+
var DEFAULTS = {
|
|
4552
|
+
searchIcon: "<svg class='search' width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><path d=\"M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><line x1=\"338.29\" y1=\"338.29\" x2=\"448\" y2=\"448\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px\"/></svg>",
|
|
4553
|
+
clearIcon: "<svg class='clear' xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 512 512\"><title>ionicons-v5-l</title><line x1=\"368\" y1=\"368\" x2=\"144\" y2=\"144\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"368\" y1=\"144\" x2=\"144\" y2=\"368\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>",
|
|
4554
|
+
placeholder: 'Search',
|
|
4555
|
+
searchTimeout: 500,
|
|
4556
|
+
minLength: 2
|
|
4557
|
+
};
|
|
4558
|
+
this.options = _extends({}, DEFAULTS, options);
|
|
4559
|
+
this.searchTimeoutFn = null;
|
|
4560
|
+
var el = document.getElementById(elementId);
|
|
4561
|
+
|
|
4562
|
+
if (el) {
|
|
4563
|
+
// el.addEventListener('click', this.handleClick.bind(this))
|
|
4564
|
+
el.addEventListener('keyup', this.handleKeyUp.bind(this));
|
|
4565
|
+
el.innerHTML = "\n <div class='websy-search-input-container'>\n ".concat(this.options.searchIcon, "\n <input id='").concat(this.elementId, "_search' class='websy-search-input' placeholder='").concat(this.options.placeholder || 'Search', "'>\n ").concat(this.options.clearIcon, "\n </div>\n ");
|
|
4566
|
+
} else {
|
|
4567
|
+
console.log('No element found with Id', elementId);
|
|
4568
|
+
}
|
|
4569
|
+
}
|
|
4570
|
+
|
|
4571
|
+
_createClass(WebsySearch, [{
|
|
4572
|
+
key: "handleKeyUp",
|
|
4573
|
+
value: function handleKeyUp(event) {
|
|
4574
|
+
var _this28 = this;
|
|
4575
|
+
|
|
4576
|
+
if (event.target.classList.contains('websy-search-input')) {
|
|
4577
|
+
if (this.searchTimeoutFn) {
|
|
4578
|
+
clearTimeout(this.searchTimeoutFn);
|
|
4579
|
+
}
|
|
4580
|
+
|
|
4581
|
+
if (event.target.value.length >= this.options.minLength) {
|
|
4582
|
+
this.searchTimeoutFn = setTimeout(function () {
|
|
4583
|
+
if (_this28.options.onSearch) {
|
|
4584
|
+
_this28.options.onSearch(event.target.value);
|
|
4585
|
+
}
|
|
4586
|
+
}, this.options.searchTimeout);
|
|
4587
|
+
} else {
|
|
4588
|
+
if (this.options.onSearch) {
|
|
4589
|
+
this.options.onSearch('');
|
|
4590
|
+
}
|
|
4591
|
+
}
|
|
4592
|
+
}
|
|
4593
|
+
}
|
|
4594
|
+
}]);
|
|
4595
|
+
|
|
4596
|
+
return WebsySearch;
|
|
4597
|
+
}();
|
|
4518
4598
|
/* global WebsyDesigns ENVIRONMENT */
|
|
4519
4599
|
|
|
4520
4600
|
|
|
@@ -4855,6 +4935,7 @@ var WebsyUtils = {
|
|
|
4855
4935
|
var red = 0;
|
|
4856
4936
|
var green = 0;
|
|
4857
4937
|
var blue = 0;
|
|
4938
|
+
var alpha = 1;
|
|
4858
4939
|
|
|
4859
4940
|
if (backgroundColor.indexOf('#') !== -1) {
|
|
4860
4941
|
// hex color
|
|
@@ -4866,14 +4947,16 @@ var WebsyUtils = {
|
|
|
4866
4947
|
blue = parseInt(colorParts[4] + colorParts[5], 16);
|
|
4867
4948
|
} else if (backgroundColor.toLowerCase().indexOf('rgb') !== -1) {
|
|
4868
4949
|
// rgb color
|
|
4869
|
-
colorParts = backgroundColor.replace(/
|
|
4950
|
+
colorParts = backgroundColor.replace(/rgba\(/gi, '').replace(/\)/gi, '');
|
|
4951
|
+
colorParts = colorParts.replace(/rgb\(/gi, '');
|
|
4870
4952
|
colorParts = colorParts.split(',');
|
|
4871
4953
|
red = colorParts[0];
|
|
4872
4954
|
green = colorParts[1];
|
|
4873
4955
|
blue = colorParts[2];
|
|
4956
|
+
alpha = colorParts[3] || 1;
|
|
4874
4957
|
}
|
|
4875
4958
|
|
|
4876
|
-
return red * 0.299 + green * 0.587 + blue * 0.114 > 186 ? darkColor : lightColor;
|
|
4959
|
+
return (red * 0.299 + green * 0.587 + blue * 0.114) / alpha > 186 ? darkColor : lightColor;
|
|
4877
4960
|
},
|
|
4878
4961
|
measureText: function measureText(text) {
|
|
4879
4962
|
var rotation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
@@ -5345,7 +5428,17 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5345
5428
|
|
|
5346
5429
|
var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
|
|
5347
5430
|
if (c.show !== false) {
|
|
5348
|
-
|
|
5431
|
+
var style = '';
|
|
5432
|
+
|
|
5433
|
+
if (c.style) {
|
|
5434
|
+
style += c.style;
|
|
5435
|
+
}
|
|
5436
|
+
|
|
5437
|
+
if (c.width) {
|
|
5438
|
+
style += "width: ".concat(c.width || 'auto', ";");
|
|
5439
|
+
}
|
|
5440
|
+
|
|
5441
|
+
return "\n <th style=\"".concat(style, "\">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-index=\"").concat(i, "\" \n data-sort=\"").concat(c.sort, "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n <!--").concat(c.searchable === true ? _this33.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
5349
5442
|
}
|
|
5350
5443
|
}).join('') + '</tr>';
|
|
5351
5444
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6033,7 +6126,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6033
6126
|
showTotalsAbove: true,
|
|
6034
6127
|
minHandleSize: 20,
|
|
6035
6128
|
maxColWidth: '50%',
|
|
6036
|
-
allowPivoting: false
|
|
6129
|
+
allowPivoting: false,
|
|
6130
|
+
searchIcon: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><title>ionicons-v5-f</title><path d=\"M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><line x1=\"338.29\" y1=\"338.29\" x2=\"448\" y2=\"448\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px\"/></svg>"
|
|
6037
6131
|
};
|
|
6038
6132
|
this.options = _extends({}, DEFAULTS, options);
|
|
6039
6133
|
this.sizes = {};
|
|
@@ -6121,7 +6215,34 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6121
6215
|
data.forEach(function (row) {
|
|
6122
6216
|
bodyHtml += "<tr class=\"websy-table-row\">";
|
|
6123
6217
|
row.forEach(function (cell, cellIndex) {
|
|
6124
|
-
|
|
6218
|
+
if (typeof sizingColumns[cellIndex] === 'undefined') {
|
|
6219
|
+
return; // need to revisit this logic
|
|
6220
|
+
}
|
|
6221
|
+
|
|
6222
|
+
var style = '';
|
|
6223
|
+
|
|
6224
|
+
if (cell.style) {
|
|
6225
|
+
style += cell.style;
|
|
6226
|
+
}
|
|
6227
|
+
|
|
6228
|
+
if (useWidths === true) {
|
|
6229
|
+
style += "max-width: ".concat(sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth, "px!important;");
|
|
6230
|
+
}
|
|
6231
|
+
|
|
6232
|
+
if (cell.backgroundColor) {
|
|
6233
|
+
style += "background-color: ".concat(cell.backgroundColor, "; ");
|
|
6234
|
+
|
|
6235
|
+
if (!cell.color) {
|
|
6236
|
+
style += "color: ".concat(WebsyDesigns.Utils.getLightDark(cell.backgroundColor), "; ");
|
|
6237
|
+
}
|
|
6238
|
+
}
|
|
6239
|
+
|
|
6240
|
+
if (cell.color) {
|
|
6241
|
+
style += "color: ".concat(cell.color, "; ");
|
|
6242
|
+
}
|
|
6243
|
+
|
|
6244
|
+
console.log('rowspan', cell.rowspan);
|
|
6245
|
+
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) {
|
|
6125
6246
|
// bodyHtml += `
|
|
6126
6247
|
// style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
|
|
6127
6248
|
// width='${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}'
|
|
@@ -6159,7 +6280,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6159
6280
|
}
|
|
6160
6281
|
|
|
6161
6282
|
headerHtml += "<tr class=\"websy-table-row websy-table-header-row\">";
|
|
6162
|
-
row.forEach(function (col) {
|
|
6283
|
+
row.forEach(function (col, colIndex) {
|
|
6163
6284
|
headerHtml += "<td \n class='websy-table-cell' \n style='".concat(col.style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n "); // if (useWidths === true && rowIndex === this.options.columns.length - 1) {
|
|
6164
6285
|
// headerHtml += `
|
|
6165
6286
|
// style='width: ${col.width || col.actualWidth}px'
|
|
@@ -6167,12 +6288,30 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6167
6288
|
// `
|
|
6168
6289
|
// }
|
|
6169
6290
|
|
|
6170
|
-
headerHtml += " \n >\n ".concat(col.name, "\n </td>");
|
|
6291
|
+
headerHtml += " \n >\n <div>\n ".concat(col.name, "\n ").concat(col.searchable === true ? _this38.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
|
|
6171
6292
|
});
|
|
6172
6293
|
headerHtml += "</tr>";
|
|
6173
6294
|
});
|
|
6295
|
+
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6296
|
+
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6297
|
+
if (c.searchable && c.isExternalSearch === true) {
|
|
6298
|
+
var testEl = document.getElementById("".concat(_this38.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6299
|
+
|
|
6300
|
+
if (!testEl) {
|
|
6301
|
+
var newE = document.createElement('div');
|
|
6302
|
+
newE.id = "".concat(_this38.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6303
|
+
newE.className = 'websy-modal-dropdown';
|
|
6304
|
+
dropdownEl.appendChild(newE);
|
|
6305
|
+
}
|
|
6306
|
+
}
|
|
6307
|
+
});
|
|
6174
6308
|
return headerHtml;
|
|
6175
6309
|
}
|
|
6310
|
+
}, {
|
|
6311
|
+
key: "buildSearchIcon",
|
|
6312
|
+
value: function buildSearchIcon(col, index) {
|
|
6313
|
+
return "\n <div class=\"websy-table-search-icon\" data-col-id=\"".concat(col.dimId, "\" data-col-index=\"").concat(index, "\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><title>ionicons-v5-f</title><path d=\"M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><line x1=\"338.29\" y1=\"338.29\" x2=\"448\" y2=\"448\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px\"/></svg>\n </div>\n ");
|
|
6314
|
+
}
|
|
6176
6315
|
}, {
|
|
6177
6316
|
key: "buildTotalHtml",
|
|
6178
6317
|
value: function buildTotalHtml() {
|
|
@@ -6262,10 +6401,16 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6262
6401
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
6263
6402
|
return a + (b.width || b.actualWidth);
|
|
6264
6403
|
}, 0);
|
|
6404
|
+
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
|
|
6405
|
+
return i >= _this40.pinnedColumns;
|
|
6406
|
+
}).reduce(function (a, b) {
|
|
6407
|
+
return a + (b.width || b.actualWidth);
|
|
6408
|
+
}, 0);
|
|
6265
6409
|
var outerSize = outerEl.getBoundingClientRect();
|
|
6266
6410
|
|
|
6267
6411
|
if (this.sizes.totalWidth < outerSize.width) {
|
|
6268
6412
|
this.sizes.totalWidth = 0;
|
|
6413
|
+
this.sizes.totalNonPinnedWidth = 0;
|
|
6269
6414
|
var equalWidth = outerSize.width / this.options.columns[this.options.columns.length - 1].length;
|
|
6270
6415
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6271
6416
|
if (!c.width) {
|
|
@@ -6276,6 +6421,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6276
6421
|
}
|
|
6277
6422
|
|
|
6278
6423
|
_this40.sizes.totalWidth += c.width || c.actualWidth;
|
|
6424
|
+
|
|
6425
|
+
if (i < _this40.pinnedColumns) {
|
|
6426
|
+
_this40.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6427
|
+
}
|
|
6428
|
+
|
|
6279
6429
|
equalWidth = (outerSize.width - _this40.sizes.totalWidth) / (_this40.options.columns[_this40.options.columns.length - 1].length - (i + 1));
|
|
6280
6430
|
});
|
|
6281
6431
|
} // take the height of the last cell as the official height for data cells
|
|
@@ -6297,10 +6447,14 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6297
6447
|
|
|
6298
6448
|
if (this.sizes.rowsToRender < this.totalRowCount) {
|
|
6299
6449
|
this.vScrollRequired = true;
|
|
6450
|
+
} else {
|
|
6451
|
+
this.vScrollRequired = false;
|
|
6300
6452
|
}
|
|
6301
6453
|
|
|
6302
6454
|
if (this.sizes.totalWidth > this.sizes.outer.width) {
|
|
6303
6455
|
this.hScrollRequired = true;
|
|
6456
|
+
} else {
|
|
6457
|
+
this.hScrollRequired = false;
|
|
6304
6458
|
}
|
|
6305
6459
|
|
|
6306
6460
|
this.options.allColumns = this.options.columns.map(function (c) {
|
|
@@ -6340,7 +6494,16 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6340
6494
|
}
|
|
6341
6495
|
}, {
|
|
6342
6496
|
key: "handleClick",
|
|
6343
|
-
value: function handleClick(event) {
|
|
6497
|
+
value: function handleClick(event) {
|
|
6498
|
+
if (event.target.classList.contains('websy-table-search-icon')) {
|
|
6499
|
+
console.log('clicked on search icon');
|
|
6500
|
+
var colIndex = +event.target.getAttribute('data-col-index');
|
|
6501
|
+
|
|
6502
|
+
if (this.options.columns[this.options.columns.length - 1][colIndex].onSearch) {
|
|
6503
|
+
this.options.columns[this.options.columns.length - 1][colIndex].onSearch(event, this.options.columns[this.options.columns.length - 1][colIndex]);
|
|
6504
|
+
}
|
|
6505
|
+
}
|
|
6506
|
+
}
|
|
6344
6507
|
}, {
|
|
6345
6508
|
key: "handleMouseDown",
|
|
6346
6509
|
value: function handleMouseDown(event) {
|
|
@@ -6464,20 +6627,26 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6464
6627
|
|
|
6465
6628
|
if (this.options.virtualScroll === true) {
|
|
6466
6629
|
// set the scroll element positions
|
|
6630
|
+
var vScrollEl = document.getElementById("".concat(this.elementId, "_vScrollContainer"));
|
|
6631
|
+
var vHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
|
|
6632
|
+
|
|
6467
6633
|
if (this.vScrollRequired === true) {
|
|
6468
|
-
var vScrollEl = document.getElementById("".concat(this.elementId, "_vScrollContainer"));
|
|
6469
|
-
var vHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
|
|
6470
6634
|
vScrollEl.style.top = "".concat(this.sizes.header.height + this.sizes.total.height, "px");
|
|
6471
6635
|
vScrollEl.style.height = "".concat(this.sizes.bodyHeight, "px");
|
|
6472
6636
|
vHandleEl.style.height = Math.max(this.options.minHandleSize, this.sizes.bodyHeight * (this.sizes.rowsToRenderPrecise / this.totalRowCount)) + 'px';
|
|
6637
|
+
} else {
|
|
6638
|
+
vHandleEl.style.height = '0px';
|
|
6473
6639
|
}
|
|
6474
6640
|
|
|
6641
|
+
var hScrollEl = document.getElementById("".concat(this.elementId, "_hScrollContainer"));
|
|
6642
|
+
var hHandleEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
|
|
6643
|
+
|
|
6475
6644
|
if (this.hScrollRequired === true) {
|
|
6476
|
-
var hScrollEl = document.getElementById("".concat(this.elementId, "_hScrollContainer"));
|
|
6477
|
-
var hHandleEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
|
|
6478
6645
|
hScrollEl.style.left = "".concat(this.sizes.table.width - this.sizes.scrollableWidth, "px");
|
|
6479
6646
|
hScrollEl.style.width = "".concat(this.sizes.scrollableWidth - 20, "px");
|
|
6480
|
-
hHandleEl.style.width = Math.max(this.options.minHandleSize, this.sizes.scrollableWidth * (this.sizes.scrollableWidth / this.sizes.
|
|
6647
|
+
hHandleEl.style.width = Math.max(this.options.minHandleSize, this.sizes.scrollableWidth * (this.sizes.scrollableWidth / this.sizes.totalNonPinnedWidth)) + 'px';
|
|
6648
|
+
} else {
|
|
6649
|
+
hHandleEl.style.width = '0px';
|
|
6481
6650
|
}
|
|
6482
6651
|
}
|
|
6483
6652
|
}
|
|
@@ -6518,8 +6687,6 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6518
6687
|
el.classList.add('has-error');
|
|
6519
6688
|
}
|
|
6520
6689
|
|
|
6521
|
-
var tableEl = document.getElementById("".concat(this.elementId, "_tableInner"));
|
|
6522
|
-
tableEl.classList.add('hidden');
|
|
6523
6690
|
var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
|
|
6524
6691
|
|
|
6525
6692
|
if (containerEl) {
|
|
@@ -6545,6 +6712,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6545
6712
|
}, {
|
|
6546
6713
|
key: "scrollX",
|
|
6547
6714
|
value: function scrollX(diff) {
|
|
6715
|
+
var el = document.getElementById("".concat(this.elementId, "_tableContainer"));
|
|
6716
|
+
|
|
6717
|
+
if (!el.classList.contains('scrolling')) {
|
|
6718
|
+
el.classList.add('scrolling');
|
|
6719
|
+
}
|
|
6720
|
+
|
|
6721
|
+
if (this.scrollTimeoutFn) {
|
|
6722
|
+
clearTimeout(this.scrollTimeoutFn);
|
|
6723
|
+
}
|
|
6724
|
+
|
|
6725
|
+
this.scrollTimeoutFn = setTimeout(function () {
|
|
6726
|
+
el.classList.remove('scrolling');
|
|
6727
|
+
}, 200);
|
|
6728
|
+
|
|
6729
|
+
if (this.hScrollRequired === false) {
|
|
6730
|
+
return;
|
|
6731
|
+
}
|
|
6732
|
+
|
|
6548
6733
|
var scrollContainerEl = document.getElementById("".concat(this.elementId, "_hScrollContainer"));
|
|
6549
6734
|
var scrollHandleEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
|
|
6550
6735
|
var handlePos;
|
|
@@ -6560,14 +6745,14 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6560
6745
|
scrollHandleEl.style.left = Math.min(scrollableSpace, Math.max(0, handlePos)) + 'px';
|
|
6561
6746
|
|
|
6562
6747
|
if (this.options.onScroll) {
|
|
6563
|
-
var actualLeft = (this.sizes.
|
|
6748
|
+
var actualLeft = (this.sizes.totalNonPinnedWidth - this.sizes.scrollableWidth) * (Math.min(scrollableSpace, Math.max(0, handlePos)) / scrollableSpace);
|
|
6564
6749
|
var cumulativeWidth = 0;
|
|
6565
6750
|
this.startCol = 0;
|
|
6566
6751
|
this.endCol = 0;
|
|
6567
6752
|
|
|
6568
|
-
for (var i =
|
|
6753
|
+
for (var i = this.pinnedColumns; i < this.options.allColumns[this.options.allColumns.length - 1].length; i++) {
|
|
6569
6754
|
cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth;
|
|
6570
|
-
console.log(actualLeft, this.sizes.totalWidth, cumulativeWidth, cumulativeWidth + this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth);
|
|
6755
|
+
console.log('actualLeft', actualLeft, this.sizes.totalWidth, cumulativeWidth, cumulativeWidth + this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth);
|
|
6571
6756
|
|
|
6572
6757
|
if (actualLeft < cumulativeWidth) {
|
|
6573
6758
|
this.startCol = i;
|
|
@@ -6600,6 +6785,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6600
6785
|
}, {
|
|
6601
6786
|
key: "scrollY",
|
|
6602
6787
|
value: function scrollY(diff) {
|
|
6788
|
+
var el = document.getElementById("".concat(this.elementId, "_tableContainer"));
|
|
6789
|
+
|
|
6790
|
+
if (!el.classList.contains('scrolling')) {
|
|
6791
|
+
el.classList.add('scrolling');
|
|
6792
|
+
}
|
|
6793
|
+
|
|
6794
|
+
if (this.scrollTimeoutFn) {
|
|
6795
|
+
clearTimeout(this.scrollTimeoutFn);
|
|
6796
|
+
}
|
|
6797
|
+
|
|
6798
|
+
this.scrollTimeoutFn = setTimeout(function () {
|
|
6799
|
+
el.classList.remove('scrolling');
|
|
6800
|
+
}, 200);
|
|
6801
|
+
|
|
6802
|
+
if (this.vScrollRequired === false) {
|
|
6803
|
+
return;
|
|
6804
|
+
}
|
|
6805
|
+
|
|
6603
6806
|
var scrollContainerEl = document.getElementById("".concat(this.elementId, "_vScrollContainer"));
|
|
6604
6807
|
var scrollHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
|
|
6605
6808
|
var handlePos;
|
|
@@ -7586,11 +7789,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7586
7789
|
|
|
7587
7790
|
bars.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
7588
7791
|
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) {
|
|
7589
|
-
return d.color || series.color;
|
|
7792
|
+
return d.y.color || d.color || series.color;
|
|
7590
7793
|
});
|
|
7591
7794
|
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)
|
|
7592
7795
|
.attr('fill', function (d) {
|
|
7593
|
-
return d.color || series.color;
|
|
7796
|
+
return d.y.color || d.color || series.color;
|
|
7594
7797
|
}).attr('class', function (d) {
|
|
7595
7798
|
return "bar bar_".concat(series.key);
|
|
7596
7799
|
});
|
|
@@ -7610,20 +7813,36 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7610
7813
|
yAxis = 'bottomAxis';
|
|
7611
7814
|
}
|
|
7612
7815
|
|
|
7613
|
-
if (this.options.showLabels) {
|
|
7816
|
+
if (this.options.showLabels === true || series.showLabels === true) {
|
|
7614
7817
|
// need to add logic to handle positioning options
|
|
7615
7818
|
// e.g. Inside, Outide, Auto (this will also affect the available plot space)
|
|
7616
7819
|
// We currently only support 'Auto'
|
|
7617
7820
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
7618
7821
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
7619
|
-
labels.attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('class', "label_".concat(series.key)).
|
|
7620
|
-
return _this45.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.color || series.color);
|
|
7621
|
-
}).transition(this.transition).text(function (d) {
|
|
7822
|
+
labels.attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
7823
|
+
return _this45.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7824
|
+
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
7622
7825
|
return d.y.label || d.y.value;
|
|
7826
|
+
}).each(function (d, i) {
|
|
7827
|
+
if (that.options.orientation === 'horizontal') {
|
|
7828
|
+
if (that.options.grouping === 'stacked') {
|
|
7829
|
+
this.setAttribute('text-anchor', 'middle');
|
|
7830
|
+
} else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
|
|
7831
|
+
this.setAttribute('text-anchor', 'end');
|
|
7832
|
+
this.setAttribute('x', +this.getAttribute('x') - 8);
|
|
7833
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
|
|
7834
|
+
} else {
|
|
7835
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
|
|
7836
|
+
}
|
|
7837
|
+
} else {
|
|
7838
|
+
if (that.plotheight - getLabelX.call(that, d) < (that.options.labelSize || that.options.fontSize)) {
|
|
7839
|
+
this.setAttribute('y', +this.getAttribute('y') + 8);
|
|
7840
|
+
}
|
|
7841
|
+
}
|
|
7623
7842
|
});
|
|
7624
|
-
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').
|
|
7625
|
-
return _this45.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.color || series.color);
|
|
7626
|
-
}).text(function (d) {
|
|
7843
|
+
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) {
|
|
7844
|
+
return _this45.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7845
|
+
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
7627
7846
|
return d.y.label || d.y.value;
|
|
7628
7847
|
}).each(function (d, i) {
|
|
7629
7848
|
if (that.options.orientation === 'horizontal') {
|
|
@@ -7632,6 +7851,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7632
7851
|
} else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
|
|
7633
7852
|
this.setAttribute('text-anchor', 'end');
|
|
7634
7853
|
this.setAttribute('x', +this.getAttribute('x') - 8);
|
|
7854
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
|
|
7855
|
+
} else {
|
|
7856
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
|
|
7635
7857
|
}
|
|
7636
7858
|
} else {
|
|
7637
7859
|
if (that.plotheight - getLabelX.call(that, d) < (that.options.labelSize || that.options.fontSize)) {
|
|
@@ -8394,7 +8616,9 @@ var WebsyDesigns = {
|
|
|
8394
8616
|
ResponsiveText: ResponsiveText,
|
|
8395
8617
|
WebsyResponsiveText: ResponsiveText,
|
|
8396
8618
|
WebsyDragDrop: WebsyDragDrop,
|
|
8397
|
-
DragDrop: WebsyDragDrop
|
|
8619
|
+
DragDrop: WebsyDragDrop,
|
|
8620
|
+
WebsySearch: WebsySearch,
|
|
8621
|
+
Search: WebsySearch
|
|
8398
8622
|
};
|
|
8399
8623
|
WebsyDesigns.service = new WebsyDesigns.APIService('');
|
|
8400
8624
|
var GlobalPubSub = new WebsyPubSub('empty', {});
|