@websy/websy-designs 1.2.31 → 1.2.33
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/websy-designs-es6.debug.js +883 -22
- package/dist/websy-designs-es6.js +1190 -202
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +883 -23
- package/dist/websy-designs.js +1183 -194
- 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
|
@@ -35,6 +35,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
35
35
|
WebsyResultList
|
|
36
36
|
WebsyTable
|
|
37
37
|
WebsyTable2
|
|
38
|
+
WebsyTable3
|
|
38
39
|
WebsyIcons
|
|
39
40
|
WebsyChart
|
|
40
41
|
WebsyChartTooltip
|
|
@@ -51,6 +52,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
51
52
|
WebsyLogin
|
|
52
53
|
WebsySignup
|
|
53
54
|
ResponsiveText
|
|
55
|
+
WebsyDragDrop
|
|
54
56
|
Pager
|
|
55
57
|
*/
|
|
56
58
|
|
|
@@ -625,6 +627,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
625
627
|
value: function close(confirm) {
|
|
626
628
|
var _this4 = this;
|
|
627
629
|
|
|
630
|
+
var isRange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
628
631
|
var maskEl = document.getElementById("".concat(this.elementId, "_mask"));
|
|
629
632
|
var contentEl = document.getElementById("".concat(this.elementId, "_content"));
|
|
630
633
|
var el = document.getElementById(this.elementId);
|
|
@@ -658,7 +661,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
658
661
|
|
|
659
662
|
this.options.onChange(_hoursOut, true);
|
|
660
663
|
} else {
|
|
661
|
-
this.options.onChange(this.currentselection,
|
|
664
|
+
this.options.onChange(this.currentselection, isRange);
|
|
662
665
|
}
|
|
663
666
|
}
|
|
664
667
|
}
|
|
@@ -1268,7 +1271,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1268
1271
|
|
|
1269
1272
|
this.highlightRange();
|
|
1270
1273
|
this.updateRange();
|
|
1271
|
-
this.close(confirm);
|
|
1274
|
+
this.close(confirm, true);
|
|
1272
1275
|
}
|
|
1273
1276
|
}
|
|
1274
1277
|
}, {
|
|
@@ -1896,13 +1899,14 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1896
1899
|
this.selectedItems.push(index);
|
|
1897
1900
|
}
|
|
1898
1901
|
}
|
|
1899
|
-
}
|
|
1902
|
+
} // const item = this.options.items[index]
|
|
1903
|
+
|
|
1900
1904
|
|
|
1901
|
-
var item = this.options.items[index];
|
|
1905
|
+
var item = this._originalData[index] || this.options.items[index];
|
|
1902
1906
|
this.updateHeader(item);
|
|
1903
1907
|
|
|
1904
1908
|
if (item && this.options.onItemSelected) {
|
|
1905
|
-
this.options.onItemSelected(item, this.selectedItems, this.options.items, this.options);
|
|
1909
|
+
this.options.onItemSelected(item, this.selectedItems, this._originalData || this.options.items, this.options);
|
|
1906
1910
|
}
|
|
1907
1911
|
|
|
1908
1912
|
if (this.options.closeAfterSelection === true) {
|
|
@@ -1924,6 +1928,12 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1924
1928
|
|
|
1925
1929
|
return d;
|
|
1926
1930
|
});
|
|
1931
|
+
var headerEl = document.getElementById("".concat(this.elementId, "_header"));
|
|
1932
|
+
|
|
1933
|
+
if (headerEl) {
|
|
1934
|
+
headerEl.classList["".concat(this.options.allowClear === true ? 'add' : 'remove')]('allow-clear');
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1927
1937
|
var el = document.getElementById("".concat(this.elementId, "_items"));
|
|
1928
1938
|
|
|
1929
1939
|
if (el.childElementCount === 0) {
|
|
@@ -1945,6 +1955,320 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1945
1955
|
|
|
1946
1956
|
return WebsyDropdown;
|
|
1947
1957
|
}();
|
|
1958
|
+
/* global WebsyDesigns GlobalPubSub */
|
|
1959
|
+
|
|
1960
|
+
|
|
1961
|
+
var WebsyDragDrop = /*#__PURE__*/function () {
|
|
1962
|
+
function WebsyDragDrop(elementId, options) {
|
|
1963
|
+
_classCallCheck(this, WebsyDragDrop);
|
|
1964
|
+
|
|
1965
|
+
var DEFAULTS = {
|
|
1966
|
+
items: [],
|
|
1967
|
+
orientation: 'horizontal',
|
|
1968
|
+
dropPlaceholder: 'Drop item here'
|
|
1969
|
+
};
|
|
1970
|
+
this.busy = false;
|
|
1971
|
+
this.options = _extends({}, DEFAULTS, options);
|
|
1972
|
+
this.elementId = elementId;
|
|
1973
|
+
|
|
1974
|
+
if (!elementId) {
|
|
1975
|
+
console.log('No element Id provided for Websy DragDrop');
|
|
1976
|
+
return;
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
var el = document.getElementById(elementId);
|
|
1980
|
+
|
|
1981
|
+
if (el) {
|
|
1982
|
+
el.innerHTML = "\n <div id='".concat(this.elementId, "_container' class='websy-drag-drop-container ").concat(this.options.orientation, "'>\n <div>\n </div>\n ");
|
|
1983
|
+
el.addEventListener('click', this.handleClick.bind(this));
|
|
1984
|
+
el.addEventListener('dragstart', this.handleDragStart.bind(this));
|
|
1985
|
+
el.addEventListener('dragover', this.handleDragOver.bind(this));
|
|
1986
|
+
el.addEventListener('dragleave', this.handleDragLeave.bind(this));
|
|
1987
|
+
el.addEventListener('drop', this.handleDrop.bind(this));
|
|
1988
|
+
window.addEventListener('dragend', this.handleDragEnd.bind(this));
|
|
1989
|
+
} else {
|
|
1990
|
+
console.error("No element found with ID ".concat(this.elementId));
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
GlobalPubSub.subscribe(this.elementId, 'requestForDDItem', this.handleRequestForItem.bind(this));
|
|
1994
|
+
console.log('constructor dd');
|
|
1995
|
+
console.trace();
|
|
1996
|
+
GlobalPubSub.subscribe(this.elementId, 'add', this.addItem.bind(this));
|
|
1997
|
+
this.render();
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
_createClass(WebsyDragDrop, [{
|
|
2001
|
+
key: "addItem",
|
|
2002
|
+
value: function addItem(data) {
|
|
2003
|
+
if (data.target === this.elementId && this.busy === false) {
|
|
2004
|
+
this.busy = true;
|
|
2005
|
+
console.log('adding item to dd'); // check that an item with the same id doesn't already exist
|
|
2006
|
+
|
|
2007
|
+
var index = this.getItemIndex(data.item.id);
|
|
2008
|
+
|
|
2009
|
+
if (index === -1) {
|
|
2010
|
+
this.options.items.splice(data.index, 0, data.item);
|
|
2011
|
+
var startEl = document.getElementById("".concat(this.elementId, "start_item"));
|
|
2012
|
+
|
|
2013
|
+
if (startEl) {
|
|
2014
|
+
if (this.options.items.length === 0) {
|
|
2015
|
+
startEl.classList.add('empty');
|
|
2016
|
+
} else {
|
|
2017
|
+
startEl.classList.remove('empty');
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
|
|
2021
|
+
if (this.options.onItemAdded) {
|
|
2022
|
+
this.options.onItemAdded();
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
this.busy = false;
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
}, {
|
|
2030
|
+
key: "createItemHtml",
|
|
2031
|
+
value: function createItemHtml(elementId, index, item) {
|
|
2032
|
+
if (!item.id) {
|
|
2033
|
+
item.id = WebsyDesigns.Utils.createIdentity();
|
|
2034
|
+
}
|
|
2035
|
+
|
|
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 ");
|
|
2037
|
+
|
|
2038
|
+
if (item.component) {
|
|
2039
|
+
html += "<div id='".concat(item.id, "_component'></div>");
|
|
2040
|
+
} else {
|
|
2041
|
+
html += "".concat(item.html || item.label || '');
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
html += "\n </div>\n <div id='".concat(item.id, "_dropZone' class='websy-drop-zone droppable' data-index='").concat(item.id, "' data-side='right' data-id='").concat(item.id, "' data-placeholder='").concat(this.options.dropPlaceholder, "'></div> \n </div>\n ");
|
|
2045
|
+
return html;
|
|
2046
|
+
}
|
|
2047
|
+
}, {
|
|
2048
|
+
key: "getItemIndex",
|
|
2049
|
+
value: function getItemIndex(id) {
|
|
2050
|
+
for (var i = 0; i < this.options.items.length; i++) {
|
|
2051
|
+
if (this.options.items[i].id === id) {
|
|
2052
|
+
return i;
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
return -1;
|
|
2057
|
+
}
|
|
2058
|
+
}, {
|
|
2059
|
+
key: "handleClick",
|
|
2060
|
+
value: function handleClick(event) {}
|
|
2061
|
+
}, {
|
|
2062
|
+
key: "handleDragStart",
|
|
2063
|
+
value: function handleDragStart(event) {
|
|
2064
|
+
this.draggedId = event.target.getAttribute('data-id');
|
|
2065
|
+
event.dataTransfer.effectAllowed = 'move';
|
|
2066
|
+
event.dataTransfer.setData('application/wd-item', JSON.stringify({
|
|
2067
|
+
el: event.target.id,
|
|
2068
|
+
id: this.elementId,
|
|
2069
|
+
itemId: this.draggedId
|
|
2070
|
+
}));
|
|
2071
|
+
console.log('drag start', event);
|
|
2072
|
+
event.target.style.opacity = 0.5;
|
|
2073
|
+
this.dragging = true;
|
|
2074
|
+
}
|
|
2075
|
+
}, {
|
|
2076
|
+
key: "handleDragOver",
|
|
2077
|
+
value: function handleDragOver(event) {
|
|
2078
|
+
console.log('drag over', event.target.classList);
|
|
2079
|
+
|
|
2080
|
+
if (event.preventDefault) {
|
|
2081
|
+
event.preventDefault();
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
if (!event.target.classList.contains('droppable')) {
|
|
2085
|
+
return;
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
event.target.classList.add('drag-over');
|
|
2089
|
+
}
|
|
2090
|
+
}, {
|
|
2091
|
+
key: "handleDragLeave",
|
|
2092
|
+
value: function handleDragLeave(event) {
|
|
2093
|
+
console.log('drag leave', event.target.classList);
|
|
2094
|
+
|
|
2095
|
+
if (!event.target.classList.contains('droppable')) {
|
|
2096
|
+
return;
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
event.target.classList.remove('drag-over'); // let side = event.target.getAttribute('data-side')
|
|
2100
|
+
// let id = event.target.getAttribute('data-id')
|
|
2101
|
+
// let droppedItem = this.options.items[id]
|
|
2102
|
+
// this.removeExpandedDrop(side, id, droppedItem)
|
|
2103
|
+
}
|
|
2104
|
+
}, {
|
|
2105
|
+
key: "handleDrop",
|
|
2106
|
+
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('application/wd-item'));
|
|
2110
|
+
|
|
2111
|
+
if (event.preventDefault) {
|
|
2112
|
+
event.preventDefault();
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
if (!event.target.classList.contains('droppable')) {
|
|
2116
|
+
return;
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2119
|
+
var side = event.target.getAttribute('data-side');
|
|
2120
|
+
var id = event.target.getAttribute('data-id');
|
|
2121
|
+
var index = this.getItemIndex(id);
|
|
2122
|
+
var draggedIndex = this.getItemIndex(data.id);
|
|
2123
|
+
var droppedItem = this.options.items[index];
|
|
2124
|
+
|
|
2125
|
+
if (side === 'right') {
|
|
2126
|
+
index += 1;
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
if (draggedIndex === -1) {
|
|
2130
|
+
console.log('requestForDDItem');
|
|
2131
|
+
GlobalPubSub.publish(data.id, 'requestForDDItem', {
|
|
2132
|
+
group: this.options.group,
|
|
2133
|
+
source: data.id,
|
|
2134
|
+
target: this.elementId,
|
|
2135
|
+
index: index,
|
|
2136
|
+
id: data.itemId
|
|
2137
|
+
});
|
|
2138
|
+
} else if (index > draggedIndex) {
|
|
2139
|
+
// insert and then remove
|
|
2140
|
+
this.options.items.splice(index, 0, droppedItem);
|
|
2141
|
+
this.options.items.splice(draggedIndex, 1);
|
|
2142
|
+
|
|
2143
|
+
if (this.options.onOrderUpdated) {
|
|
2144
|
+
this.options.onOrderUpdated();
|
|
2145
|
+
}
|
|
2146
|
+
} else {
|
|
2147
|
+
// remove and then insert
|
|
2148
|
+
this.options.items.splice(draggedIndex, 1);
|
|
2149
|
+
this.options.items.splice(index, 0, droppedItem);
|
|
2150
|
+
|
|
2151
|
+
if (this.options.onOrderUpdated) {
|
|
2152
|
+
this.options.onOrderUpdated();
|
|
2153
|
+
}
|
|
2154
|
+
} // this.removeExpandedDrop(side, id, droppedItem)
|
|
2155
|
+
// const draggedEl = document.getElementById(`${this.elementId}_${this.draggedId}_item`)
|
|
2156
|
+
|
|
2157
|
+
|
|
2158
|
+
var draggedEl = document.getElementById(data.el);
|
|
2159
|
+
var droppedEl = document.getElementById("".concat(id, "_item"));
|
|
2160
|
+
|
|
2161
|
+
if (draggedEl) {
|
|
2162
|
+
droppedEl.insertAdjacentElement('afterend', draggedEl);
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
var dragOverEl = droppedEl.querySelector('.drag-over');
|
|
2166
|
+
|
|
2167
|
+
if (dragOverEl) {
|
|
2168
|
+
dragOverEl.classList.remove('drag-over');
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
}, {
|
|
2172
|
+
key: "handleDragEnd",
|
|
2173
|
+
value: function handleDragEnd(event) {
|
|
2174
|
+
console.log('drag end');
|
|
2175
|
+
event.target.style.opacity = 1;
|
|
2176
|
+
this.draggedId = null;
|
|
2177
|
+
this.dragging = false;
|
|
2178
|
+
var startEl = document.getElementById("".concat(this.elementId, "start_item"));
|
|
2179
|
+
|
|
2180
|
+
if (startEl) {
|
|
2181
|
+
if (this.options.items.length === 0) {
|
|
2182
|
+
startEl.classList.add('empty');
|
|
2183
|
+
} else {
|
|
2184
|
+
startEl.classList.remove('empty');
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
}, {
|
|
2189
|
+
key: "handleRequestForItem",
|
|
2190
|
+
value: function handleRequestForItem(data) {
|
|
2191
|
+
if (data.group === this.options.group) {
|
|
2192
|
+
var index = this.getItemIndex(data.id);
|
|
2193
|
+
|
|
2194
|
+
if (index !== -1) {
|
|
2195
|
+
var itemToAdd = this.options.items.splice(index, 1);
|
|
2196
|
+
GlobalPubSub.publish(data.target, 'add', {
|
|
2197
|
+
target: data.target,
|
|
2198
|
+
index: data.index,
|
|
2199
|
+
item: itemToAdd[0]
|
|
2200
|
+
});
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
}, {
|
|
2205
|
+
key: "measureItems",
|
|
2206
|
+
value: function measureItems() {
|
|
2207
|
+
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
2208
|
+
this.options.items.forEach(function (d) {});
|
|
2209
|
+
} // removeExpandedDrop (side, id, droppedItem) {
|
|
2210
|
+
// let dropEl
|
|
2211
|
+
// const dropImageEl = document.getElementById(`${id}_itemInner`)
|
|
2212
|
+
// // const placeholderEl = document.getElementById(`${this.elementId}_${id}_dropZonePlaceholder`)
|
|
2213
|
+
// if (side === 'left') {
|
|
2214
|
+
// dropEl = document.getElementById(`${this.elementId}_${id}_dropZoneLeft`)
|
|
2215
|
+
// dropImageEl.style.left = `0px`
|
|
2216
|
+
// }
|
|
2217
|
+
// else if (side === 'right') {
|
|
2218
|
+
// dropEl = document.getElementById(`${this.elementId}_${id}_dropZoneRight`)
|
|
2219
|
+
// }
|
|
2220
|
+
// else {
|
|
2221
|
+
// dropEl = document.getElementById(`${this.elementId}_${id}_dropZoneEnd`)
|
|
2222
|
+
// }
|
|
2223
|
+
// if (dropEl) {
|
|
2224
|
+
// const dropElSize = dropEl.getBoundingClientRect()
|
|
2225
|
+
// dropEl.style.width = `${(dropElSize.width / 2)}px`
|
|
2226
|
+
// dropEl.style.marginLeft = null
|
|
2227
|
+
// dropEl.style.border = null
|
|
2228
|
+
// }
|
|
2229
|
+
// if (placeholderEl) {
|
|
2230
|
+
// placeholderEl.classList.remove('active')
|
|
2231
|
+
// placeholderEl.style.left = null
|
|
2232
|
+
// placeholderEl.style.right = null
|
|
2233
|
+
// placeholderEl.style.width = null
|
|
2234
|
+
// placeholderEl.style.height = null
|
|
2235
|
+
// }
|
|
2236
|
+
// }
|
|
2237
|
+
|
|
2238
|
+
}, {
|
|
2239
|
+
key: "removeItem",
|
|
2240
|
+
value: function removeItem(id) {}
|
|
2241
|
+
}, {
|
|
2242
|
+
key: "render",
|
|
2243
|
+
value: function render() {
|
|
2244
|
+
var _this13 = this;
|
|
2245
|
+
|
|
2246
|
+
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
2247
|
+
|
|
2248
|
+
if (el) {
|
|
2249
|
+
this.measureItems();
|
|
2250
|
+
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
|
+
html += this.options.items.map(function (d, i) {
|
|
2252
|
+
return _this13.createItemHtml(_this13.elementId, i, d);
|
|
2253
|
+
}).join('');
|
|
2254
|
+
el.innerHTML = html;
|
|
2255
|
+
this.options.items.forEach(function (item, i) {
|
|
2256
|
+
if (item.component) {
|
|
2257
|
+
if (item.isQlikPlugin && WebsyDesigns.QlikPlugin[item.component]) {
|
|
2258
|
+
item.instance = new WebsyDesigns.QlikPlugin[item.component]("".concat(item.id, "_component"), item.options);
|
|
2259
|
+
} else if (WebsyDesigns[item.component]) {
|
|
2260
|
+
item.instance = new WebsyDesigns[item.component]("".concat(item.id, "_component"), item.options);
|
|
2261
|
+
} else {
|
|
2262
|
+
console.error("Component ".concat(item.component, " not found."));
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
});
|
|
2266
|
+
}
|
|
2267
|
+
}
|
|
2268
|
+
}]);
|
|
2269
|
+
|
|
2270
|
+
return WebsyDragDrop;
|
|
2271
|
+
}();
|
|
1948
2272
|
/* global WebsyDesigns FormData grecaptcha ENVIRONMENT GlobalPubSub */
|
|
1949
2273
|
|
|
1950
2274
|
|
|
@@ -2004,16 +2328,16 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2004
2328
|
}, {
|
|
2005
2329
|
key: "checkRecaptcha",
|
|
2006
2330
|
value: function checkRecaptcha() {
|
|
2007
|
-
var
|
|
2331
|
+
var _this14 = this;
|
|
2008
2332
|
|
|
2009
2333
|
return new Promise(function (resolve, reject) {
|
|
2010
|
-
if (
|
|
2334
|
+
if (_this14.options.useRecaptcha === true) {
|
|
2011
2335
|
// if (this.recaptchaValue) {
|
|
2012
2336
|
grecaptcha.ready(function () {
|
|
2013
2337
|
grecaptcha.execute(ENVIRONMENT.RECAPTCHA_KEY, {
|
|
2014
2338
|
action: 'submit'
|
|
2015
2339
|
}).then(function (token) {
|
|
2016
|
-
|
|
2340
|
+
_this14.apiService.add('google/checkrecaptcha', {
|
|
2017
2341
|
grecaptcharesponse: token
|
|
2018
2342
|
}).then(function (response) {
|
|
2019
2343
|
if (response.success && response.success === true) {
|
|
@@ -2076,14 +2400,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2076
2400
|
}, {
|
|
2077
2401
|
key: "processComponents",
|
|
2078
2402
|
value: function processComponents(components, callbackFn) {
|
|
2079
|
-
var
|
|
2403
|
+
var _this15 = this;
|
|
2080
2404
|
|
|
2081
2405
|
if (components.length === 0) {
|
|
2082
2406
|
callbackFn();
|
|
2083
2407
|
} else {
|
|
2084
2408
|
components.forEach(function (c) {
|
|
2085
2409
|
if (typeof WebsyDesigns[c.component] !== 'undefined') {
|
|
2086
|
-
c.instance = new WebsyDesigns[c.component]("".concat(
|
|
2410
|
+
c.instance = new WebsyDesigns[c.component]("".concat(_this15.elementId, "_input_").concat(c.field, "_component"), c.options);
|
|
2087
2411
|
} else {// some user feedback here
|
|
2088
2412
|
}
|
|
2089
2413
|
});
|
|
@@ -2104,7 +2428,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2104
2428
|
}, {
|
|
2105
2429
|
key: "render",
|
|
2106
2430
|
value: function render(update, data) {
|
|
2107
|
-
var
|
|
2431
|
+
var _this16 = this;
|
|
2108
2432
|
|
|
2109
2433
|
var el = document.getElementById(this.elementId);
|
|
2110
2434
|
var componentsToProcess = [];
|
|
@@ -2114,11 +2438,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2114
2438
|
this.options.fields.forEach(function (f, i) {
|
|
2115
2439
|
if (f.component) {
|
|
2116
2440
|
componentsToProcess.push(f);
|
|
2117
|
-
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(
|
|
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(_this16.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
|
|
2118
2442
|
} else if (f.type === 'longtext') {
|
|
2119
|
-
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(
|
|
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(_this16.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 ");
|
|
2120
2444
|
} else {
|
|
2121
|
-
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(
|
|
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(_this16.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 ");
|
|
2122
2446
|
}
|
|
2123
2447
|
});
|
|
2124
2448
|
html += "\n --><button class=\"websy-btn submit ".concat(this.options.submit.classes || '', "\">").concat(this.options.submit.text || 'Save', "</button>").concat(this.options.cancel ? '<!--' : '', "\n ");
|
|
@@ -2135,7 +2459,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2135
2459
|
|
|
2136
2460
|
el.innerHTML = html;
|
|
2137
2461
|
this.processComponents(componentsToProcess, function () {
|
|
2138
|
-
if (
|
|
2462
|
+
if (_this16.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {// this.recaptchaReady()
|
|
2139
2463
|
}
|
|
2140
2464
|
});
|
|
2141
2465
|
}
|
|
@@ -2143,7 +2467,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2143
2467
|
}, {
|
|
2144
2468
|
key: "submitForm",
|
|
2145
2469
|
value: function submitForm() {
|
|
2146
|
-
var
|
|
2470
|
+
var _this17 = this;
|
|
2147
2471
|
|
|
2148
2472
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
2149
2473
|
|
|
@@ -2157,32 +2481,32 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2157
2481
|
data[key] = value;
|
|
2158
2482
|
});
|
|
2159
2483
|
|
|
2160
|
-
if (
|
|
2161
|
-
var
|
|
2484
|
+
if (_this17.options.url) {
|
|
2485
|
+
var _this17$apiService;
|
|
2162
2486
|
|
|
2163
|
-
var params = [
|
|
2487
|
+
var params = [_this17.options.url];
|
|
2164
2488
|
|
|
2165
|
-
if (
|
|
2166
|
-
params.push(
|
|
2489
|
+
if (_this17.options.mode === 'update') {
|
|
2490
|
+
params.push(_this17.options.id);
|
|
2167
2491
|
}
|
|
2168
2492
|
|
|
2169
2493
|
params.push(data);
|
|
2170
2494
|
|
|
2171
|
-
(
|
|
2172
|
-
if (
|
|
2495
|
+
(_this17$apiService = _this17.apiService)[_this17.options.mode].apply(_this17$apiService, params).then(function (result) {
|
|
2496
|
+
if (_this17.options.clearAfterSave === true) {
|
|
2173
2497
|
// this.render()
|
|
2174
2498
|
formEl.reset();
|
|
2175
2499
|
}
|
|
2176
2500
|
|
|
2177
|
-
|
|
2501
|
+
_this17.options.onSuccess.call(_this17, result);
|
|
2178
2502
|
}, function (err) {
|
|
2179
2503
|
console.log('Error submitting form data:', err);
|
|
2180
2504
|
|
|
2181
|
-
|
|
2505
|
+
_this17.options.onError.call(_this17, err);
|
|
2182
2506
|
});
|
|
2183
|
-
} else if (
|
|
2184
|
-
|
|
2185
|
-
if (
|
|
2507
|
+
} else if (_this17.options.submitFn) {
|
|
2508
|
+
_this17.options.submitFn(data, function () {
|
|
2509
|
+
if (_this17.options.clearAfterSave === true) {
|
|
2186
2510
|
// this.render()
|
|
2187
2511
|
formEl.reset();
|
|
2188
2512
|
}
|
|
@@ -2202,17 +2526,17 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2202
2526
|
}, {
|
|
2203
2527
|
key: "data",
|
|
2204
2528
|
set: function set(d) {
|
|
2205
|
-
var
|
|
2529
|
+
var _this18 = this;
|
|
2206
2530
|
|
|
2207
2531
|
if (!this.options.fields) {
|
|
2208
2532
|
this.options.fields = [];
|
|
2209
2533
|
}
|
|
2210
2534
|
|
|
2211
2535
|
var _loop = function _loop(key) {
|
|
2212
|
-
|
|
2536
|
+
_this18.options.fields.forEach(function (f) {
|
|
2213
2537
|
if (f.field === key) {
|
|
2214
2538
|
f.value = d[key];
|
|
2215
|
-
var el = document.getElementById("".concat(
|
|
2539
|
+
var el = document.getElementById("".concat(_this18.elementId, "_input_").concat(f.field));
|
|
2216
2540
|
el.value = f.value;
|
|
2217
2541
|
}
|
|
2218
2542
|
});
|
|
@@ -2591,7 +2915,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2591
2915
|
|
|
2592
2916
|
var Pager = /*#__PURE__*/function () {
|
|
2593
2917
|
function Pager(elementId, options) {
|
|
2594
|
-
var
|
|
2918
|
+
var _this19 = this;
|
|
2595
2919
|
|
|
2596
2920
|
_classCallCheck(this, Pager);
|
|
2597
2921
|
|
|
@@ -2644,8 +2968,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2644
2968
|
allowClear: false,
|
|
2645
2969
|
disableSearch: true,
|
|
2646
2970
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
2647
|
-
if (
|
|
2648
|
-
|
|
2971
|
+
if (_this19.options.onChangePageSize) {
|
|
2972
|
+
_this19.options.onChangePageSize(selectedItem.value);
|
|
2649
2973
|
}
|
|
2650
2974
|
}
|
|
2651
2975
|
});
|
|
@@ -2669,13 +2993,13 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2669
2993
|
}, {
|
|
2670
2994
|
key: "render",
|
|
2671
2995
|
value: function render() {
|
|
2672
|
-
var
|
|
2996
|
+
var _this20 = this;
|
|
2673
2997
|
|
|
2674
2998
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
2675
2999
|
|
|
2676
3000
|
if (el) {
|
|
2677
3001
|
var pages = this.options.pages.map(function (item, index) {
|
|
2678
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
3002
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this20.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
2679
3003
|
});
|
|
2680
3004
|
var startIndex = 0;
|
|
2681
3005
|
|
|
@@ -2743,58 +3067,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2743
3067
|
_createClass(WebsyPDFButton, [{
|
|
2744
3068
|
key: "handleClick",
|
|
2745
3069
|
value: function handleClick(event) {
|
|
2746
|
-
var
|
|
3070
|
+
var _this21 = this;
|
|
2747
3071
|
|
|
2748
3072
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
2749
3073
|
this.loader.show();
|
|
2750
3074
|
setTimeout(function () {
|
|
2751
|
-
if (
|
|
2752
|
-
var el = document.getElementById(
|
|
3075
|
+
if (_this21.options.targetId) {
|
|
3076
|
+
var el = document.getElementById(_this21.options.targetId);
|
|
2753
3077
|
|
|
2754
3078
|
if (el) {
|
|
2755
3079
|
var pdfData = {
|
|
2756
3080
|
options: {}
|
|
2757
3081
|
};
|
|
2758
3082
|
|
|
2759
|
-
if (
|
|
2760
|
-
pdfData.options = _extends({},
|
|
3083
|
+
if (_this21.options.pdfOptions) {
|
|
3084
|
+
pdfData.options = _extends({}, _this21.options.pdfOptions);
|
|
2761
3085
|
}
|
|
2762
3086
|
|
|
2763
|
-
if (
|
|
2764
|
-
if (
|
|
2765
|
-
var headerEl = document.getElementById(
|
|
3087
|
+
if (_this21.options.header) {
|
|
3088
|
+
if (_this21.options.header.elementId) {
|
|
3089
|
+
var headerEl = document.getElementById(_this21.options.header.elementId);
|
|
2766
3090
|
|
|
2767
3091
|
if (headerEl) {
|
|
2768
3092
|
pdfData.header = headerEl.outerHTML;
|
|
2769
3093
|
|
|
2770
|
-
if (
|
|
2771
|
-
pdfData.options.headerCSS =
|
|
3094
|
+
if (_this21.options.header.css) {
|
|
3095
|
+
pdfData.options.headerCSS = _this21.options.header.css;
|
|
2772
3096
|
}
|
|
2773
3097
|
}
|
|
2774
|
-
} else if (
|
|
2775
|
-
pdfData.header =
|
|
3098
|
+
} else if (_this21.options.header.html) {
|
|
3099
|
+
pdfData.header = _this21.options.header.html;
|
|
2776
3100
|
|
|
2777
|
-
if (
|
|
2778
|
-
pdfData.options.headerCSS =
|
|
3101
|
+
if (_this21.options.header.css) {
|
|
3102
|
+
pdfData.options.headerCSS = _this21.options.header.css;
|
|
2779
3103
|
}
|
|
2780
3104
|
} else {
|
|
2781
|
-
pdfData.header =
|
|
3105
|
+
pdfData.header = _this21.options.header;
|
|
2782
3106
|
}
|
|
2783
3107
|
}
|
|
2784
3108
|
|
|
2785
|
-
if (
|
|
2786
|
-
if (
|
|
2787
|
-
var footerEl = document.getElementById(
|
|
3109
|
+
if (_this21.options.footer) {
|
|
3110
|
+
if (_this21.options.footer.elementId) {
|
|
3111
|
+
var footerEl = document.getElementById(_this21.options.footer.elementId);
|
|
2788
3112
|
|
|
2789
3113
|
if (footerEl) {
|
|
2790
3114
|
pdfData.footer = footerEl.outerHTML;
|
|
2791
3115
|
|
|
2792
|
-
if (
|
|
2793
|
-
pdfData.options.footerCSS =
|
|
3116
|
+
if (_this21.options.footer.css) {
|
|
3117
|
+
pdfData.options.footerCSS = _this21.options.footer.css;
|
|
2794
3118
|
}
|
|
2795
3119
|
}
|
|
2796
3120
|
} else {
|
|
2797
|
-
pdfData.footer =
|
|
3121
|
+
pdfData.footer = _this21.options.footer;
|
|
2798
3122
|
}
|
|
2799
3123
|
}
|
|
2800
3124
|
|
|
@@ -2803,31 +3127,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2803
3127
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
2804
3128
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
2805
3129
|
|
|
2806
|
-
|
|
3130
|
+
_this21.service.add('', pdfData, {
|
|
2807
3131
|
responseType: 'blob'
|
|
2808
3132
|
}).then(function (response) {
|
|
2809
|
-
|
|
3133
|
+
_this21.loader.hide();
|
|
2810
3134
|
|
|
2811
3135
|
var blob = new Blob([response], {
|
|
2812
3136
|
type: 'application/pdf'
|
|
2813
3137
|
});
|
|
2814
3138
|
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 ");
|
|
2815
3139
|
|
|
2816
|
-
if (
|
|
3140
|
+
if (_this21.options.directDownload === true) {
|
|
2817
3141
|
var fileName;
|
|
2818
3142
|
|
|
2819
|
-
if (typeof
|
|
2820
|
-
fileName =
|
|
3143
|
+
if (typeof _this21.options.fileName === 'function') {
|
|
3144
|
+
fileName = _this21.options.fileName() || 'Export';
|
|
2821
3145
|
} else {
|
|
2822
|
-
fileName =
|
|
3146
|
+
fileName = _this21.options.fileName || 'Export';
|
|
2823
3147
|
}
|
|
2824
3148
|
|
|
2825
3149
|
msg += "download='".concat(fileName, ".pdf'");
|
|
2826
3150
|
}
|
|
2827
3151
|
|
|
2828
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
3152
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this21.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
2829
3153
|
|
|
2830
|
-
|
|
3154
|
+
_this21.popup.show({
|
|
2831
3155
|
message: msg,
|
|
2832
3156
|
mask: true
|
|
2833
3157
|
});
|
|
@@ -2989,21 +3313,37 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
2989
3313
|
|
|
2990
3314
|
_createClass(WebsyPubSub, [{
|
|
2991
3315
|
key: "publish",
|
|
2992
|
-
value: function publish(method, data) {
|
|
2993
|
-
if (
|
|
2994
|
-
this.subscriptions[method]
|
|
2995
|
-
|
|
2996
|
-
}
|
|
3316
|
+
value: function publish(id, method, data) {
|
|
3317
|
+
if (arguments.length === 3) {
|
|
3318
|
+
if (this.subscriptions[id] && this.subscriptions[id][method]) {
|
|
3319
|
+
this.subscriptions[id][method](data);
|
|
3320
|
+
}
|
|
3321
|
+
} else {
|
|
3322
|
+
if (this.subscriptions[method]) {
|
|
3323
|
+
this.subscriptions[method].forEach(function (fn) {
|
|
3324
|
+
fn(data);
|
|
3325
|
+
});
|
|
3326
|
+
}
|
|
2997
3327
|
}
|
|
2998
3328
|
}
|
|
2999
3329
|
}, {
|
|
3000
3330
|
key: "subscribe",
|
|
3001
|
-
value: function subscribe(method, fn) {
|
|
3002
|
-
if (
|
|
3003
|
-
this.subscriptions[
|
|
3004
|
-
|
|
3331
|
+
value: function subscribe(id, method, fn) {
|
|
3332
|
+
if (arguments.length === 3) {
|
|
3333
|
+
if (!this.subscriptions[id]) {
|
|
3334
|
+
this.subscriptions[id] = {};
|
|
3335
|
+
}
|
|
3005
3336
|
|
|
3006
|
-
|
|
3337
|
+
if (!this.subscriptions[id][method]) {
|
|
3338
|
+
this.subscriptions[id][method] = fn;
|
|
3339
|
+
}
|
|
3340
|
+
} else {
|
|
3341
|
+
if (!this.subscriptions[method]) {
|
|
3342
|
+
this.subscriptions[method] = [];
|
|
3343
|
+
}
|
|
3344
|
+
|
|
3345
|
+
this.subscriptions[method].push(fn);
|
|
3346
|
+
}
|
|
3007
3347
|
}
|
|
3008
3348
|
}]);
|
|
3009
3349
|
|
|
@@ -3012,7 +3352,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3012
3352
|
|
|
3013
3353
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
3014
3354
|
function ResponsiveText(elementId, options) {
|
|
3015
|
-
var
|
|
3355
|
+
var _this22 = this;
|
|
3016
3356
|
|
|
3017
3357
|
_classCallCheck(this, ResponsiveText);
|
|
3018
3358
|
|
|
@@ -3025,7 +3365,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3025
3365
|
this.elementId = elementId;
|
|
3026
3366
|
this.canvas = document.createElement('canvas');
|
|
3027
3367
|
window.addEventListener('resize', function () {
|
|
3028
|
-
return
|
|
3368
|
+
return _this22.render();
|
|
3029
3369
|
});
|
|
3030
3370
|
var el = document.getElementById(this.elementId);
|
|
3031
3371
|
|
|
@@ -3244,7 +3584,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3244
3584
|
|
|
3245
3585
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3246
3586
|
function WebsyResultList(elementId, options) {
|
|
3247
|
-
var
|
|
3587
|
+
var _this23 = this;
|
|
3248
3588
|
|
|
3249
3589
|
_classCallCheck(this, WebsyResultList);
|
|
3250
3590
|
|
|
@@ -3272,9 +3612,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3272
3612
|
|
|
3273
3613
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3274
3614
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3275
|
-
|
|
3615
|
+
_this23.options.template = templateString;
|
|
3276
3616
|
|
|
3277
|
-
|
|
3617
|
+
_this23.render();
|
|
3278
3618
|
});
|
|
3279
3619
|
} else {
|
|
3280
3620
|
this.render();
|
|
@@ -3293,7 +3633,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3293
3633
|
}, {
|
|
3294
3634
|
key: "buildHTML",
|
|
3295
3635
|
value: function buildHTML(d) {
|
|
3296
|
-
var
|
|
3636
|
+
var _this24 = this;
|
|
3297
3637
|
|
|
3298
3638
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3299
3639
|
var html = "";
|
|
@@ -3301,7 +3641,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3301
3641
|
if (this.options.template) {
|
|
3302
3642
|
if (d.length > 0) {
|
|
3303
3643
|
d.forEach(function (row, ix) {
|
|
3304
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(
|
|
3644
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(_this24.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
3305
3645
|
|
|
3306
3646
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3307
3647
|
|
|
@@ -3421,7 +3761,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3421
3761
|
}, {
|
|
3422
3762
|
key: "handleClick",
|
|
3423
3763
|
value: function handleClick(event) {
|
|
3424
|
-
var
|
|
3764
|
+
var _this25 = this;
|
|
3425
3765
|
|
|
3426
3766
|
if (event.target.classList.contains('clickable')) {
|
|
3427
3767
|
var l = event.target.getAttribute('data-event');
|
|
@@ -3439,8 +3779,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3439
3779
|
l = l[0];
|
|
3440
3780
|
params = params.map(function (p) {
|
|
3441
3781
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
3442
|
-
if (
|
|
3443
|
-
p =
|
|
3782
|
+
if (_this25.rows[+id]) {
|
|
3783
|
+
p = _this25.rows[+id][p];
|
|
3444
3784
|
}
|
|
3445
3785
|
} else if (typeof p === 'string') {
|
|
3446
3786
|
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
@@ -3462,13 +3802,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3462
3802
|
}, {
|
|
3463
3803
|
key: "render",
|
|
3464
3804
|
value: function render() {
|
|
3465
|
-
var
|
|
3805
|
+
var _this26 = this;
|
|
3466
3806
|
|
|
3467
3807
|
if (this.options.entity) {
|
|
3468
3808
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
3469
|
-
|
|
3809
|
+
_this26.rows = results.rows;
|
|
3470
3810
|
|
|
3471
|
-
|
|
3811
|
+
_this26.resize();
|
|
3472
3812
|
});
|
|
3473
3813
|
} else {
|
|
3474
3814
|
this.resize();
|
|
@@ -3547,14 +3887,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3547
3887
|
_createClass(WebsyRouter, [{
|
|
3548
3888
|
key: "addGroup",
|
|
3549
3889
|
value: function addGroup(group) {
|
|
3550
|
-
var
|
|
3890
|
+
var _this27 = this;
|
|
3551
3891
|
|
|
3552
3892
|
if (!this.groups[group]) {
|
|
3553
3893
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3554
3894
|
|
|
3555
3895
|
if (els) {
|
|
3556
3896
|
this.getClosestParent(els[0], function (parent) {
|
|
3557
|
-
|
|
3897
|
+
_this27.groups[group] = {
|
|
3558
3898
|
activeView: '',
|
|
3559
3899
|
views: [],
|
|
3560
3900
|
parent: parent.getAttribute('data-view')
|
|
@@ -3879,12 +4219,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3879
4219
|
}, {
|
|
3880
4220
|
key: "showComponents",
|
|
3881
4221
|
value: function showComponents(view) {
|
|
3882
|
-
var
|
|
4222
|
+
var _this28 = this;
|
|
3883
4223
|
|
|
3884
4224
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
3885
4225
|
this.options.views[view].components.forEach(function (c) {
|
|
3886
4226
|
if (typeof c.instance === 'undefined') {
|
|
3887
|
-
|
|
4227
|
+
_this28.prepComponent(c.elementId, c.options);
|
|
3888
4228
|
|
|
3889
4229
|
c.instance = new c.Component(c.elementId, c.options);
|
|
3890
4230
|
} else if (c.instance.render) {
|
|
@@ -4312,7 +4652,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
4312
4652
|
|
|
4313
4653
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
4314
4654
|
function WebsyTemplate(elementId, options) {
|
|
4315
|
-
var
|
|
4655
|
+
var _this29 = this;
|
|
4316
4656
|
|
|
4317
4657
|
_classCallCheck(this, WebsyTemplate);
|
|
4318
4658
|
|
|
@@ -4338,9 +4678,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4338
4678
|
|
|
4339
4679
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4340
4680
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4341
|
-
|
|
4681
|
+
_this29.options.template = templateString;
|
|
4342
4682
|
|
|
4343
|
-
|
|
4683
|
+
_this29.render();
|
|
4344
4684
|
});
|
|
4345
4685
|
} else {
|
|
4346
4686
|
this.render();
|
|
@@ -4350,7 +4690,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4350
4690
|
_createClass(WebsyTemplate, [{
|
|
4351
4691
|
key: "buildHTML",
|
|
4352
4692
|
value: function buildHTML() {
|
|
4353
|
-
var
|
|
4693
|
+
var _this30 = this;
|
|
4354
4694
|
|
|
4355
4695
|
var html = "";
|
|
4356
4696
|
|
|
@@ -4412,14 +4752,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4412
4752
|
}
|
|
4413
4753
|
|
|
4414
4754
|
if (polarity === true) {
|
|
4415
|
-
if (typeof
|
|
4755
|
+
if (typeof _this30.options.data[parts[0]] !== 'undefined' && _this30.options.data[parts[0]] === parts[1]) {
|
|
4416
4756
|
// remove the <if> tags
|
|
4417
4757
|
removeAll = false;
|
|
4418
4758
|
} else if (parts[0] === parts[1]) {
|
|
4419
4759
|
removeAll = false;
|
|
4420
4760
|
}
|
|
4421
4761
|
} else if (polarity === false) {
|
|
4422
|
-
if (typeof
|
|
4762
|
+
if (typeof _this30.options.data[parts[0]] !== 'undefined' && _this30.options.data[parts[0]] !== parts[1]) {
|
|
4423
4763
|
// remove the <if> tags
|
|
4424
4764
|
removeAll = false;
|
|
4425
4765
|
}
|
|
@@ -4706,7 +5046,7 @@ var WebsyUtils = {
|
|
|
4706
5046
|
|
|
4707
5047
|
var WebsyTable = /*#__PURE__*/function () {
|
|
4708
5048
|
function WebsyTable(elementId, options) {
|
|
4709
|
-
var
|
|
5049
|
+
var _this31 = this;
|
|
4710
5050
|
|
|
4711
5051
|
_classCallCheck(this, WebsyTable);
|
|
4712
5052
|
|
|
@@ -4744,8 +5084,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4744
5084
|
allowClear: false,
|
|
4745
5085
|
disableSearch: true,
|
|
4746
5086
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4747
|
-
if (
|
|
4748
|
-
|
|
5087
|
+
if (_this31.options.onChangePageSize) {
|
|
5088
|
+
_this31.options.onChangePageSize(selectedItem.value);
|
|
4749
5089
|
}
|
|
4750
5090
|
}
|
|
4751
5091
|
});
|
|
@@ -4766,7 +5106,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4766
5106
|
_createClass(WebsyTable, [{
|
|
4767
5107
|
key: "appendRows",
|
|
4768
5108
|
value: function appendRows(data) {
|
|
4769
|
-
var
|
|
5109
|
+
var _this32 = this;
|
|
4770
5110
|
|
|
4771
5111
|
this.hideError();
|
|
4772
5112
|
var bodyHTML = '';
|
|
@@ -4774,15 +5114,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4774
5114
|
if (data) {
|
|
4775
5115
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4776
5116
|
return '<tr>' + r.map(function (c, i) {
|
|
4777
|
-
if (
|
|
5117
|
+
if (_this32.options.columns[i].show !== false) {
|
|
4778
5118
|
var style = '';
|
|
4779
5119
|
|
|
4780
5120
|
if (c.style) {
|
|
4781
5121
|
style += c.style;
|
|
4782
5122
|
}
|
|
4783
5123
|
|
|
4784
|
-
if (
|
|
4785
|
-
style += "width: ".concat(
|
|
5124
|
+
if (_this32.options.columns[i].width) {
|
|
5125
|
+
style += "width: ".concat(_this32.options.columns[i].width, "; ");
|
|
4786
5126
|
}
|
|
4787
5127
|
|
|
4788
5128
|
if (c.backgroundColor) {
|
|
@@ -4797,18 +5137,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4797
5137
|
style += "color: ".concat(c.color, "; ");
|
|
4798
5138
|
}
|
|
4799
5139
|
|
|
4800
|
-
if (
|
|
4801
|
-
return "\n <td \n data-row-index='".concat(
|
|
4802
|
-
} else if ((
|
|
4803
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5140
|
+
if (_this32.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5141
|
+
return "\n <td \n data-row-index='".concat(_this32.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this32.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this32.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this32.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5142
|
+
} else if ((_this32.options.columns[i].showAsNavigatorLink === true || _this32.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5143
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this32.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this32.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this32.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this32.options.columns[i].linkText || c.value, "</td>\n ");
|
|
4804
5144
|
} else {
|
|
4805
5145
|
var info = c.value;
|
|
4806
5146
|
|
|
4807
|
-
if (
|
|
5147
|
+
if (_this32.options.columns[i].showAsImage === true) {
|
|
4808
5148
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4809
5149
|
}
|
|
4810
5150
|
|
|
4811
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5151
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this32.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this32.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
|
|
4812
5152
|
}
|
|
4813
5153
|
}
|
|
4814
5154
|
}).join('') + '</tr>';
|
|
@@ -4980,7 +5320,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4980
5320
|
}, {
|
|
4981
5321
|
key: "render",
|
|
4982
5322
|
value: function render(data) {
|
|
4983
|
-
var
|
|
5323
|
+
var _this33 = this;
|
|
4984
5324
|
|
|
4985
5325
|
if (!this.options.columns) {
|
|
4986
5326
|
return;
|
|
@@ -5005,7 +5345,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5005
5345
|
|
|
5006
5346
|
var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
|
|
5007
5347
|
if (c.show !== false) {
|
|
5008
|
-
return "\n <th ".concat(c.width ? 'style="width: ' + (c.width || 'auto') + ';"' : '', ">\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 ?
|
|
5348
|
+
return "\n <th ".concat(c.width ? 'style="width: ' + (c.width || 'auto') + ';"' : '', ">\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 ");
|
|
5009
5349
|
}
|
|
5010
5350
|
}).join('') + '</tr>';
|
|
5011
5351
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5024,7 +5364,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5024
5364
|
|
|
5025
5365
|
if (pagingEl) {
|
|
5026
5366
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5027
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5367
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this33.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5028
5368
|
});
|
|
5029
5369
|
var startIndex = 0;
|
|
5030
5370
|
|
|
@@ -5092,7 +5432,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5092
5432
|
|
|
5093
5433
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5094
5434
|
function WebsyTable2(elementId, options) {
|
|
5095
|
-
var
|
|
5435
|
+
var _this34 = this;
|
|
5096
5436
|
|
|
5097
5437
|
_classCallCheck(this, WebsyTable2);
|
|
5098
5438
|
|
|
@@ -5133,8 +5473,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5133
5473
|
allowClear: false,
|
|
5134
5474
|
disableSearch: true,
|
|
5135
5475
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5136
|
-
if (
|
|
5137
|
-
|
|
5476
|
+
if (_this34.options.onChangePageSize) {
|
|
5477
|
+
_this34.options.onChangePageSize(selectedItem.value);
|
|
5138
5478
|
}
|
|
5139
5479
|
}
|
|
5140
5480
|
});
|
|
@@ -5158,7 +5498,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5158
5498
|
_createClass(WebsyTable2, [{
|
|
5159
5499
|
key: "appendRows",
|
|
5160
5500
|
value: function appendRows(data) {
|
|
5161
|
-
var
|
|
5501
|
+
var _this35 = this;
|
|
5162
5502
|
|
|
5163
5503
|
this.hideError();
|
|
5164
5504
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -5167,15 +5507,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5167
5507
|
if (data) {
|
|
5168
5508
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5169
5509
|
return '<tr>' + r.map(function (c, i) {
|
|
5170
|
-
if (
|
|
5171
|
-
var style = "height: ".concat(
|
|
5510
|
+
if (_this35.options.columns[i].show !== false) {
|
|
5511
|
+
var style = "height: ".concat(_this35.options.cellSize, "px; line-height: ").concat(_this35.options.cellSize, "px;");
|
|
5172
5512
|
|
|
5173
5513
|
if (c.style) {
|
|
5174
5514
|
style += c.style;
|
|
5175
5515
|
}
|
|
5176
5516
|
|
|
5177
|
-
if (
|
|
5178
|
-
style += "width: ".concat(
|
|
5517
|
+
if (_this35.options.columns[i].width) {
|
|
5518
|
+
style += "width: ".concat(_this35.options.columns[i].width, "; ");
|
|
5179
5519
|
}
|
|
5180
5520
|
|
|
5181
5521
|
if (c.backgroundColor) {
|
|
@@ -5190,18 +5530,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5190
5530
|
style += "color: ".concat(c.color, "; ");
|
|
5191
5531
|
}
|
|
5192
5532
|
|
|
5193
|
-
if (
|
|
5194
|
-
return "\n <td \n data-row-index='".concat(
|
|
5195
|
-
} else if ((
|
|
5196
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5533
|
+
if (_this35.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5534
|
+
return "\n <td \n data-row-index='".concat(_this35.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this35.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this35.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this35.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5535
|
+
} else if ((_this35.options.columns[i].showAsNavigatorLink === true || _this35.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5536
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this35.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this35.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this35.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this35.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5197
5537
|
} else {
|
|
5198
5538
|
var info = c.value;
|
|
5199
5539
|
|
|
5200
|
-
if (
|
|
5540
|
+
if (_this35.options.columns[i].showAsImage === true) {
|
|
5201
5541
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5202
5542
|
}
|
|
5203
5543
|
|
|
5204
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5544
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this35.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this35.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
|
|
5205
5545
|
}
|
|
5206
5546
|
}
|
|
5207
5547
|
}).join('') + '</tr>';
|
|
@@ -5414,7 +5754,11 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5414
5754
|
}, {
|
|
5415
5755
|
key: "hideLoading",
|
|
5416
5756
|
value: function hideLoading() {
|
|
5417
|
-
this.
|
|
5757
|
+
if (this.options.onLoading) {
|
|
5758
|
+
this.options.onLoading(false);
|
|
5759
|
+
} else {
|
|
5760
|
+
this.loadingDialog.hide();
|
|
5761
|
+
}
|
|
5418
5762
|
}
|
|
5419
5763
|
}, {
|
|
5420
5764
|
key: "internalSort",
|
|
@@ -5460,7 +5804,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5460
5804
|
}, {
|
|
5461
5805
|
key: "render",
|
|
5462
5806
|
value: function render(data) {
|
|
5463
|
-
var
|
|
5807
|
+
var _this36 = this;
|
|
5464
5808
|
|
|
5465
5809
|
if (!this.options.columns) {
|
|
5466
5810
|
return;
|
|
@@ -5496,7 +5840,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5496
5840
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
5497
5841
|
}
|
|
5498
5842
|
|
|
5499
|
-
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-sort-index=\"").concat(c.sortIndex || i, "\"\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 ?
|
|
5843
|
+
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-sort-index=\"").concat(c.sortIndex || i, "\"\n data-index=\"").concat(i, "\"\n data-sort=\"").concat(c.sort, "\"\n style=\"").concat(c.style || '', "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n ").concat(c.searchable === true ? _this36.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5500
5844
|
}
|
|
5501
5845
|
}).join('') + '</tr>';
|
|
5502
5846
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5507,7 +5851,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5507
5851
|
var dropdownHTML = "";
|
|
5508
5852
|
this.options.columns.forEach(function (c, i) {
|
|
5509
5853
|
if (c.searchable && c.searchField) {
|
|
5510
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
5854
|
+
dropdownHTML += "\n <div id=\"".concat(_this36.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
5511
5855
|
}
|
|
5512
5856
|
});
|
|
5513
5857
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -5529,7 +5873,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5529
5873
|
|
|
5530
5874
|
if (pagingEl) {
|
|
5531
5875
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5532
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5876
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this36.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5533
5877
|
});
|
|
5534
5878
|
var startIndex = 0;
|
|
5535
5879
|
|
|
@@ -5611,12 +5955,16 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5611
5955
|
}, {
|
|
5612
5956
|
key: "showLoading",
|
|
5613
5957
|
value: function showLoading(options) {
|
|
5614
|
-
this.
|
|
5958
|
+
if (this.options.onLoading) {
|
|
5959
|
+
this.options.onLoading(true);
|
|
5960
|
+
} else {
|
|
5961
|
+
this.loadingDialog.show(options);
|
|
5962
|
+
}
|
|
5615
5963
|
}
|
|
5616
5964
|
}, {
|
|
5617
5965
|
key: "getColumnParameters",
|
|
5618
5966
|
value: function getColumnParameters(values) {
|
|
5619
|
-
var
|
|
5967
|
+
var _this37 = this;
|
|
5620
5968
|
|
|
5621
5969
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
5622
5970
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -5624,10 +5972,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5624
5972
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
5625
5973
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5626
5974
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
5627
|
-
return "\n <th>\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField\" \n >\n ".concat(c.value || 'nbsp;', "\n </div>\n </div> \n ").concat(c.searchable === true ?
|
|
5975
|
+
return "\n <th>\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField\" \n >\n ".concat(c.value || 'nbsp;', "\n </div>\n </div> \n ").concat(c.searchable === true ? _this37.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5628
5976
|
}).join('') + '</tr>';
|
|
5629
5977
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
5630
|
-
return "\n <td \n style='height: ".concat(
|
|
5978
|
+
return "\n <td \n style='height: ".concat(_this37.options.cellSize, "px; line-height: ").concat(_this37.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
5631
5979
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
5632
5980
|
|
|
5633
5981
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -5672,12 +6020,639 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5672
6020
|
|
|
5673
6021
|
return WebsyTable2;
|
|
5674
6022
|
}();
|
|
6023
|
+
/* global WebsyDesigns */
|
|
6024
|
+
|
|
6025
|
+
|
|
6026
|
+
var WebsyTable3 = /*#__PURE__*/function () {
|
|
6027
|
+
function WebsyTable3(elementId, options) {
|
|
6028
|
+
_classCallCheck(this, WebsyTable3);
|
|
6029
|
+
|
|
6030
|
+
this.elementId = elementId;
|
|
6031
|
+
var DEFAULTS = {
|
|
6032
|
+
virtualScroll: false,
|
|
6033
|
+
showTotalsAbove: true,
|
|
6034
|
+
minHandleSize: 20,
|
|
6035
|
+
maxColWidth: '50%',
|
|
6036
|
+
allowPivoting: false
|
|
6037
|
+
};
|
|
6038
|
+
this.options = _extends({}, DEFAULTS, options);
|
|
6039
|
+
this.sizes = {};
|
|
6040
|
+
this.scrollDragging = false;
|
|
6041
|
+
this.cellDragging = false;
|
|
6042
|
+
this.vScrollRequired = false;
|
|
6043
|
+
this.hScrollRequired = false;
|
|
6044
|
+
this.pinnedColumns = 0;
|
|
6045
|
+
this.startRow = 0;
|
|
6046
|
+
this.endRow = 0;
|
|
6047
|
+
this.startCol = 0;
|
|
6048
|
+
this.endCol = 0;
|
|
6049
|
+
this.mouseYStart = 0;
|
|
6050
|
+
this.mouseYStart = 0;
|
|
6051
|
+
|
|
6052
|
+
if (!elementId) {
|
|
6053
|
+
console.log('No element Id provided for Websy Table');
|
|
6054
|
+
return;
|
|
6055
|
+
}
|
|
6056
|
+
|
|
6057
|
+
var el = document.getElementById(this.elementId);
|
|
6058
|
+
|
|
6059
|
+
if (el) {
|
|
6060
|
+
var html = "\n <div id='".concat(this.elementId, "_tableContainer' class='websy-vis-table-3 ").concat(this.options.paging === 'pages' ? 'with-paging' : '', " ").concat(this.options.virtualScroll === true ? 'with-virtual-scroll' : '', "'>\n <!--<div class=\"download-button\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M16 11h5l-9 10-9-10h5v-11h8v11zm1 11h-10v2h10v-2z\"/></svg>\n </div>-->\n <div id=\"").concat(this.elementId, "_tableInner\" class=\"websy-table-inner-container\">\n <table id=\"").concat(this.elementId, "_tableHeader\" class=\"websy-table-header\"></table>\n <table id=\"").concat(this.elementId, "_tableBody\" class=\"websy-table-body\"></table>\n <table id=\"").concat(this.elementId, "_tableFooter\" class=\"websy-table-footer\"></table>\n <div id=\"").concat(this.elementId, "_vScrollContainer\" class=\"websy-v-scroll-container\">\n <div id=\"").concat(this.elementId, "_vScrollHandle\" class=\"websy-scroll-handle websy-scroll-handle-y\"></div>\n </div>\n <div id=\"").concat(this.elementId, "_hScrollContainer\" class=\"websy-h-scroll-container\">\n <div id=\"").concat(this.elementId, "_hScrollHandle\" class=\"websy-scroll-handle websy-scroll-handle-x\"></div>\n </div>\n </div> \n <div id=\"").concat(this.elementId, "_errorContainer\" class='websy-vis-error-container'>\n <div>\n <div id=\"").concat(this.elementId, "_errorTitle\"></div>\n <div id=\"").concat(this.elementId, "_errorMessage\"></div>\n </div> \n </div>\n <div id=\"").concat(this.elementId, "_dropdownContainer\"></div>\n <div id=\"").concat(this.elementId, "_loadingContainer\"></div>\n </div>\n ");
|
|
6061
|
+
|
|
6062
|
+
if (this.options.paging === 'pages') {
|
|
6063
|
+
html += "\n <div class=\"websy-table-paging-container\">\n Show <div id=\"".concat(this.elementId, "_pageSizeSelector\" class=\"websy-vis-page-selector\"></div> rows\n <ul id=\"").concat(this.elementId, "_pageList\" class=\"websy-vis-page-list\"></ul>\n </div>\n ");
|
|
6064
|
+
}
|
|
6065
|
+
|
|
6066
|
+
el.innerHTML = html;
|
|
6067
|
+
el.addEventListener('click', this.handleClick.bind(this));
|
|
6068
|
+
el.addEventListener('mousedown', this.handleMouseDown.bind(this));
|
|
6069
|
+
window.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
6070
|
+
window.addEventListener('mouseup', this.handleMouseUp.bind(this));
|
|
6071
|
+
var scrollEl = document.getElementById("".concat(this.elementId, "_tableBody"));
|
|
6072
|
+
|
|
6073
|
+
if (scrollEl) {
|
|
6074
|
+
scrollEl.addEventListener('wheel', this.handleScrollWheel.bind(this));
|
|
6075
|
+
}
|
|
6076
|
+
|
|
6077
|
+
this.loadingDialog = new WebsyDesigns.LoadingDialog("".concat(this.elementId, "_loadingContainer"));
|
|
6078
|
+
this.render(this.options.data);
|
|
6079
|
+
} else {
|
|
6080
|
+
console.error("No element found with ID ".concat(this.elementId));
|
|
6081
|
+
}
|
|
6082
|
+
}
|
|
6083
|
+
|
|
6084
|
+
_createClass(WebsyTable3, [{
|
|
6085
|
+
key: "appendRows",
|
|
6086
|
+
value: function appendRows(data) {
|
|
6087
|
+
this.hideError();
|
|
6088
|
+
var bodyEl = document.getElementById("".concat(this.elementId, "_tableBody"));
|
|
6089
|
+
|
|
6090
|
+
if (bodyEl) {
|
|
6091
|
+
if (this.options.virtualScroll === true) {
|
|
6092
|
+
bodyEl.innerHTML = this.buildBodyHtml(data, true);
|
|
6093
|
+
} else {
|
|
6094
|
+
bodyEl.innerHTML += this.buildBodyHtml(data, true);
|
|
6095
|
+
}
|
|
6096
|
+
} // this.data = this.data.concat(data)
|
|
6097
|
+
// this.rowCount = this.data.length
|
|
6098
|
+
|
|
6099
|
+
}
|
|
6100
|
+
}, {
|
|
6101
|
+
key: "buildBodyHtml",
|
|
6102
|
+
value: function buildBodyHtml() {
|
|
6103
|
+
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6104
|
+
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
6105
|
+
|
|
6106
|
+
if (data.length === 0) {
|
|
6107
|
+
return '';
|
|
6108
|
+
}
|
|
6109
|
+
|
|
6110
|
+
var bodyHtml = "";
|
|
6111
|
+
var sizingColumns = this.options.columns[this.options.columns.length - 1];
|
|
6112
|
+
|
|
6113
|
+
if (useWidths === true) {
|
|
6114
|
+
bodyHtml += '<colgroup>';
|
|
6115
|
+
bodyHtml += sizingColumns.map(function (c) {
|
|
6116
|
+
return "\n <col\n style='width: ".concat(c.width || c.actualWidth, "px!important'\n ></col>\n ");
|
|
6117
|
+
}).join('');
|
|
6118
|
+
bodyHtml += '</colgroup>';
|
|
6119
|
+
}
|
|
6120
|
+
|
|
6121
|
+
data.forEach(function (row) {
|
|
6122
|
+
bodyHtml += "<tr class=\"websy-table-row\">";
|
|
6123
|
+
row.forEach(function (cell, cellIndex) {
|
|
6124
|
+
bodyHtml += "<td \n class='websy-table-cell'\n style='".concat(cell.style, "'\n data-info='").concat(cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n "); // if (useWidths === true) {
|
|
6125
|
+
// bodyHtml += `
|
|
6126
|
+
// style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
|
|
6127
|
+
// width='${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}'
|
|
6128
|
+
// `
|
|
6129
|
+
// }
|
|
6130
|
+
|
|
6131
|
+
bodyHtml += "\n >\n ".concat(cell.value, "\n </td>");
|
|
6132
|
+
});
|
|
6133
|
+
bodyHtml += "</tr>";
|
|
6134
|
+
}); // bodyHtml += `</div>`
|
|
6135
|
+
|
|
6136
|
+
return bodyHtml;
|
|
6137
|
+
}
|
|
6138
|
+
}, {
|
|
6139
|
+
key: "buildHeaderHtml",
|
|
6140
|
+
value: function buildHeaderHtml() {
|
|
6141
|
+
var _this38 = this;
|
|
6142
|
+
|
|
6143
|
+
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6144
|
+
var headerHtml = '';
|
|
6145
|
+
var sizingColumns = this.options.columns[this.options.columns.length - 1];
|
|
6146
|
+
|
|
6147
|
+
if (useWidths === true) {
|
|
6148
|
+
headerHtml += '<colgroup>';
|
|
6149
|
+
headerHtml += sizingColumns.map(function (c) {
|
|
6150
|
+
return "\n <col\n style='width: ".concat(c.width || c.actualWidth, "px!important'\n ></col>\n ");
|
|
6151
|
+
}).join('');
|
|
6152
|
+
headerHtml += '</colgroup>';
|
|
6153
|
+
}
|
|
6154
|
+
|
|
6155
|
+
this.options.columns.forEach(function (row, rowIndex) {
|
|
6156
|
+
if (useWidths === false && rowIndex !== _this38.options.columns.length - 1) {
|
|
6157
|
+
// if we're calculating the size we only want to render the last row of column headers
|
|
6158
|
+
return;
|
|
6159
|
+
}
|
|
6160
|
+
|
|
6161
|
+
headerHtml += "<tr class=\"websy-table-row websy-table-header-row\">";
|
|
6162
|
+
row.forEach(function (col) {
|
|
6163
|
+
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
|
+
// headerHtml += `
|
|
6165
|
+
// style='width: ${col.width || col.actualWidth}px'
|
|
6166
|
+
// width='${col.width || col.actualWidth}'
|
|
6167
|
+
// `
|
|
6168
|
+
// }
|
|
6169
|
+
|
|
6170
|
+
headerHtml += " \n >\n ".concat(col.name, "\n </td>");
|
|
6171
|
+
});
|
|
6172
|
+
headerHtml += "</tr>";
|
|
6173
|
+
});
|
|
6174
|
+
return headerHtml;
|
|
6175
|
+
}
|
|
6176
|
+
}, {
|
|
6177
|
+
key: "buildTotalHtml",
|
|
6178
|
+
value: function buildTotalHtml() {
|
|
6179
|
+
var _this39 = this;
|
|
6180
|
+
|
|
6181
|
+
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6182
|
+
|
|
6183
|
+
if (!this.options.totals) {
|
|
6184
|
+
return '';
|
|
6185
|
+
}
|
|
6186
|
+
|
|
6187
|
+
var totalHtml = "<tr class=\"websy-table-row websy-table-total-row\">";
|
|
6188
|
+
this.options.totals.forEach(function (col, colIndex) {
|
|
6189
|
+
totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6190
|
+
|
|
6191
|
+
if (useWidths === true) {
|
|
6192
|
+
totalHtml += "\n style='width: ".concat(_this39.options.columns[_this39.options.columns.length - 1][colIndex].width || _this39.options.columns[_this39.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
6193
|
+
}
|
|
6194
|
+
|
|
6195
|
+
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
6196
|
+
});
|
|
6197
|
+
totalHtml += "</tr>";
|
|
6198
|
+
return totalHtml;
|
|
6199
|
+
}
|
|
6200
|
+
}, {
|
|
6201
|
+
key: "calculateSizes",
|
|
6202
|
+
value: function calculateSizes() {
|
|
6203
|
+
var _this40 = this;
|
|
6204
|
+
|
|
6205
|
+
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6206
|
+
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
6207
|
+
var totalColumnCount = arguments.length > 2 ? arguments[2] : undefined;
|
|
6208
|
+
var pinnedColumns = arguments.length > 3 ? arguments[3] : undefined;
|
|
6209
|
+
this.totalRowCount = totalRowCount; // probably need some error handling here if no value is passed in
|
|
6210
|
+
|
|
6211
|
+
this.totalColumnCount = totalColumnCount; // probably need some error handling here if no value is passed in
|
|
6212
|
+
|
|
6213
|
+
this.pinnedColumns = pinnedColumns; // probably need some error handling here if no value is passed in
|
|
6214
|
+
|
|
6215
|
+
var outerEl = document.getElementById(this.elementId);
|
|
6216
|
+
var tableEl = document.getElementById("".concat(this.elementId, "_tableContainer"));
|
|
6217
|
+
var headEl = document.getElementById("".concat(this.elementId, "_tableHeader"));
|
|
6218
|
+
headEl.style.width = 'auto';
|
|
6219
|
+
headEl.innerHTML = this.buildHeaderHtml();
|
|
6220
|
+
this.sizes.outer = outerEl.getBoundingClientRect();
|
|
6221
|
+
this.sizes.table = tableEl.getBoundingClientRect();
|
|
6222
|
+
this.sizes.header = headEl.getBoundingClientRect();
|
|
6223
|
+
var maxWidth;
|
|
6224
|
+
|
|
6225
|
+
if (typeof this.options.maxColWidth === 'number') {
|
|
6226
|
+
maxWidth = this.options.maxColWidth;
|
|
6227
|
+
} else if (this.options.maxColWidth.indexOf('%') !== -1) {
|
|
6228
|
+
maxWidth = this.sizes.outer.width * (+this.options.maxColWidth.replace('%', '') / 100);
|
|
6229
|
+
} else if (this.options.maxColWidth.indexOf('px') !== -1) {
|
|
6230
|
+
maxWidth = +this.options.maxColWidth.replace('px', '');
|
|
6231
|
+
}
|
|
6232
|
+
|
|
6233
|
+
var bodyEl = document.getElementById("".concat(this.elementId, "_tableBody"));
|
|
6234
|
+
bodyEl.style.width = 'auto';
|
|
6235
|
+
bodyEl.innerHTML = this.buildBodyHtml([sample]);
|
|
6236
|
+
var footerEl = document.getElementById("".concat(this.elementId, "_tableFooter"));
|
|
6237
|
+
footerEl.innerHTML = this.buildTotalHtml();
|
|
6238
|
+
this.sizes.total = footerEl.getBoundingClientRect();
|
|
6239
|
+
var rows = Array.from(tableEl.querySelectorAll('.websy-table-row'));
|
|
6240
|
+
var totalWidth = 0;
|
|
6241
|
+
this.sizes.scrollableWidth = this.sizes.outer.width;
|
|
6242
|
+
rows.forEach(function (row, rowIndex) {
|
|
6243
|
+
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6244
|
+
var colSize = col.getBoundingClientRect();
|
|
6245
|
+
_this40.sizes.cellHeight = colSize.height;
|
|
6246
|
+
|
|
6247
|
+
if (_this40.options.columns[_this40.options.columns.length - 1][colIndex]) {
|
|
6248
|
+
if (!_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth) {
|
|
6249
|
+
_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth = 0;
|
|
6250
|
+
}
|
|
6251
|
+
|
|
6252
|
+
_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
|
|
6253
|
+
_this40.options.columns[_this40.options.columns.length - 1][colIndex].cellHeight = colSize.height;
|
|
6254
|
+
}
|
|
6255
|
+
});
|
|
6256
|
+
});
|
|
6257
|
+
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6258
|
+
if (colIndex < _this40.pinnedColumns) {
|
|
6259
|
+
_this40.sizes.scrollableWidth -= col.actualWidth;
|
|
6260
|
+
}
|
|
6261
|
+
});
|
|
6262
|
+
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
6263
|
+
return a + (b.width || b.actualWidth);
|
|
6264
|
+
}, 0);
|
|
6265
|
+
var outerSize = outerEl.getBoundingClientRect();
|
|
6266
|
+
|
|
6267
|
+
if (this.sizes.totalWidth < outerSize.width) {
|
|
6268
|
+
this.sizes.totalWidth = 0;
|
|
6269
|
+
var equalWidth = outerSize.width / this.options.columns[this.options.columns.length - 1].length;
|
|
6270
|
+
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6271
|
+
if (!c.width) {
|
|
6272
|
+
if (c.actualWidth < equalWidth) {
|
|
6273
|
+
// adjust the width
|
|
6274
|
+
c.actualWidth = equalWidth;
|
|
6275
|
+
}
|
|
6276
|
+
}
|
|
6277
|
+
|
|
6278
|
+
_this40.sizes.totalWidth += c.width || c.actualWidth;
|
|
6279
|
+
equalWidth = (outerSize.width - _this40.sizes.totalWidth) / (_this40.options.columns[_this40.options.columns.length - 1].length - (i + 1));
|
|
6280
|
+
});
|
|
6281
|
+
} // take the height of the last cell as the official height for data cells
|
|
6282
|
+
// this.sizes.dataCellHeight = this.options.columns[this.options.columns.length - 1].cellHeight
|
|
6283
|
+
|
|
6284
|
+
|
|
6285
|
+
headEl.innerHTML = '';
|
|
6286
|
+
bodyEl.innerHTML = '';
|
|
6287
|
+
footerEl.innerHTML = '';
|
|
6288
|
+
headEl.style.width = 'initial';
|
|
6289
|
+
bodyEl.style.width = 'initial';
|
|
6290
|
+
this.sizes.bodyHeight = this.sizes.table.height - (this.sizes.header.height + this.sizes.total.height);
|
|
6291
|
+
this.sizes.rowsToRender = Math.ceil(this.sizes.bodyHeight / this.sizes.cellHeight);
|
|
6292
|
+
this.sizes.rowsToRenderPrecise = this.sizes.bodyHeight / this.sizes.cellHeight;
|
|
6293
|
+
this.startRow = 0;
|
|
6294
|
+
this.endRow = this.sizes.rowsToRender;
|
|
6295
|
+
this.startCol = 0;
|
|
6296
|
+
this.endCol = this.options.columns[this.options.columns.length - 1].length;
|
|
6297
|
+
|
|
6298
|
+
if (this.sizes.rowsToRender < this.totalRowCount) {
|
|
6299
|
+
this.vScrollRequired = true;
|
|
6300
|
+
}
|
|
6301
|
+
|
|
6302
|
+
if (this.sizes.totalWidth > this.sizes.outer.width) {
|
|
6303
|
+
this.hScrollRequired = true;
|
|
6304
|
+
}
|
|
6305
|
+
|
|
6306
|
+
this.options.allColumns = this.options.columns.map(function (c) {
|
|
6307
|
+
return c;
|
|
6308
|
+
});
|
|
6309
|
+
console.log('sizes', this.sizes);
|
|
6310
|
+
return this.sizes;
|
|
6311
|
+
}
|
|
6312
|
+
}, {
|
|
6313
|
+
key: "createSample",
|
|
6314
|
+
value: function createSample(data) {
|
|
6315
|
+
var output = [];
|
|
6316
|
+
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6317
|
+
if (col.maxLength) {
|
|
6318
|
+
output.push({
|
|
6319
|
+
value: new Array(col.maxLength).fill('W').join('')
|
|
6320
|
+
});
|
|
6321
|
+
} else if (data) {
|
|
6322
|
+
var longest = '';
|
|
6323
|
+
|
|
6324
|
+
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
6325
|
+
if (longest.length < data[i][colIndex].value.length) {
|
|
6326
|
+
longest = data[i][colIndex].value;
|
|
6327
|
+
}
|
|
6328
|
+
}
|
|
6329
|
+
|
|
6330
|
+
output.push({
|
|
6331
|
+
value: longest
|
|
6332
|
+
});
|
|
6333
|
+
} else {
|
|
6334
|
+
output.push({
|
|
6335
|
+
value: ''
|
|
6336
|
+
});
|
|
6337
|
+
}
|
|
6338
|
+
});
|
|
6339
|
+
return output;
|
|
6340
|
+
}
|
|
6341
|
+
}, {
|
|
6342
|
+
key: "handleClick",
|
|
6343
|
+
value: function handleClick(event) {}
|
|
6344
|
+
}, {
|
|
6345
|
+
key: "handleMouseDown",
|
|
6346
|
+
value: function handleMouseDown(event) {
|
|
6347
|
+
if (event.target.classList.contains('websy-scroll-handle-y')) {
|
|
6348
|
+
// set up the scroll start values
|
|
6349
|
+
this.scrollDragging = true;
|
|
6350
|
+
this.scrollDirection = 'y';
|
|
6351
|
+
var scrollHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
|
|
6352
|
+
this.handleYStart = scrollHandleEl.offsetTop;
|
|
6353
|
+
this.mouseYStart = event.pageY;
|
|
6354
|
+
console.log('mouse down', this.handleYStart, this.mouseYStart);
|
|
6355
|
+
console.log(scrollHandleEl.offsetTop);
|
|
6356
|
+
} else if (event.target.classList.contains('websy-scroll-handle-x')) {
|
|
6357
|
+
this.scrollDragging = true;
|
|
6358
|
+
this.scrollDirection = 'x';
|
|
6359
|
+
|
|
6360
|
+
var _scrollHandleEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
|
|
6361
|
+
|
|
6362
|
+
this.handleXStart = _scrollHandleEl.offsetLeft;
|
|
6363
|
+
this.mouseXStart = event.pageX;
|
|
6364
|
+
}
|
|
6365
|
+
}
|
|
6366
|
+
}, {
|
|
6367
|
+
key: "handleMouseMove",
|
|
6368
|
+
value: function handleMouseMove(event) {
|
|
6369
|
+
// event.preventDefault()
|
|
6370
|
+
if (this.scrollDragging === true) {
|
|
6371
|
+
if (this.scrollDirection === 'y') {
|
|
6372
|
+
var diff = event.pageY - this.mouseYStart;
|
|
6373
|
+
this.scrollY(diff);
|
|
6374
|
+
} else if (this.scrollDirection === 'x') {
|
|
6375
|
+
var _diff = event.pageX - this.mouseXStart;
|
|
6376
|
+
|
|
6377
|
+
this.scrollX(_diff);
|
|
6378
|
+
}
|
|
6379
|
+
}
|
|
6380
|
+
}
|
|
6381
|
+
}, {
|
|
6382
|
+
key: "handleMouseUp",
|
|
6383
|
+
value: function handleMouseUp(event) {
|
|
6384
|
+
this.scrollDragging = false;
|
|
6385
|
+
this.cellDragging = false;
|
|
6386
|
+
this.handleYStart = null;
|
|
6387
|
+
this.mouseYStart = null;
|
|
6388
|
+
this.handleXStart = null;
|
|
6389
|
+
this.mouseXStart = null;
|
|
6390
|
+
}
|
|
6391
|
+
}, {
|
|
6392
|
+
key: "handleScrollWheel",
|
|
6393
|
+
value: function handleScrollWheel(event) {
|
|
6394
|
+
event.preventDefault();
|
|
6395
|
+
console.log('scrollwheel', event);
|
|
6396
|
+
|
|
6397
|
+
if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) {
|
|
6398
|
+
this.scrollX(Math.max(-5, Math.min(5, event.deltaX)));
|
|
6399
|
+
} else {
|
|
6400
|
+
this.scrollY(Math.max(-5, Math.min(5, event.deltaY)));
|
|
6401
|
+
}
|
|
6402
|
+
}
|
|
6403
|
+
}, {
|
|
6404
|
+
key: "hideError",
|
|
6405
|
+
value: function hideError() {
|
|
6406
|
+
var el = document.getElementById("".concat(this.elementId, "_tableContainer"));
|
|
6407
|
+
|
|
6408
|
+
if (el) {
|
|
6409
|
+
el.classList.remove('has-error');
|
|
6410
|
+
}
|
|
6411
|
+
|
|
6412
|
+
var tableEl = document.getElementById("".concat(this.elementId, "_tableInner"));
|
|
6413
|
+
tableEl.classList.remove('hidden');
|
|
6414
|
+
var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
|
|
6415
|
+
|
|
6416
|
+
if (containerEl) {
|
|
6417
|
+
containerEl.classList.remove('active');
|
|
6418
|
+
}
|
|
6419
|
+
}
|
|
6420
|
+
}, {
|
|
6421
|
+
key: "hideLoading",
|
|
6422
|
+
value: function hideLoading() {
|
|
6423
|
+
this.loadingDialog.hide();
|
|
6424
|
+
}
|
|
6425
|
+
}, {
|
|
6426
|
+
key: "render",
|
|
6427
|
+
value: function render(data) {
|
|
6428
|
+
var calcSizes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
6429
|
+
|
|
6430
|
+
if (!this.options.columns) {
|
|
6431
|
+
console.log("No columns provided for table with ID ".concat(this.elementId));
|
|
6432
|
+
return;
|
|
6433
|
+
}
|
|
6434
|
+
|
|
6435
|
+
if (this.options.columns.length === 0) {
|
|
6436
|
+
console.log("No columns provided for table with ID ".concat(this.elementId));
|
|
6437
|
+
return;
|
|
6438
|
+
} // this.data = []
|
|
6439
|
+
// Adjust the sizing of the header/body/footer
|
|
6440
|
+
|
|
6441
|
+
|
|
6442
|
+
if (calcSizes === true) {
|
|
6443
|
+
var sample = this.createSample(data);
|
|
6444
|
+
this.calculateSizes(sample, data.length, (data[0] || []).length, 0);
|
|
6445
|
+
}
|
|
6446
|
+
|
|
6447
|
+
console.log(this.options.columns);
|
|
6448
|
+
var tableInnerEl = document.getElementById("".concat(this.elementId, "_tableInner"));
|
|
6449
|
+
|
|
6450
|
+
if (tableInnerEl) {
|
|
6451
|
+
tableInnerEl.style.width = "".concat(this.sizes.totalWidth, "px");
|
|
6452
|
+
}
|
|
6453
|
+
|
|
6454
|
+
this.renderColumnHeaders();
|
|
6455
|
+
this.renderTotals();
|
|
6456
|
+
|
|
6457
|
+
if (data) {
|
|
6458
|
+
this.appendRows(data);
|
|
6459
|
+
}
|
|
6460
|
+
|
|
6461
|
+
var bodyEl = document.getElementById("".concat(this.elementId, "_tableBody")); // bodyEl.innerHTML = this.buildBodyHtml(data, true)
|
|
6462
|
+
|
|
6463
|
+
bodyEl.style.height = "calc(100% - ".concat(this.sizes.header.height, "px - ").concat(this.sizes.total.height, "px)");
|
|
6464
|
+
|
|
6465
|
+
if (this.options.virtualScroll === true) {
|
|
6466
|
+
// set the scroll element positions
|
|
6467
|
+
if (this.vScrollRequired === true) {
|
|
6468
|
+
var vScrollEl = document.getElementById("".concat(this.elementId, "_vScrollContainer"));
|
|
6469
|
+
var vHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
|
|
6470
|
+
vScrollEl.style.top = "".concat(this.sizes.header.height + this.sizes.total.height, "px");
|
|
6471
|
+
vScrollEl.style.height = "".concat(this.sizes.bodyHeight, "px");
|
|
6472
|
+
vHandleEl.style.height = Math.max(this.options.minHandleSize, this.sizes.bodyHeight * (this.sizes.rowsToRenderPrecise / this.totalRowCount)) + 'px';
|
|
6473
|
+
}
|
|
6474
|
+
|
|
6475
|
+
if (this.hScrollRequired === true) {
|
|
6476
|
+
var hScrollEl = document.getElementById("".concat(this.elementId, "_hScrollContainer"));
|
|
6477
|
+
var hHandleEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
|
|
6478
|
+
hScrollEl.style.left = "".concat(this.sizes.table.width - this.sizes.scrollableWidth, "px");
|
|
6479
|
+
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.totalWidth)) + 'px';
|
|
6481
|
+
}
|
|
6482
|
+
}
|
|
6483
|
+
}
|
|
6484
|
+
}, {
|
|
6485
|
+
key: "renderColumnHeaders",
|
|
6486
|
+
value: function renderColumnHeaders() {
|
|
6487
|
+
var headEl = document.getElementById("".concat(this.elementId, "_tableHeader"));
|
|
6488
|
+
|
|
6489
|
+
if (headEl) {
|
|
6490
|
+
headEl.innerHTML = this.buildHeaderHtml(true);
|
|
6491
|
+
}
|
|
6492
|
+
}
|
|
6493
|
+
}, {
|
|
6494
|
+
key: "renderTotals",
|
|
6495
|
+
value: function renderTotals() {
|
|
6496
|
+
var headEl = document.getElementById("".concat(this.elementId, "_tableHeader"));
|
|
6497
|
+
var totalHtml = this.buildTotalHtml(true);
|
|
6498
|
+
|
|
6499
|
+
if (this.options.showTotalsAbove === true) {
|
|
6500
|
+
headEl.innerHTML += totalHtml;
|
|
6501
|
+
} else {
|
|
6502
|
+
var footerEl = document.getElementById("".concat(this.elementId, "_tableFooter"));
|
|
6503
|
+
|
|
6504
|
+
if (footerEl) {
|
|
6505
|
+
footerEl.innerHTML = totalHtml;
|
|
6506
|
+
}
|
|
6507
|
+
}
|
|
6508
|
+
}
|
|
6509
|
+
}, {
|
|
6510
|
+
key: "resize",
|
|
6511
|
+
value: function resize() {}
|
|
6512
|
+
}, {
|
|
6513
|
+
key: "showError",
|
|
6514
|
+
value: function showError(options) {
|
|
6515
|
+
var el = document.getElementById("".concat(this.elementId, "_tableContainer"));
|
|
6516
|
+
|
|
6517
|
+
if (el) {
|
|
6518
|
+
el.classList.add('has-error');
|
|
6519
|
+
}
|
|
6520
|
+
|
|
6521
|
+
var tableEl = document.getElementById("".concat(this.elementId, "_tableInner"));
|
|
6522
|
+
tableEl.classList.add('hidden');
|
|
6523
|
+
var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
|
|
6524
|
+
|
|
6525
|
+
if (containerEl) {
|
|
6526
|
+
containerEl.classList.add('active');
|
|
6527
|
+
}
|
|
6528
|
+
|
|
6529
|
+
if (options.title) {
|
|
6530
|
+
var titleEl = document.getElementById("".concat(this.elementId, "_errorTitle"));
|
|
6531
|
+
|
|
6532
|
+
if (titleEl) {
|
|
6533
|
+
titleEl.innerHTML = options.title;
|
|
6534
|
+
}
|
|
6535
|
+
}
|
|
6536
|
+
|
|
6537
|
+
if (options.message) {
|
|
6538
|
+
var messageEl = document.getElementById("".concat(this.elementId, "_errorMessage"));
|
|
6539
|
+
|
|
6540
|
+
if (messageEl) {
|
|
6541
|
+
messageEl.innerHTML = options.message;
|
|
6542
|
+
}
|
|
6543
|
+
}
|
|
6544
|
+
}
|
|
6545
|
+
}, {
|
|
6546
|
+
key: "scrollX",
|
|
6547
|
+
value: function scrollX(diff) {
|
|
6548
|
+
var scrollContainerEl = document.getElementById("".concat(this.elementId, "_hScrollContainer"));
|
|
6549
|
+
var scrollHandleEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
|
|
6550
|
+
var handlePos;
|
|
6551
|
+
|
|
6552
|
+
if (typeof this.handleXStart !== 'undefined' && this.handleXStart !== null) {
|
|
6553
|
+
handlePos = this.handleXStart + diff;
|
|
6554
|
+
} else {
|
|
6555
|
+
handlePos = scrollHandleEl.offsetLeft + diff;
|
|
6556
|
+
}
|
|
6557
|
+
|
|
6558
|
+
var scrollableSpace = scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width;
|
|
6559
|
+
console.log('dragging x', diff, scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width);
|
|
6560
|
+
scrollHandleEl.style.left = Math.min(scrollableSpace, Math.max(0, handlePos)) + 'px';
|
|
6561
|
+
|
|
6562
|
+
if (this.options.onScroll) {
|
|
6563
|
+
var actualLeft = (this.sizes.totalWidth - this.sizes.scrollableWidth) * (Math.min(scrollableSpace, Math.max(0, handlePos)) / scrollableSpace);
|
|
6564
|
+
var cumulativeWidth = 0;
|
|
6565
|
+
this.startCol = 0;
|
|
6566
|
+
this.endCol = 0;
|
|
6567
|
+
|
|
6568
|
+
for (var i = 0; i < this.options.allColumns[this.options.allColumns.length - 1].length; i++) {
|
|
6569
|
+
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);
|
|
6571
|
+
|
|
6572
|
+
if (actualLeft < cumulativeWidth) {
|
|
6573
|
+
this.startCol = i;
|
|
6574
|
+
break;
|
|
6575
|
+
}
|
|
6576
|
+
}
|
|
6577
|
+
|
|
6578
|
+
cumulativeWidth = 0;
|
|
6579
|
+
|
|
6580
|
+
for (var _i10 = this.startCol; _i10 < this.options.allColumns[this.options.allColumns.length - 1].length; _i10++) {
|
|
6581
|
+
cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][_i10].actualWidth;
|
|
6582
|
+
|
|
6583
|
+
if (cumulativeWidth < this.sizes.scrollableWidth) {
|
|
6584
|
+
this.endCol = _i10;
|
|
6585
|
+
}
|
|
6586
|
+
}
|
|
6587
|
+
|
|
6588
|
+
if (this.endCol < this.options.allColumns[this.options.allColumns.length - 1].length - 1) {
|
|
6589
|
+
this.endCol += 1;
|
|
6590
|
+
}
|
|
6591
|
+
|
|
6592
|
+
if (this.endCol === this.options.allColumns[this.options.allColumns.length - 1].length - 1 && cumulativeWidth > this.sizes.totalWidth) {
|
|
6593
|
+
this.startCol += 1;
|
|
6594
|
+
}
|
|
6595
|
+
|
|
6596
|
+
this.endCol = Math.max(this.startCol, this.endCol);
|
|
6597
|
+
this.options.onScroll('y', this.startRow, this.endRow, this.startCol, this.endCol);
|
|
6598
|
+
}
|
|
6599
|
+
}
|
|
6600
|
+
}, {
|
|
6601
|
+
key: "scrollY",
|
|
6602
|
+
value: function scrollY(diff) {
|
|
6603
|
+
var scrollContainerEl = document.getElementById("".concat(this.elementId, "_vScrollContainer"));
|
|
6604
|
+
var scrollHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
|
|
6605
|
+
var handlePos;
|
|
6606
|
+
|
|
6607
|
+
if (typeof this.handleYStart !== 'undefined' && this.handleYStart !== null) {
|
|
6608
|
+
handlePos = this.handleYStart + diff;
|
|
6609
|
+
} else {
|
|
6610
|
+
console.log('appending not resetting');
|
|
6611
|
+
handlePos = scrollHandleEl.offsetTop + diff;
|
|
6612
|
+
}
|
|
6613
|
+
|
|
6614
|
+
var scrollableSpace = scrollContainerEl.getBoundingClientRect().height - scrollHandleEl.getBoundingClientRect().height;
|
|
6615
|
+
console.log('dragging y', diff, scrollContainerEl.getBoundingClientRect().height - scrollHandleEl.getBoundingClientRect().height);
|
|
6616
|
+
scrollHandleEl.style.top = Math.min(scrollableSpace, Math.max(0, handlePos)) + 'px';
|
|
6617
|
+
|
|
6618
|
+
if (this.options.onScroll) {
|
|
6619
|
+
this.startRow = Math.min(this.totalRowCount - this.sizes.rowsToRender, Math.max(0, Math.round((this.totalRowCount - this.sizes.rowsToRender) * (handlePos / scrollableSpace))));
|
|
6620
|
+
this.endRow = this.startRow + this.sizes.rowsToRender;
|
|
6621
|
+
|
|
6622
|
+
if (this.endRow === this.totalRowCount) {
|
|
6623
|
+
this.startRow += 1;
|
|
6624
|
+
}
|
|
6625
|
+
|
|
6626
|
+
this.options.onScroll('y', this.startRow, this.endRow, this.startCol, this.endCol);
|
|
6627
|
+
}
|
|
6628
|
+
}
|
|
6629
|
+
}, {
|
|
6630
|
+
key: "showLoading",
|
|
6631
|
+
value: function showLoading(options) {
|
|
6632
|
+
this.loadingDialog.show(options);
|
|
6633
|
+
}
|
|
6634
|
+
}, {
|
|
6635
|
+
key: "columns",
|
|
6636
|
+
set: function set(columns) {
|
|
6637
|
+
this.options.columns = columns;
|
|
6638
|
+
this.renderColumnHeaders();
|
|
6639
|
+
}
|
|
6640
|
+
}, {
|
|
6641
|
+
key: "totals",
|
|
6642
|
+
set: function set(totals) {
|
|
6643
|
+
this.options.totals = totals;
|
|
6644
|
+
this.renderTotals();
|
|
6645
|
+
}
|
|
6646
|
+
}]);
|
|
6647
|
+
|
|
6648
|
+
return WebsyTable3;
|
|
6649
|
+
}();
|
|
5675
6650
|
/* global d3 include WebsyDesigns */
|
|
5676
6651
|
|
|
5677
6652
|
|
|
5678
6653
|
var WebsyChart = /*#__PURE__*/function () {
|
|
5679
6654
|
function WebsyChart(elementId, options) {
|
|
5680
|
-
var
|
|
6655
|
+
var _this41 = this;
|
|
5681
6656
|
|
|
5682
6657
|
_classCallCheck(this, WebsyChart);
|
|
5683
6658
|
|
|
@@ -5726,22 +6701,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5726
6701
|
this.invertOverride = function (input, input2) {
|
|
5727
6702
|
var xAxis = 'bottomAxis';
|
|
5728
6703
|
|
|
5729
|
-
if (
|
|
6704
|
+
if (_this41.options.orientation === 'horizontal') {
|
|
5730
6705
|
xAxis = 'leftAxis';
|
|
5731
6706
|
}
|
|
5732
6707
|
|
|
5733
|
-
var width =
|
|
6708
|
+
var width = _this41[xAxis].step();
|
|
5734
6709
|
|
|
5735
6710
|
var output;
|
|
5736
6711
|
|
|
5737
|
-
var domain = _toConsumableArray(
|
|
6712
|
+
var domain = _toConsumableArray(_this41[xAxis].domain());
|
|
5738
6713
|
|
|
5739
|
-
if (
|
|
6714
|
+
if (_this41.options.orientation === 'horizontal') {
|
|
5740
6715
|
domain = domain.reverse();
|
|
5741
6716
|
}
|
|
5742
6717
|
|
|
5743
6718
|
for (var j = 0; j < domain.length; j++) {
|
|
5744
|
-
var breakA =
|
|
6719
|
+
var breakA = _this41[xAxis](domain[j]) - width / 2;
|
|
5745
6720
|
var breakB = breakA + width;
|
|
5746
6721
|
|
|
5747
6722
|
if (input > breakA && input <= breakB) {
|
|
@@ -5841,10 +6816,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5841
6816
|
}, {
|
|
5842
6817
|
key: "handleEventMouseMove",
|
|
5843
6818
|
value: function handleEventMouseMove(event, d) {
|
|
5844
|
-
var
|
|
6819
|
+
var _this42 = this;
|
|
5845
6820
|
|
|
5846
6821
|
var bisectDate = d3.bisector(function (d) {
|
|
5847
|
-
return
|
|
6822
|
+
return _this42.parseX(d.x.value);
|
|
5848
6823
|
}).left;
|
|
5849
6824
|
|
|
5850
6825
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -5883,8 +6858,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5883
6858
|
}
|
|
5884
6859
|
|
|
5885
6860
|
this.options.data.series.forEach(function (s) {
|
|
5886
|
-
if (
|
|
5887
|
-
xPoint =
|
|
6861
|
+
if (_this42.options.data[xData].scale !== 'Time') {
|
|
6862
|
+
xPoint = _this42[xAxis](_this42.parseX(xLabel));
|
|
5888
6863
|
s.data.forEach(function (d) {
|
|
5889
6864
|
if (d.x.value === xLabel) {
|
|
5890
6865
|
if (!tooltipTitle) {
|
|
@@ -5903,13 +6878,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5903
6878
|
var pointA = s.data[index - 1];
|
|
5904
6879
|
var pointB = s.data[index];
|
|
5905
6880
|
|
|
5906
|
-
if (
|
|
6881
|
+
if (_this42.options.orientation === 'horizontal') {
|
|
5907
6882
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
5908
6883
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
5909
6884
|
}
|
|
5910
6885
|
|
|
5911
6886
|
if (pointA && !pointB) {
|
|
5912
|
-
xPoint =
|
|
6887
|
+
xPoint = _this42[xAxis](_this42.parseX(pointA.x.value));
|
|
5913
6888
|
tooltipTitle = pointA.x.value;
|
|
5914
6889
|
|
|
5915
6890
|
if (!pointA.y.color) {
|
|
@@ -5919,12 +6894,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5919
6894
|
tooltipData.push(pointA.y);
|
|
5920
6895
|
|
|
5921
6896
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
5922
|
-
tooltipTitle = d3.timeFormat(
|
|
6897
|
+
tooltipTitle = d3.timeFormat(_this42.options.dateFormat || _this42.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
5923
6898
|
}
|
|
5924
6899
|
}
|
|
5925
6900
|
|
|
5926
6901
|
if (pointB && !pointA) {
|
|
5927
|
-
xPoint =
|
|
6902
|
+
xPoint = _this42[xAxis](_this42.parseX(pointB.x.value));
|
|
5928
6903
|
tooltipTitle = pointB.x.value;
|
|
5929
6904
|
|
|
5930
6905
|
if (!pointB.y.color) {
|
|
@@ -5934,14 +6909,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5934
6909
|
tooltipData.push(pointB.y);
|
|
5935
6910
|
|
|
5936
6911
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5937
|
-
tooltipTitle = d3.timeFormat(
|
|
6912
|
+
tooltipTitle = d3.timeFormat(_this42.options.dateFormat || _this42.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5938
6913
|
}
|
|
5939
6914
|
}
|
|
5940
6915
|
|
|
5941
6916
|
if (pointA && pointB) {
|
|
5942
|
-
var d0 =
|
|
6917
|
+
var d0 = _this42[xAxis](_this42.parseX(pointA.x.value));
|
|
5943
6918
|
|
|
5944
|
-
var d1 =
|
|
6919
|
+
var d1 = _this42[xAxis](_this42.parseX(pointB.x.value));
|
|
5945
6920
|
|
|
5946
6921
|
var mid = Math.abs(d0 - d1) / 2;
|
|
5947
6922
|
|
|
@@ -5950,7 +6925,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5950
6925
|
tooltipTitle = pointB.x.value;
|
|
5951
6926
|
|
|
5952
6927
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5953
|
-
tooltipTitle = d3.timeFormat(
|
|
6928
|
+
tooltipTitle = d3.timeFormat(_this42.options.dateFormat || _this42.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5954
6929
|
}
|
|
5955
6930
|
|
|
5956
6931
|
if (!pointB.y.color) {
|
|
@@ -5963,7 +6938,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5963
6938
|
tooltipTitle = pointA.x.value;
|
|
5964
6939
|
|
|
5965
6940
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5966
|
-
tooltipTitle = d3.timeFormat(
|
|
6941
|
+
tooltipTitle = d3.timeFormat(_this42.options.dateFormat || _this42.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5967
6942
|
}
|
|
5968
6943
|
|
|
5969
6944
|
if (!pointA.y.color) {
|
|
@@ -6068,7 +7043,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6068
7043
|
}, {
|
|
6069
7044
|
key: "render",
|
|
6070
7045
|
value: function render(options) {
|
|
6071
|
-
var
|
|
7046
|
+
var _this43 = this;
|
|
6072
7047
|
|
|
6073
7048
|
/* global d3 options WebsyUtils */
|
|
6074
7049
|
if (typeof options !== 'undefined') {
|
|
@@ -6137,7 +7112,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6137
7112
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
6138
7113
|
return {
|
|
6139
7114
|
value: s.label || s.key,
|
|
6140
|
-
color: s.color ||
|
|
7115
|
+
color: s.color || _this43.options.colors[i % _this43.options.colors.length]
|
|
6141
7116
|
};
|
|
6142
7117
|
});
|
|
6143
7118
|
|
|
@@ -6389,7 +7364,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6389
7364
|
|
|
6390
7365
|
if (this.options.data.bottom.formatter) {
|
|
6391
7366
|
bAxisFunc.tickFormat(function (d) {
|
|
6392
|
-
return
|
|
7367
|
+
return _this43.options.data.bottom.formatter(d);
|
|
6393
7368
|
});
|
|
6394
7369
|
}
|
|
6395
7370
|
|
|
@@ -6415,8 +7390,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6415
7390
|
|
|
6416
7391
|
if (this.options.margin.axisLeft > 0) {
|
|
6417
7392
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
6418
|
-
if (
|
|
6419
|
-
d =
|
|
7393
|
+
if (_this43.options.data.left.formatter) {
|
|
7394
|
+
d = _this43.options.data.left.formatter(d);
|
|
6420
7395
|
}
|
|
6421
7396
|
|
|
6422
7397
|
return d;
|
|
@@ -6453,8 +7428,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6453
7428
|
|
|
6454
7429
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
6455
7430
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
6456
|
-
if (
|
|
6457
|
-
d =
|
|
7431
|
+
if (_this43.options.data.right.formatter) {
|
|
7432
|
+
d = _this43.options.data.right.formatter(d);
|
|
6458
7433
|
}
|
|
6459
7434
|
|
|
6460
7435
|
return d;
|
|
@@ -6480,16 +7455,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6480
7455
|
|
|
6481
7456
|
this.options.data.series.forEach(function (series, index) {
|
|
6482
7457
|
if (!series.key) {
|
|
6483
|
-
series.key =
|
|
7458
|
+
series.key = _this43.createIdentity();
|
|
6484
7459
|
}
|
|
6485
7460
|
|
|
6486
7461
|
if (!series.color) {
|
|
6487
|
-
series.color =
|
|
7462
|
+
series.color = _this43.options.colors[index % _this43.options.colors.length];
|
|
6488
7463
|
}
|
|
6489
7464
|
|
|
6490
|
-
|
|
7465
|
+
_this43["render".concat(series.type || 'bar')](series, index);
|
|
6491
7466
|
|
|
6492
|
-
|
|
7467
|
+
_this43.renderLabels(series, index);
|
|
6493
7468
|
});
|
|
6494
7469
|
}
|
|
6495
7470
|
}
|
|
@@ -6497,17 +7472,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6497
7472
|
}, {
|
|
6498
7473
|
key: "renderarea",
|
|
6499
7474
|
value: function renderarea(series, index) {
|
|
6500
|
-
var
|
|
7475
|
+
var _this44 = this;
|
|
6501
7476
|
|
|
6502
7477
|
/* global d3 series index */
|
|
6503
7478
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
6504
7479
|
return d3.area().x(function (d) {
|
|
6505
|
-
return
|
|
7480
|
+
return _this44[xAxis](_this44.parseX(d.x.value));
|
|
6506
7481
|
}).y0(function (d) {
|
|
6507
|
-
return
|
|
7482
|
+
return _this44[yAxis](0);
|
|
6508
7483
|
}).y1(function (d) {
|
|
6509
|
-
return
|
|
6510
|
-
}).curve(d3[curveStyle ||
|
|
7484
|
+
return _this44[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7485
|
+
}).curve(d3[curveStyle || _this44.options.curveStyle]);
|
|
6511
7486
|
};
|
|
6512
7487
|
|
|
6513
7488
|
var xAxis = 'bottomAxis';
|
|
@@ -6610,15 +7585,21 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6610
7585
|
}
|
|
6611
7586
|
|
|
6612
7587
|
bars.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
6613
|
-
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',
|
|
7588
|
+
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;
|
|
7590
|
+
});
|
|
6614
7591
|
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)
|
|
6615
|
-
.attr('fill',
|
|
7592
|
+
.attr('fill', function (d) {
|
|
7593
|
+
return d.color || series.color;
|
|
7594
|
+
}).attr('class', function (d) {
|
|
6616
7595
|
return "bar bar_".concat(series.key);
|
|
6617
7596
|
});
|
|
6618
7597
|
}
|
|
6619
7598
|
}, {
|
|
6620
7599
|
key: "renderLabels",
|
|
6621
7600
|
value: function renderLabels(series, index) {
|
|
7601
|
+
var _this45 = this;
|
|
7602
|
+
|
|
6622
7603
|
/* global series index d3 WebsyDesigns */
|
|
6623
7604
|
var xAxis = 'bottomAxis';
|
|
6624
7605
|
var yAxis = 'leftAxis';
|
|
@@ -6635,10 +7616,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6635
7616
|
// We currently only support 'Auto'
|
|
6636
7617
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
6637
7618
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
6638
|
-
labels.attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('class', "label_".concat(series.key)).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).style('fill',
|
|
7619
|
+
labels.attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('class', "label_".concat(series.key)).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).style('fill', function (d) {
|
|
7620
|
+
return _this45.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.color || series.color);
|
|
7621
|
+
}).transition(this.transition).text(function (d) {
|
|
6639
7622
|
return d.y.label || d.y.value;
|
|
6640
7623
|
});
|
|
6641
|
-
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').style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).style('fill',
|
|
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').style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).style('fill', function (d) {
|
|
7625
|
+
return _this45.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.color || series.color);
|
|
7626
|
+
}).text(function (d) {
|
|
6642
7627
|
return d.y.label || d.y.value;
|
|
6643
7628
|
}).each(function (d, i) {
|
|
6644
7629
|
if (that.options.orientation === 'horizontal') {
|
|
@@ -6682,15 +7667,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6682
7667
|
}, {
|
|
6683
7668
|
key: "renderline",
|
|
6684
7669
|
value: function renderline(series, index) {
|
|
6685
|
-
var
|
|
7670
|
+
var _this46 = this;
|
|
6686
7671
|
|
|
6687
7672
|
/* global series index d3 */
|
|
6688
7673
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
6689
7674
|
return d3.line().x(function (d) {
|
|
6690
|
-
return
|
|
7675
|
+
return _this46[xAxis](_this46.parseX(d.x.value));
|
|
6691
7676
|
}).y(function (d) {
|
|
6692
|
-
return
|
|
6693
|
-
}).curve(d3[curveStyle ||
|
|
7677
|
+
return _this46[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7678
|
+
}).curve(d3[curveStyle || _this46.options.curveStyle]);
|
|
6694
7679
|
};
|
|
6695
7680
|
|
|
6696
7681
|
var xAxis = 'bottomAxis';
|
|
@@ -6728,14 +7713,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6728
7713
|
}, {
|
|
6729
7714
|
key: "rendersymbol",
|
|
6730
7715
|
value: function rendersymbol(series, index) {
|
|
6731
|
-
var
|
|
7716
|
+
var _this47 = this;
|
|
6732
7717
|
|
|
6733
7718
|
/* global d3 series index series.key */
|
|
6734
7719
|
var drawSymbol = function drawSymbol(size) {
|
|
6735
7720
|
return d3.symbol() // .type(d => {
|
|
6736
7721
|
// return d3.symbols[0]
|
|
6737
7722
|
// })
|
|
6738
|
-
.size(size ||
|
|
7723
|
+
.size(size || _this47.options.symbolSize);
|
|
6739
7724
|
};
|
|
6740
7725
|
|
|
6741
7726
|
var xAxis = 'bottomAxis';
|
|
@@ -6753,7 +7738,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6753
7738
|
symbols.attr('d', function (d) {
|
|
6754
7739
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
6755
7740
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
6756
|
-
return "translate(".concat(
|
|
7741
|
+
return "translate(".concat(_this47[xAxis](_this47.parseX(d.x.value)), ", ").concat(_this47[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
6757
7742
|
}); // Enter
|
|
6758
7743
|
|
|
6759
7744
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -6762,7 +7747,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6762
7747
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
6763
7748
|
return "symbol symbol_".concat(series.key);
|
|
6764
7749
|
}).attr('transform', function (d) {
|
|
6765
|
-
return "translate(".concat(
|
|
7750
|
+
return "translate(".concat(_this47[xAxis](_this47.parseX(d.x.value)), ", ").concat(_this47[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
6766
7751
|
});
|
|
6767
7752
|
}
|
|
6768
7753
|
}, {
|
|
@@ -6917,7 +7902,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6917
7902
|
}, {
|
|
6918
7903
|
key: "resize",
|
|
6919
7904
|
value: function resize() {
|
|
6920
|
-
var
|
|
7905
|
+
var _this48 = this;
|
|
6921
7906
|
|
|
6922
7907
|
var el = document.getElementById(this.elementId);
|
|
6923
7908
|
|
|
@@ -6930,7 +7915,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6930
7915
|
// }
|
|
6931
7916
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
6932
7917
|
html += this._data.map(function (d, i) {
|
|
6933
|
-
return
|
|
7918
|
+
return _this48.getLegendItemHTML(d);
|
|
6934
7919
|
}).join('');
|
|
6935
7920
|
html += "\n <div>\n ";
|
|
6936
7921
|
el.innerHTML = html;
|
|
@@ -7102,7 +8087,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7102
8087
|
}, {
|
|
7103
8088
|
key: "render",
|
|
7104
8089
|
value: function render() {
|
|
7105
|
-
var
|
|
8090
|
+
var _this49 = this;
|
|
7106
8091
|
|
|
7107
8092
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
7108
8093
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -7111,7 +8096,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7111
8096
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
7112
8097
|
return {
|
|
7113
8098
|
value: s.label || s.key,
|
|
7114
|
-
color: s.color ||
|
|
8099
|
+
color: s.color || _this49.options.colors[i % _this49.options.colors.length]
|
|
7115
8100
|
};
|
|
7116
8101
|
});
|
|
7117
8102
|
var longestValue = legendData.map(function (s) {
|
|
@@ -7175,7 +8160,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7175
8160
|
|
|
7176
8161
|
if (this.polygons) {
|
|
7177
8162
|
this.polygons.forEach(function (p) {
|
|
7178
|
-
return
|
|
8163
|
+
return _this49.map.removeLayer(p);
|
|
7179
8164
|
});
|
|
7180
8165
|
}
|
|
7181
8166
|
|
|
@@ -7233,18 +8218,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7233
8218
|
}
|
|
7234
8219
|
|
|
7235
8220
|
if (!p.options.color) {
|
|
7236
|
-
p.options.color =
|
|
8221
|
+
p.options.color = _this49.options.colors[i % _this49.options.colors.length];
|
|
7237
8222
|
}
|
|
7238
8223
|
|
|
7239
8224
|
var pol = L.polygon(p.data.map(function (c) {
|
|
7240
8225
|
return c.map(function (d) {
|
|
7241
8226
|
return [d.Latitude, d.Longitude];
|
|
7242
8227
|
});
|
|
7243
|
-
}), p.options).addTo(
|
|
8228
|
+
}), p.options).addTo(_this49.map);
|
|
7244
8229
|
|
|
7245
|
-
|
|
8230
|
+
_this49.polygons.push(pol);
|
|
7246
8231
|
|
|
7247
|
-
|
|
8232
|
+
_this49.map.fitBounds(pol.getBounds());
|
|
7248
8233
|
});
|
|
7249
8234
|
} // if (this.data.markers.length > 0) {
|
|
7250
8235
|
// el.classList.remove('hidden')
|
|
@@ -7377,8 +8362,10 @@ var WebsyDesigns = {
|
|
|
7377
8362
|
Router: WebsyRouter,
|
|
7378
8363
|
WebsyTable: WebsyTable,
|
|
7379
8364
|
WebsyTable2: WebsyTable2,
|
|
8365
|
+
WebsyTable3: WebsyTable3,
|
|
7380
8366
|
Table: WebsyTable,
|
|
7381
8367
|
Table2: WebsyTable2,
|
|
8368
|
+
Table3: WebsyTable3,
|
|
7382
8369
|
WebsyChart: WebsyChart,
|
|
7383
8370
|
Chart: WebsyChart,
|
|
7384
8371
|
WebsyChartTooltip: WebsyChartTooltip,
|
|
@@ -7405,7 +8392,9 @@ var WebsyDesigns = {
|
|
|
7405
8392
|
WebsySignup: WebsySignup,
|
|
7406
8393
|
Signup: WebsySignup,
|
|
7407
8394
|
ResponsiveText: ResponsiveText,
|
|
7408
|
-
WebsyResponsiveText: ResponsiveText
|
|
8395
|
+
WebsyResponsiveText: ResponsiveText,
|
|
8396
|
+
WebsyDragDrop: WebsyDragDrop,
|
|
8397
|
+
DragDrop: WebsyDragDrop
|
|
7409
8398
|
};
|
|
7410
8399
|
WebsyDesigns.service = new WebsyDesigns.APIService('');
|
|
7411
8400
|
var GlobalPubSub = new WebsyPubSub('empty', {});
|