@websy/websy-designs 1.4.6 → 1.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/helpers/v1/pgHelper.js +3 -0
- package/dist/websy-designs-es6.debug.js +27 -4
- package/dist/websy-designs-es6.js +253 -230
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +27 -4
- package/dist/websy-designs.js +256 -233
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -73,8 +73,25 @@ var APIService = /*#__PURE__*/function () {
|
|
|
73
73
|
}
|
|
74
74
|
}, {
|
|
75
75
|
key: "get",
|
|
76
|
-
value: function get(entity, id, query) {
|
|
76
|
+
value: function get(entity, id, query, offset, limit) {
|
|
77
77
|
var url = this.buildUrl(entity, id, query);
|
|
78
|
+
|
|
79
|
+
if (offset) {
|
|
80
|
+
if (url.indexOf('?') !== -1) {
|
|
81
|
+
url += "&offset=".concat(offset);
|
|
82
|
+
} else {
|
|
83
|
+
url += "?offset=".concat(offset);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (limit) {
|
|
88
|
+
if (url.indexOf('?') !== -1) {
|
|
89
|
+
url += "&limit=".concat(limit);
|
|
90
|
+
} else {
|
|
91
|
+
url += "?limit=".concat(limit);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
78
95
|
return this.run('GET', url);
|
|
79
96
|
}
|
|
80
97
|
}, {
|
|
@@ -1099,12 +1116,18 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1099
1116
|
}, {
|
|
1100
1117
|
key: "selectRange",
|
|
1101
1118
|
value: function selectRange(index) {
|
|
1119
|
+
var _this6 = this;
|
|
1120
|
+
|
|
1102
1121
|
var confirm = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
1103
1122
|
|
|
1104
1123
|
if (this.options.ranges[this.options.mode][index]) {
|
|
1105
1124
|
this.selectedRangeDates = _toConsumableArray(this.options.ranges[this.options.mode][index].range);
|
|
1106
1125
|
this.currentselection = this.options.ranges[this.options.mode][index].range.map(function (d) {
|
|
1107
|
-
|
|
1126
|
+
if (_this6.options.mode === 'date' || _this6.options.mode === 'monthyear') {
|
|
1127
|
+
return d.getTime();
|
|
1128
|
+
} else {
|
|
1129
|
+
return d;
|
|
1130
|
+
}
|
|
1108
1131
|
});
|
|
1109
1132
|
this.selectedRange = +index;
|
|
1110
1133
|
this.highlightRange();
|
|
@@ -1115,7 +1138,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1115
1138
|
}, {
|
|
1116
1139
|
key: "selectCustomRange",
|
|
1117
1140
|
value: function selectCustomRange(rangeInput) {
|
|
1118
|
-
var
|
|
1141
|
+
var _this7 = this;
|
|
1119
1142
|
|
|
1120
1143
|
this.selectedRange = -1;
|
|
1121
1144
|
this.isContinuousRange = true; // if (rangeInput.length === 1) {
|
|
@@ -1131,13 +1154,13 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1131
1154
|
this.customRangeSelected = true;
|
|
1132
1155
|
rangeInput.forEach(function (r, i) {
|
|
1133
1156
|
if (i > 0) {
|
|
1134
|
-
if (
|
|
1135
|
-
if (r.getTime() /
|
|
1136
|
-
|
|
1157
|
+
if (_this7.options.mode === 'date' || _this7.options.mode === 'monthyear') {
|
|
1158
|
+
if (r.getTime() / _this7.oneDay - rangeInput[i - 1] / _this7.oneDay > 1) {
|
|
1159
|
+
_this7.isContinuousRange = false;
|
|
1137
1160
|
}
|
|
1138
|
-
} else if (
|
|
1161
|
+
} else if (_this7.options.mode === 'hour' || _this7.options.mode === 'year') {
|
|
1139
1162
|
if (r - rangeInput[i - 1] > 1) {
|
|
1140
|
-
|
|
1163
|
+
_this7.isContinuousRange = false;
|
|
1141
1164
|
}
|
|
1142
1165
|
}
|
|
1143
1166
|
}
|
|
@@ -1216,27 +1239,27 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1216
1239
|
}, {
|
|
1217
1240
|
key: "updateRange",
|
|
1218
1241
|
value: function updateRange() {
|
|
1219
|
-
var
|
|
1242
|
+
var _this8 = this;
|
|
1220
1243
|
|
|
1221
1244
|
var range;
|
|
1222
1245
|
|
|
1223
1246
|
if (this.selectedRange === -1) {
|
|
1224
1247
|
var list = (this.currentselection.length > 0 ? this.currentselection : this.selectedRangeDates).map(function (d) {
|
|
1225
|
-
if (
|
|
1248
|
+
if (_this8.options.mode === 'date') {
|
|
1226
1249
|
if (!d.toLocaleDateString) {
|
|
1227
1250
|
d = new Date(d);
|
|
1228
1251
|
}
|
|
1229
1252
|
|
|
1230
1253
|
return d.toLocaleDateString();
|
|
1231
|
-
} else if (
|
|
1254
|
+
} else if (_this8.options.mode === 'year') {
|
|
1232
1255
|
return d;
|
|
1233
|
-
} else if (
|
|
1256
|
+
} else if (_this8.options.mode === 'monthyear') {
|
|
1234
1257
|
if (!d.getMonth) {
|
|
1235
1258
|
d = new Date(d);
|
|
1236
1259
|
}
|
|
1237
1260
|
|
|
1238
|
-
return "".concat(
|
|
1239
|
-
} else if (
|
|
1261
|
+
return "".concat(_this8.options.monthMap[d.getMonth()], " ").concat(d.getFullYear());
|
|
1262
|
+
} else if (_this8.options.mode === 'hour') {
|
|
1240
1263
|
return d;
|
|
1241
1264
|
}
|
|
1242
1265
|
});
|
|
@@ -1594,7 +1617,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
1594
1617
|
}, {
|
|
1595
1618
|
key: "render",
|
|
1596
1619
|
value: function render() {
|
|
1597
|
-
var
|
|
1620
|
+
var _this9 = this;
|
|
1598
1621
|
|
|
1599
1622
|
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
1600
1623
|
|
|
@@ -1602,7 +1625,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
1602
1625
|
this.measureItems();
|
|
1603
1626
|
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 ");
|
|
1604
1627
|
html += this.options.items.map(function (d, i) {
|
|
1605
|
-
return
|
|
1628
|
+
return _this9.createItemHtml(_this9.elementId, i, d);
|
|
1606
1629
|
}).join('');
|
|
1607
1630
|
el.innerHTML = html;
|
|
1608
1631
|
this.options.items.forEach(function (item, i) {
|
|
@@ -1627,7 +1650,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
1627
1650
|
|
|
1628
1651
|
var WebsyDropdown = /*#__PURE__*/function () {
|
|
1629
1652
|
function WebsyDropdown(elementId, options) {
|
|
1630
|
-
var
|
|
1653
|
+
var _this10 = this;
|
|
1631
1654
|
|
|
1632
1655
|
_classCallCheck(this, WebsyDropdown);
|
|
1633
1656
|
|
|
@@ -1676,10 +1699,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1676
1699
|
el.addEventListener('mouseout', this.handleMouseOut.bind(this));
|
|
1677
1700
|
el.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
1678
1701
|
var headerLabel = this.selectedItems.map(function (s) {
|
|
1679
|
-
return
|
|
1702
|
+
return _this10.options.items[s].label || _this10.options.items[s].value;
|
|
1680
1703
|
}).join(this.options.multiValueDelimiter);
|
|
1681
1704
|
var headerValue = this.selectedItems.map(function (s) {
|
|
1682
|
-
return
|
|
1705
|
+
return _this10.options.items[s].value || _this10.options.items[s].label;
|
|
1683
1706
|
}).join(this.options.multiValueDelimiter);
|
|
1684
1707
|
var html = "\n <div id='".concat(this.elementId, "_container' class='websy-dropdown-container ").concat(this.options.disabled ? 'disabled' : '', " ").concat(this.options.disableSearch !== true ? 'with-search' : '', " ").concat(this.options.style, " ").concat(this.options.customActions.length > 0 ? 'with-actions' : '', "'>\n <div id='").concat(this.elementId, "_header' class='websy-dropdown-header ").concat(this.selectedItems.length === 1 ? 'one-selected' : '', " ").concat(this.options.allowClear === true ? 'allow-clear' : '', "'>\n ");
|
|
1685
1708
|
|
|
@@ -1973,10 +1996,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1973
1996
|
}, {
|
|
1974
1997
|
key: "renderItems",
|
|
1975
1998
|
value: function renderItems() {
|
|
1976
|
-
var
|
|
1999
|
+
var _this11 = this;
|
|
1977
2000
|
|
|
1978
2001
|
var html = this.options.items.map(function (r, i) {
|
|
1979
|
-
return "\n <li data-index='".concat(r.index, "' class='websy-dropdown-item ").concat((r.classes || []).join(' '), " ").concat(
|
|
2002
|
+
return "\n <li data-index='".concat(r.index, "' class='websy-dropdown-item ").concat((r.classes || []).join(' '), " ").concat(_this11.selectedItems.indexOf(r.index) !== -1 ? 'active' : '', "'>").concat(r.label, "</li>\n ");
|
|
1980
2003
|
}).join('');
|
|
1981
2004
|
var el = document.getElementById("".concat(this.elementId, "_items"));
|
|
1982
2005
|
|
|
@@ -2212,16 +2235,16 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2212
2235
|
}, {
|
|
2213
2236
|
key: "checkRecaptcha",
|
|
2214
2237
|
value: function checkRecaptcha() {
|
|
2215
|
-
var
|
|
2238
|
+
var _this12 = this;
|
|
2216
2239
|
|
|
2217
2240
|
return new Promise(function (resolve, reject) {
|
|
2218
|
-
if (
|
|
2241
|
+
if (_this12.options.useRecaptcha === true) {
|
|
2219
2242
|
// if (this.recaptchaValue) {
|
|
2220
2243
|
grecaptcha.ready(function () {
|
|
2221
2244
|
grecaptcha.execute(ENVIRONMENT.RECAPTCHA_KEY, {
|
|
2222
2245
|
action: 'submit'
|
|
2223
2246
|
}).then(function (token) {
|
|
2224
|
-
|
|
2247
|
+
_this12.apiService.add('google/checkrecaptcha', {
|
|
2225
2248
|
grecaptcharesponse: token
|
|
2226
2249
|
}).then(function (response) {
|
|
2227
2250
|
if (response.success && response.success === true) {
|
|
@@ -2284,14 +2307,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2284
2307
|
}, {
|
|
2285
2308
|
key: "processComponents",
|
|
2286
2309
|
value: function processComponents(components, callbackFn) {
|
|
2287
|
-
var
|
|
2310
|
+
var _this13 = this;
|
|
2288
2311
|
|
|
2289
2312
|
if (components.length === 0) {
|
|
2290
2313
|
callbackFn();
|
|
2291
2314
|
} else {
|
|
2292
2315
|
components.forEach(function (c) {
|
|
2293
2316
|
if (typeof WebsyDesigns[c.component] !== 'undefined') {
|
|
2294
|
-
c.instance = new WebsyDesigns[c.component]("".concat(
|
|
2317
|
+
c.instance = new WebsyDesigns[c.component]("".concat(_this13.elementId, "_input_").concat(c.field, "_component"), c.options);
|
|
2295
2318
|
} else {// some user feedback here
|
|
2296
2319
|
}
|
|
2297
2320
|
});
|
|
@@ -2312,7 +2335,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2312
2335
|
}, {
|
|
2313
2336
|
key: "render",
|
|
2314
2337
|
value: function render(update, data) {
|
|
2315
|
-
var
|
|
2338
|
+
var _this14 = this;
|
|
2316
2339
|
|
|
2317
2340
|
var el = document.getElementById(this.elementId);
|
|
2318
2341
|
var componentsToProcess = [];
|
|
@@ -2322,11 +2345,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2322
2345
|
this.options.fields.forEach(function (f, i) {
|
|
2323
2346
|
if (f.component) {
|
|
2324
2347
|
componentsToProcess.push(f);
|
|
2325
|
-
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(
|
|
2348
|
+
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(_this14.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
|
|
2326
2349
|
} else if (f.type === 'longtext') {
|
|
2327
|
-
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(
|
|
2350
|
+
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(_this14.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 ");
|
|
2328
2351
|
} else {
|
|
2329
|
-
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(
|
|
2352
|
+
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(_this14.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 ");
|
|
2330
2353
|
}
|
|
2331
2354
|
});
|
|
2332
2355
|
html += "\n --><button class=\"websy-btn submit ".concat(this.options.submit.classes || '', "\">").concat(this.options.submit.text || 'Save', "</button>").concat(this.options.cancel ? '<!--' : '', "\n ");
|
|
@@ -2343,7 +2366,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2343
2366
|
|
|
2344
2367
|
el.innerHTML = html;
|
|
2345
2368
|
this.processComponents(componentsToProcess, function () {
|
|
2346
|
-
if (
|
|
2369
|
+
if (_this14.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {// this.recaptchaReady()
|
|
2347
2370
|
}
|
|
2348
2371
|
});
|
|
2349
2372
|
}
|
|
@@ -2351,7 +2374,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2351
2374
|
}, {
|
|
2352
2375
|
key: "submitForm",
|
|
2353
2376
|
value: function submitForm() {
|
|
2354
|
-
var
|
|
2377
|
+
var _this15 = this;
|
|
2355
2378
|
|
|
2356
2379
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
2357
2380
|
|
|
@@ -2365,32 +2388,32 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2365
2388
|
data[key] = value;
|
|
2366
2389
|
});
|
|
2367
2390
|
|
|
2368
|
-
if (
|
|
2369
|
-
var
|
|
2391
|
+
if (_this15.options.url) {
|
|
2392
|
+
var _this15$apiService;
|
|
2370
2393
|
|
|
2371
|
-
var params = [
|
|
2394
|
+
var params = [_this15.options.url];
|
|
2372
2395
|
|
|
2373
|
-
if (
|
|
2374
|
-
params.push(
|
|
2396
|
+
if (_this15.options.mode === 'update') {
|
|
2397
|
+
params.push(_this15.options.id);
|
|
2375
2398
|
}
|
|
2376
2399
|
|
|
2377
2400
|
params.push(data);
|
|
2378
2401
|
|
|
2379
|
-
(
|
|
2380
|
-
if (
|
|
2402
|
+
(_this15$apiService = _this15.apiService)[_this15.options.mode].apply(_this15$apiService, params).then(function (result) {
|
|
2403
|
+
if (_this15.options.clearAfterSave === true) {
|
|
2381
2404
|
// this.render()
|
|
2382
2405
|
formEl.reset();
|
|
2383
2406
|
}
|
|
2384
2407
|
|
|
2385
|
-
|
|
2408
|
+
_this15.options.onSuccess.call(_this15, result);
|
|
2386
2409
|
}, function (err) {
|
|
2387
2410
|
console.log('Error submitting form data:', err);
|
|
2388
2411
|
|
|
2389
|
-
|
|
2412
|
+
_this15.options.onError.call(_this15, err);
|
|
2390
2413
|
});
|
|
2391
|
-
} else if (
|
|
2392
|
-
|
|
2393
|
-
if (
|
|
2414
|
+
} else if (_this15.options.submitFn) {
|
|
2415
|
+
_this15.options.submitFn(data, function () {
|
|
2416
|
+
if (_this15.options.clearAfterSave === true) {
|
|
2394
2417
|
// this.render()
|
|
2395
2418
|
formEl.reset();
|
|
2396
2419
|
}
|
|
@@ -2410,17 +2433,17 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2410
2433
|
}, {
|
|
2411
2434
|
key: "data",
|
|
2412
2435
|
set: function set(d) {
|
|
2413
|
-
var
|
|
2436
|
+
var _this16 = this;
|
|
2414
2437
|
|
|
2415
2438
|
if (!this.options.fields) {
|
|
2416
2439
|
this.options.fields = [];
|
|
2417
2440
|
}
|
|
2418
2441
|
|
|
2419
2442
|
var _loop = function _loop(key) {
|
|
2420
|
-
|
|
2443
|
+
_this16.options.fields.forEach(function (f) {
|
|
2421
2444
|
if (f.field === key) {
|
|
2422
2445
|
f.value = d[key];
|
|
2423
|
-
var el = document.getElementById("".concat(
|
|
2446
|
+
var el = document.getElementById("".concat(_this16.elementId, "_input_").concat(f.field));
|
|
2424
2447
|
el.value = f.value;
|
|
2425
2448
|
}
|
|
2426
2449
|
});
|
|
@@ -2621,11 +2644,11 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2621
2644
|
}, {
|
|
2622
2645
|
key: "handleSearch",
|
|
2623
2646
|
value: function handleSearch(searchText) {
|
|
2624
|
-
var
|
|
2647
|
+
var _this17 = this;
|
|
2625
2648
|
|
|
2626
2649
|
var el = document.getElementById(this.elementId);
|
|
2627
2650
|
var lowestItems = this.flatItems.filter(function (d) {
|
|
2628
|
-
return d.level ===
|
|
2651
|
+
return d.level === _this17.maxLevel;
|
|
2629
2652
|
});
|
|
2630
2653
|
var visibleItems = lowestItems;
|
|
2631
2654
|
var defaultMethod = 'remove';
|
|
@@ -2633,7 +2656,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2633
2656
|
if (searchText.length > 1) {
|
|
2634
2657
|
defaultMethod = 'add';
|
|
2635
2658
|
visibleItems = lowestItems.filter(function (d) {
|
|
2636
|
-
return d[
|
|
2659
|
+
return d[_this17.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
|
|
2637
2660
|
});
|
|
2638
2661
|
} // hide everything
|
|
2639
2662
|
|
|
@@ -2817,7 +2840,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2817
2840
|
|
|
2818
2841
|
var Pager = /*#__PURE__*/function () {
|
|
2819
2842
|
function Pager(elementId, options) {
|
|
2820
|
-
var
|
|
2843
|
+
var _this18 = this;
|
|
2821
2844
|
|
|
2822
2845
|
_classCallCheck(this, Pager);
|
|
2823
2846
|
|
|
@@ -2870,8 +2893,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2870
2893
|
allowClear: false,
|
|
2871
2894
|
disableSearch: true,
|
|
2872
2895
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
2873
|
-
if (
|
|
2874
|
-
|
|
2896
|
+
if (_this18.options.onChangePageSize) {
|
|
2897
|
+
_this18.options.onChangePageSize(selectedItem.value);
|
|
2875
2898
|
}
|
|
2876
2899
|
}
|
|
2877
2900
|
});
|
|
@@ -2895,13 +2918,13 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2895
2918
|
}, {
|
|
2896
2919
|
key: "render",
|
|
2897
2920
|
value: function render() {
|
|
2898
|
-
var
|
|
2921
|
+
var _this19 = this;
|
|
2899
2922
|
|
|
2900
2923
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
2901
2924
|
|
|
2902
2925
|
if (el) {
|
|
2903
2926
|
var pages = this.options.pages.map(function (item, index) {
|
|
2904
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
2927
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this19.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
2905
2928
|
});
|
|
2906
2929
|
var startIndex = 0;
|
|
2907
2930
|
|
|
@@ -2969,58 +2992,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2969
2992
|
_createClass(WebsyPDFButton, [{
|
|
2970
2993
|
key: "handleClick",
|
|
2971
2994
|
value: function handleClick(event) {
|
|
2972
|
-
var
|
|
2995
|
+
var _this20 = this;
|
|
2973
2996
|
|
|
2974
2997
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
2975
2998
|
this.loader.show();
|
|
2976
2999
|
setTimeout(function () {
|
|
2977
|
-
if (
|
|
2978
|
-
var el = document.getElementById(
|
|
3000
|
+
if (_this20.options.targetId) {
|
|
3001
|
+
var el = document.getElementById(_this20.options.targetId);
|
|
2979
3002
|
|
|
2980
3003
|
if (el) {
|
|
2981
3004
|
var pdfData = {
|
|
2982
3005
|
options: {}
|
|
2983
3006
|
};
|
|
2984
3007
|
|
|
2985
|
-
if (
|
|
2986
|
-
pdfData.options = _extends({},
|
|
3008
|
+
if (_this20.options.pdfOptions) {
|
|
3009
|
+
pdfData.options = _extends({}, _this20.options.pdfOptions);
|
|
2987
3010
|
}
|
|
2988
3011
|
|
|
2989
|
-
if (
|
|
2990
|
-
if (
|
|
2991
|
-
var headerEl = document.getElementById(
|
|
3012
|
+
if (_this20.options.header) {
|
|
3013
|
+
if (_this20.options.header.elementId) {
|
|
3014
|
+
var headerEl = document.getElementById(_this20.options.header.elementId);
|
|
2992
3015
|
|
|
2993
3016
|
if (headerEl) {
|
|
2994
3017
|
pdfData.header = headerEl.outerHTML;
|
|
2995
3018
|
|
|
2996
|
-
if (
|
|
2997
|
-
pdfData.options.headerCSS =
|
|
3019
|
+
if (_this20.options.header.css) {
|
|
3020
|
+
pdfData.options.headerCSS = _this20.options.header.css;
|
|
2998
3021
|
}
|
|
2999
3022
|
}
|
|
3000
|
-
} else if (
|
|
3001
|
-
pdfData.header =
|
|
3023
|
+
} else if (_this20.options.header.html) {
|
|
3024
|
+
pdfData.header = _this20.options.header.html;
|
|
3002
3025
|
|
|
3003
|
-
if (
|
|
3004
|
-
pdfData.options.headerCSS =
|
|
3026
|
+
if (_this20.options.header.css) {
|
|
3027
|
+
pdfData.options.headerCSS = _this20.options.header.css;
|
|
3005
3028
|
}
|
|
3006
3029
|
} else {
|
|
3007
|
-
pdfData.header =
|
|
3030
|
+
pdfData.header = _this20.options.header;
|
|
3008
3031
|
}
|
|
3009
3032
|
}
|
|
3010
3033
|
|
|
3011
|
-
if (
|
|
3012
|
-
if (
|
|
3013
|
-
var footerEl = document.getElementById(
|
|
3034
|
+
if (_this20.options.footer) {
|
|
3035
|
+
if (_this20.options.footer.elementId) {
|
|
3036
|
+
var footerEl = document.getElementById(_this20.options.footer.elementId);
|
|
3014
3037
|
|
|
3015
3038
|
if (footerEl) {
|
|
3016
3039
|
pdfData.footer = footerEl.outerHTML;
|
|
3017
3040
|
|
|
3018
|
-
if (
|
|
3019
|
-
pdfData.options.footerCSS =
|
|
3041
|
+
if (_this20.options.footer.css) {
|
|
3042
|
+
pdfData.options.footerCSS = _this20.options.footer.css;
|
|
3020
3043
|
}
|
|
3021
3044
|
}
|
|
3022
3045
|
} else {
|
|
3023
|
-
pdfData.footer =
|
|
3046
|
+
pdfData.footer = _this20.options.footer;
|
|
3024
3047
|
}
|
|
3025
3048
|
}
|
|
3026
3049
|
|
|
@@ -3029,31 +3052,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3029
3052
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
3030
3053
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
3031
3054
|
|
|
3032
|
-
|
|
3055
|
+
_this20.service.add('', pdfData, {
|
|
3033
3056
|
responseType: 'blob'
|
|
3034
3057
|
}).then(function (response) {
|
|
3035
|
-
|
|
3058
|
+
_this20.loader.hide();
|
|
3036
3059
|
|
|
3037
3060
|
var blob = new Blob([response], {
|
|
3038
3061
|
type: 'application/pdf'
|
|
3039
3062
|
});
|
|
3040
3063
|
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 ");
|
|
3041
3064
|
|
|
3042
|
-
if (
|
|
3065
|
+
if (_this20.options.directDownload === true) {
|
|
3043
3066
|
var fileName;
|
|
3044
3067
|
|
|
3045
|
-
if (typeof
|
|
3046
|
-
fileName =
|
|
3068
|
+
if (typeof _this20.options.fileName === 'function') {
|
|
3069
|
+
fileName = _this20.options.fileName() || 'Export';
|
|
3047
3070
|
} else {
|
|
3048
|
-
fileName =
|
|
3071
|
+
fileName = _this20.options.fileName || 'Export';
|
|
3049
3072
|
}
|
|
3050
3073
|
|
|
3051
3074
|
msg += "download='".concat(fileName, ".pdf'");
|
|
3052
3075
|
}
|
|
3053
3076
|
|
|
3054
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
3077
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this20.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
3055
3078
|
|
|
3056
|
-
|
|
3079
|
+
_this20.popup.show({
|
|
3057
3080
|
message: msg,
|
|
3058
3081
|
mask: true
|
|
3059
3082
|
});
|
|
@@ -3254,7 +3277,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3254
3277
|
|
|
3255
3278
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
3256
3279
|
function ResponsiveText(elementId, options) {
|
|
3257
|
-
var
|
|
3280
|
+
var _this21 = this;
|
|
3258
3281
|
|
|
3259
3282
|
_classCallCheck(this, ResponsiveText);
|
|
3260
3283
|
|
|
@@ -3267,7 +3290,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3267
3290
|
this.elementId = elementId;
|
|
3268
3291
|
this.canvas = document.createElement('canvas');
|
|
3269
3292
|
window.addEventListener('resize', function () {
|
|
3270
|
-
return
|
|
3293
|
+
return _this21.render();
|
|
3271
3294
|
});
|
|
3272
3295
|
var el = document.getElementById(this.elementId);
|
|
3273
3296
|
|
|
@@ -3486,7 +3509,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3486
3509
|
|
|
3487
3510
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3488
3511
|
function WebsyResultList(elementId, options) {
|
|
3489
|
-
var
|
|
3512
|
+
var _this22 = this;
|
|
3490
3513
|
|
|
3491
3514
|
_classCallCheck(this, WebsyResultList);
|
|
3492
3515
|
|
|
@@ -3518,9 +3541,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3518
3541
|
|
|
3519
3542
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3520
3543
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3521
|
-
|
|
3544
|
+
_this22.options.template = templateString;
|
|
3522
3545
|
|
|
3523
|
-
|
|
3546
|
+
_this22.render();
|
|
3524
3547
|
});
|
|
3525
3548
|
} else {
|
|
3526
3549
|
this.render();
|
|
@@ -3540,7 +3563,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3540
3563
|
}, {
|
|
3541
3564
|
key: "buildHTML",
|
|
3542
3565
|
value: function buildHTML(d) {
|
|
3543
|
-
var
|
|
3566
|
+
var _this23 = this;
|
|
3544
3567
|
|
|
3545
3568
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3546
3569
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -3550,7 +3573,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3550
3573
|
if (this.options.template) {
|
|
3551
3574
|
if (d.length > 0) {
|
|
3552
3575
|
d.forEach(function (row, ix) {
|
|
3553
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate ||
|
|
3576
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this23.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
3554
3577
|
|
|
3555
3578
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3556
3579
|
|
|
@@ -3655,7 +3678,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3655
3678
|
parts.forEach(function (p) {
|
|
3656
3679
|
items = items[p];
|
|
3657
3680
|
});
|
|
3658
|
-
template = template.replace(m[0],
|
|
3681
|
+
template = template.replace(m[0], _this23.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
3659
3682
|
}
|
|
3660
3683
|
});
|
|
3661
3684
|
|
|
@@ -3667,7 +3690,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3667
3690
|
}
|
|
3668
3691
|
});
|
|
3669
3692
|
|
|
3670
|
-
var flatRow =
|
|
3693
|
+
var flatRow = _this23.flattenObject(row);
|
|
3671
3694
|
|
|
3672
3695
|
for (var key in flatRow) {
|
|
3673
3696
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
@@ -3802,13 +3825,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3802
3825
|
}, {
|
|
3803
3826
|
key: "render",
|
|
3804
3827
|
value: function render() {
|
|
3805
|
-
var
|
|
3828
|
+
var _this24 = this;
|
|
3806
3829
|
|
|
3807
3830
|
if (this.options.entity) {
|
|
3808
3831
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
3809
|
-
|
|
3832
|
+
_this24.rows = results.rows;
|
|
3810
3833
|
|
|
3811
|
-
|
|
3834
|
+
_this24.resize();
|
|
3812
3835
|
});
|
|
3813
3836
|
} else {
|
|
3814
3837
|
this.resize();
|
|
@@ -3894,14 +3917,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3894
3917
|
_createClass(WebsyRouter, [{
|
|
3895
3918
|
key: "addGroup",
|
|
3896
3919
|
value: function addGroup(group) {
|
|
3897
|
-
var
|
|
3920
|
+
var _this25 = this;
|
|
3898
3921
|
|
|
3899
3922
|
if (!this.groups[group]) {
|
|
3900
3923
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3901
3924
|
|
|
3902
3925
|
if (els) {
|
|
3903
3926
|
this.getClosestParent(els[0], function (parent) {
|
|
3904
|
-
|
|
3927
|
+
_this25.groups[group] = {
|
|
3905
3928
|
activeView: '',
|
|
3906
3929
|
views: [],
|
|
3907
3930
|
parent: parent.getAttribute('data-view')
|
|
@@ -3964,7 +3987,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3964
3987
|
}, {
|
|
3965
3988
|
key: "removeUrlParams",
|
|
3966
3989
|
value: function removeUrlParams() {
|
|
3967
|
-
var
|
|
3990
|
+
var _this26 = this;
|
|
3968
3991
|
|
|
3969
3992
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
3970
3993
|
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -3978,7 +4001,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3978
4001
|
|
|
3979
4002
|
if (this.currentParams && this.currentParams.items) {
|
|
3980
4003
|
params.forEach(function (p) {
|
|
3981
|
-
delete
|
|
4004
|
+
delete _this26.currentParams.items[p];
|
|
3982
4005
|
});
|
|
3983
4006
|
path = this.buildUrlPath(this.currentParams.items);
|
|
3984
4007
|
}
|
|
@@ -4342,12 +4365,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4342
4365
|
}, {
|
|
4343
4366
|
key: "showComponents",
|
|
4344
4367
|
value: function showComponents(view) {
|
|
4345
|
-
var
|
|
4368
|
+
var _this27 = this;
|
|
4346
4369
|
|
|
4347
4370
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4348
4371
|
this.options.views[view].components.forEach(function (c) {
|
|
4349
4372
|
if (typeof c.instance === 'undefined') {
|
|
4350
|
-
|
|
4373
|
+
_this27.prepComponent(c.elementId, c.options);
|
|
4351
4374
|
|
|
4352
4375
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4353
4376
|
} else if (c.instance.render) {
|
|
@@ -4724,7 +4747,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
4724
4747
|
|
|
4725
4748
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
4726
4749
|
function WebsyTemplate(elementId, options) {
|
|
4727
|
-
var
|
|
4750
|
+
var _this28 = this;
|
|
4728
4751
|
|
|
4729
4752
|
_classCallCheck(this, WebsyTemplate);
|
|
4730
4753
|
|
|
@@ -4750,9 +4773,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4750
4773
|
|
|
4751
4774
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4752
4775
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4753
|
-
|
|
4776
|
+
_this28.options.template = templateString;
|
|
4754
4777
|
|
|
4755
|
-
|
|
4778
|
+
_this28.render();
|
|
4756
4779
|
});
|
|
4757
4780
|
} else {
|
|
4758
4781
|
this.render();
|
|
@@ -4762,7 +4785,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4762
4785
|
_createClass(WebsyTemplate, [{
|
|
4763
4786
|
key: "buildHTML",
|
|
4764
4787
|
value: function buildHTML() {
|
|
4765
|
-
var
|
|
4788
|
+
var _this29 = this;
|
|
4766
4789
|
|
|
4767
4790
|
var html = "";
|
|
4768
4791
|
|
|
@@ -4824,14 +4847,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4824
4847
|
}
|
|
4825
4848
|
|
|
4826
4849
|
if (polarity === true) {
|
|
4827
|
-
if (typeof
|
|
4850
|
+
if (typeof _this29.options.data[parts[0]] !== 'undefined' && _this29.options.data[parts[0]] === parts[1]) {
|
|
4828
4851
|
// remove the <if> tags
|
|
4829
4852
|
removeAll = false;
|
|
4830
4853
|
} else if (parts[0] === parts[1]) {
|
|
4831
4854
|
removeAll = false;
|
|
4832
4855
|
}
|
|
4833
4856
|
} else if (polarity === false) {
|
|
4834
|
-
if (typeof
|
|
4857
|
+
if (typeof _this29.options.data[parts[0]] !== 'undefined' && _this29.options.data[parts[0]] !== parts[1]) {
|
|
4835
4858
|
// remove the <if> tags
|
|
4836
4859
|
removeAll = false;
|
|
4837
4860
|
}
|
|
@@ -5121,7 +5144,7 @@ var WebsyUtils = {
|
|
|
5121
5144
|
|
|
5122
5145
|
var WebsyTable = /*#__PURE__*/function () {
|
|
5123
5146
|
function WebsyTable(elementId, options) {
|
|
5124
|
-
var
|
|
5147
|
+
var _this30 = this;
|
|
5125
5148
|
|
|
5126
5149
|
_classCallCheck(this, WebsyTable);
|
|
5127
5150
|
|
|
@@ -5159,8 +5182,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5159
5182
|
allowClear: false,
|
|
5160
5183
|
disableSearch: true,
|
|
5161
5184
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5162
|
-
if (
|
|
5163
|
-
|
|
5185
|
+
if (_this30.options.onChangePageSize) {
|
|
5186
|
+
_this30.options.onChangePageSize(selectedItem.value);
|
|
5164
5187
|
}
|
|
5165
5188
|
}
|
|
5166
5189
|
});
|
|
@@ -5181,7 +5204,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5181
5204
|
_createClass(WebsyTable, [{
|
|
5182
5205
|
key: "appendRows",
|
|
5183
5206
|
value: function appendRows(data) {
|
|
5184
|
-
var
|
|
5207
|
+
var _this31 = this;
|
|
5185
5208
|
|
|
5186
5209
|
this.hideError();
|
|
5187
5210
|
var bodyHTML = '';
|
|
@@ -5189,15 +5212,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5189
5212
|
if (data) {
|
|
5190
5213
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5191
5214
|
return '<tr>' + r.map(function (c, i) {
|
|
5192
|
-
if (
|
|
5215
|
+
if (_this31.options.columns[i].show !== false) {
|
|
5193
5216
|
var style = '';
|
|
5194
5217
|
|
|
5195
5218
|
if (c.style) {
|
|
5196
5219
|
style += c.style;
|
|
5197
5220
|
}
|
|
5198
5221
|
|
|
5199
|
-
if (
|
|
5200
|
-
style += "width: ".concat(
|
|
5222
|
+
if (_this31.options.columns[i].width) {
|
|
5223
|
+
style += "width: ".concat(_this31.options.columns[i].width, "; ");
|
|
5201
5224
|
}
|
|
5202
5225
|
|
|
5203
5226
|
if (c.backgroundColor) {
|
|
@@ -5212,18 +5235,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5212
5235
|
style += "color: ".concat(c.color, "; ");
|
|
5213
5236
|
}
|
|
5214
5237
|
|
|
5215
|
-
if (
|
|
5216
|
-
return "\n <td \n data-row-index='".concat(
|
|
5217
|
-
} else if ((
|
|
5218
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5238
|
+
if (_this31.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5239
|
+
return "\n <td \n data-row-index='".concat(_this31.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this31.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(_this31.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this31.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5240
|
+
} else if ((_this31.options.columns[i].showAsNavigatorLink === true || _this31.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5241
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this31.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this31.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this31.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this31.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5219
5242
|
} else {
|
|
5220
5243
|
var info = c.value;
|
|
5221
5244
|
|
|
5222
|
-
if (
|
|
5245
|
+
if (_this31.options.columns[i].showAsImage === true) {
|
|
5223
5246
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5224
5247
|
}
|
|
5225
5248
|
|
|
5226
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5249
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this31.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this31.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 ");
|
|
5227
5250
|
}
|
|
5228
5251
|
}
|
|
5229
5252
|
}).join('') + '</tr>';
|
|
@@ -5395,7 +5418,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5395
5418
|
}, {
|
|
5396
5419
|
key: "render",
|
|
5397
5420
|
value: function render(data) {
|
|
5398
|
-
var
|
|
5421
|
+
var _this32 = this;
|
|
5399
5422
|
|
|
5400
5423
|
if (!this.options.columns) {
|
|
5401
5424
|
return;
|
|
@@ -5430,7 +5453,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5430
5453
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
5431
5454
|
}
|
|
5432
5455
|
|
|
5433
|
-
return "\n <th style=\"".concat(style, "\">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-index=\"").concat(i, "\" \n data-sort=\"").concat(c.sort, "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n <!--").concat(c.searchable === true ?
|
|
5456
|
+
return "\n <th style=\"".concat(style, "\">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-index=\"").concat(i, "\" \n data-sort=\"").concat(c.sort, "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n <!--").concat(c.searchable === true ? _this32.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
5434
5457
|
}
|
|
5435
5458
|
}).join('') + '</tr>';
|
|
5436
5459
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5449,7 +5472,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5449
5472
|
|
|
5450
5473
|
if (pagingEl) {
|
|
5451
5474
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5452
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5475
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this32.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5453
5476
|
});
|
|
5454
5477
|
var startIndex = 0;
|
|
5455
5478
|
|
|
@@ -5517,7 +5540,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5517
5540
|
|
|
5518
5541
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5519
5542
|
function WebsyTable2(elementId, options) {
|
|
5520
|
-
var
|
|
5543
|
+
var _this33 = this;
|
|
5521
5544
|
|
|
5522
5545
|
_classCallCheck(this, WebsyTable2);
|
|
5523
5546
|
|
|
@@ -5558,8 +5581,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5558
5581
|
allowClear: false,
|
|
5559
5582
|
disableSearch: true,
|
|
5560
5583
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5561
|
-
if (
|
|
5562
|
-
|
|
5584
|
+
if (_this33.options.onChangePageSize) {
|
|
5585
|
+
_this33.options.onChangePageSize(selectedItem.value);
|
|
5563
5586
|
}
|
|
5564
5587
|
}
|
|
5565
5588
|
});
|
|
@@ -5583,7 +5606,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5583
5606
|
_createClass(WebsyTable2, [{
|
|
5584
5607
|
key: "appendRows",
|
|
5585
5608
|
value: function appendRows(data) {
|
|
5586
|
-
var
|
|
5609
|
+
var _this34 = this;
|
|
5587
5610
|
|
|
5588
5611
|
this.hideError();
|
|
5589
5612
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -5592,15 +5615,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5592
5615
|
if (data) {
|
|
5593
5616
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5594
5617
|
return '<tr>' + r.map(function (c, i) {
|
|
5595
|
-
if (
|
|
5596
|
-
var style = "height: ".concat(
|
|
5618
|
+
if (_this34.options.columns[i].show !== false) {
|
|
5619
|
+
var style = "height: ".concat(_this34.options.cellSize, "px; line-height: ").concat(_this34.options.cellSize, "px;");
|
|
5597
5620
|
|
|
5598
5621
|
if (c.style) {
|
|
5599
5622
|
style += c.style;
|
|
5600
5623
|
}
|
|
5601
5624
|
|
|
5602
|
-
if (
|
|
5603
|
-
style += "width: ".concat(
|
|
5625
|
+
if (_this34.options.columns[i].width) {
|
|
5626
|
+
style += "width: ".concat(_this34.options.columns[i].width, "; ");
|
|
5604
5627
|
}
|
|
5605
5628
|
|
|
5606
5629
|
if (c.backgroundColor) {
|
|
@@ -5615,18 +5638,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5615
5638
|
style += "color: ".concat(c.color, "; ");
|
|
5616
5639
|
}
|
|
5617
5640
|
|
|
5618
|
-
if (
|
|
5619
|
-
return "\n <td \n data-row-index='".concat(
|
|
5620
|
-
} else if ((
|
|
5621
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5641
|
+
if (_this34.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5642
|
+
return "\n <td \n data-row-index='".concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this34.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(_this34.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this34.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5643
|
+
} else if ((_this34.options.columns[i].showAsNavigatorLink === true || _this34.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5644
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this34.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this34.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this34.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5622
5645
|
} else {
|
|
5623
5646
|
var info = c.value;
|
|
5624
5647
|
|
|
5625
|
-
if (
|
|
5648
|
+
if (_this34.options.columns[i].showAsImage === true) {
|
|
5626
5649
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5627
5650
|
}
|
|
5628
5651
|
|
|
5629
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5652
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this34.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 ");
|
|
5630
5653
|
}
|
|
5631
5654
|
}
|
|
5632
5655
|
}).join('') + '</tr>';
|
|
@@ -5889,7 +5912,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5889
5912
|
}, {
|
|
5890
5913
|
key: "render",
|
|
5891
5914
|
value: function render(data) {
|
|
5892
|
-
var
|
|
5915
|
+
var _this35 = this;
|
|
5893
5916
|
|
|
5894
5917
|
if (!this.options.columns) {
|
|
5895
5918
|
return;
|
|
@@ -5925,7 +5948,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5925
5948
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
5926
5949
|
}
|
|
5927
5950
|
|
|
5928
|
-
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 ?
|
|
5951
|
+
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 ? _this35.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5929
5952
|
}
|
|
5930
5953
|
}).join('') + '</tr>';
|
|
5931
5954
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5936,7 +5959,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5936
5959
|
var dropdownHTML = "";
|
|
5937
5960
|
this.options.columns.forEach(function (c, i) {
|
|
5938
5961
|
if (c.searchable && c.searchField) {
|
|
5939
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
5962
|
+
dropdownHTML += "\n <div id=\"".concat(_this35.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
5940
5963
|
}
|
|
5941
5964
|
});
|
|
5942
5965
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -5958,7 +5981,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5958
5981
|
|
|
5959
5982
|
if (pagingEl) {
|
|
5960
5983
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5961
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5984
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this35.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5962
5985
|
});
|
|
5963
5986
|
var startIndex = 0;
|
|
5964
5987
|
|
|
@@ -6049,7 +6072,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6049
6072
|
}, {
|
|
6050
6073
|
key: "getColumnParameters",
|
|
6051
6074
|
value: function getColumnParameters(values) {
|
|
6052
|
-
var
|
|
6075
|
+
var _this36 = this;
|
|
6053
6076
|
|
|
6054
6077
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
6055
6078
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -6057,10 +6080,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6057
6080
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
6058
6081
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6059
6082
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
6060
|
-
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 ?
|
|
6083
|
+
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 ? _this36.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6061
6084
|
}).join('') + '</tr>';
|
|
6062
6085
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
6063
|
-
return "\n <td \n style='height: ".concat(
|
|
6086
|
+
return "\n <td \n style='height: ".concat(_this36.options.cellSize, "px; line-height: ").concat(_this36.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
6064
6087
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
6065
6088
|
|
|
6066
6089
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -6282,7 +6305,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6282
6305
|
}, {
|
|
6283
6306
|
key: "buildHeaderHtml",
|
|
6284
6307
|
value: function buildHeaderHtml() {
|
|
6285
|
-
var
|
|
6308
|
+
var _this37 = this;
|
|
6286
6309
|
|
|
6287
6310
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6288
6311
|
var headerHtml = '';
|
|
@@ -6297,7 +6320,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6297
6320
|
}
|
|
6298
6321
|
|
|
6299
6322
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
6300
|
-
if (useWidths === false && rowIndex !==
|
|
6323
|
+
if (useWidths === false && rowIndex !== _this37.options.columns.length - 1) {
|
|
6301
6324
|
// if we're calculating the size we only want to render the last row of column headers
|
|
6302
6325
|
return;
|
|
6303
6326
|
}
|
|
@@ -6323,18 +6346,18 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6323
6346
|
// `
|
|
6324
6347
|
// }
|
|
6325
6348
|
|
|
6326
|
-
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ?
|
|
6349
|
+
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ? _this37.buildSearchIcon(col, colIndex) : '', "</div></td>");
|
|
6327
6350
|
});
|
|
6328
6351
|
headerHtml += "</tr>";
|
|
6329
6352
|
});
|
|
6330
6353
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6331
6354
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6332
6355
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6333
|
-
var testEl = document.getElementById("".concat(
|
|
6356
|
+
var testEl = document.getElementById("".concat(_this37.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6334
6357
|
|
|
6335
6358
|
if (!testEl) {
|
|
6336
6359
|
var newE = document.createElement('div');
|
|
6337
|
-
newE.id = "".concat(
|
|
6360
|
+
newE.id = "".concat(_this37.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6338
6361
|
newE.className = 'websy-modal-dropdown';
|
|
6339
6362
|
dropdownEl.appendChild(newE);
|
|
6340
6363
|
}
|
|
@@ -6350,7 +6373,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6350
6373
|
}, {
|
|
6351
6374
|
key: "buildTotalHtml",
|
|
6352
6375
|
value: function buildTotalHtml() {
|
|
6353
|
-
var
|
|
6376
|
+
var _this38 = this;
|
|
6354
6377
|
|
|
6355
6378
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6356
6379
|
|
|
@@ -6363,7 +6386,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6363
6386
|
totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6364
6387
|
|
|
6365
6388
|
if (useWidths === true) {
|
|
6366
|
-
totalHtml += "\n style='width: ".concat(
|
|
6389
|
+
totalHtml += "\n style='width: ".concat(_this38.options.columns[_this38.options.columns.length - 1][colIndex].width || _this38.options.columns[_this38.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
6367
6390
|
}
|
|
6368
6391
|
|
|
6369
6392
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
@@ -6374,7 +6397,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6374
6397
|
}, {
|
|
6375
6398
|
key: "calculateSizes",
|
|
6376
6399
|
value: function calculateSizes() {
|
|
6377
|
-
var
|
|
6400
|
+
var _this39 = this;
|
|
6378
6401
|
|
|
6379
6402
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6380
6403
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -6417,32 +6440,32 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6417
6440
|
rows.forEach(function (row, rowIndex) {
|
|
6418
6441
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6419
6442
|
var colSize = col.getBoundingClientRect();
|
|
6420
|
-
|
|
6443
|
+
_this39.sizes.cellHeight = colSize.height;
|
|
6421
6444
|
|
|
6422
|
-
if (
|
|
6423
|
-
if (!
|
|
6424
|
-
|
|
6445
|
+
if (_this39.options.columns[_this39.options.columns.length - 1][colIndex]) {
|
|
6446
|
+
if (!_this39.options.columns[_this39.options.columns.length - 1][colIndex].actualWidth) {
|
|
6447
|
+
_this39.options.columns[_this39.options.columns.length - 1][colIndex].actualWidth = 0;
|
|
6425
6448
|
}
|
|
6426
6449
|
|
|
6427
|
-
|
|
6428
|
-
|
|
6450
|
+
_this39.options.columns[_this39.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this39.options.columns[_this39.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
|
|
6451
|
+
_this39.options.columns[_this39.options.columns.length - 1][colIndex].cellHeight = colSize.height;
|
|
6429
6452
|
|
|
6430
|
-
if (colIndex >=
|
|
6431
|
-
firstNonPinnedColumnWidth =
|
|
6453
|
+
if (colIndex >= _this39.pinnedColumns) {
|
|
6454
|
+
firstNonPinnedColumnWidth = _this39.options.columns[_this39.options.columns.length - 1][colIndex].actualWidth;
|
|
6432
6455
|
}
|
|
6433
6456
|
}
|
|
6434
6457
|
});
|
|
6435
6458
|
});
|
|
6436
6459
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6437
|
-
if (colIndex <
|
|
6438
|
-
|
|
6460
|
+
if (colIndex < _this39.pinnedColumns) {
|
|
6461
|
+
_this39.sizes.scrollableWidth -= col.actualWidth;
|
|
6439
6462
|
}
|
|
6440
6463
|
});
|
|
6441
6464
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
6442
6465
|
return a + (b.width || b.actualWidth);
|
|
6443
6466
|
}, 0);
|
|
6444
6467
|
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
|
|
6445
|
-
return i >=
|
|
6468
|
+
return i >= _this39.pinnedColumns;
|
|
6446
6469
|
}).reduce(function (a, b) {
|
|
6447
6470
|
return a + (b.width || b.actualWidth);
|
|
6448
6471
|
}, 0);
|
|
@@ -6463,10 +6486,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6463
6486
|
c.actualWidth += equalWidth; // }
|
|
6464
6487
|
// }
|
|
6465
6488
|
|
|
6466
|
-
|
|
6489
|
+
_this39.sizes.totalWidth += c.width || c.actualWidth;
|
|
6467
6490
|
|
|
6468
|
-
if (i <
|
|
6469
|
-
|
|
6491
|
+
if (i < _this39.pinnedColumns) {
|
|
6492
|
+
_this39.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6470
6493
|
} // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
6471
6494
|
|
|
6472
6495
|
});
|
|
@@ -6523,7 +6546,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6523
6546
|
}, {
|
|
6524
6547
|
key: "createSample",
|
|
6525
6548
|
value: function createSample(data) {
|
|
6526
|
-
var
|
|
6549
|
+
var _this40 = this;
|
|
6527
6550
|
|
|
6528
6551
|
var output = [];
|
|
6529
6552
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
@@ -6535,7 +6558,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6535
6558
|
var longest = '';
|
|
6536
6559
|
|
|
6537
6560
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
6538
|
-
if (data[i].length ===
|
|
6561
|
+
if (data[i].length === _this40.options.columns[_this40.options.columns.length - 1].length) {
|
|
6539
6562
|
if (longest.length < data[i][colIndex].value.length) {
|
|
6540
6563
|
longest = data[i][colIndex].value;
|
|
6541
6564
|
}
|
|
@@ -6930,7 +6953,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6930
6953
|
|
|
6931
6954
|
var WebsyChart = /*#__PURE__*/function () {
|
|
6932
6955
|
function WebsyChart(elementId, options) {
|
|
6933
|
-
var
|
|
6956
|
+
var _this41 = this;
|
|
6934
6957
|
|
|
6935
6958
|
_classCallCheck(this, WebsyChart);
|
|
6936
6959
|
|
|
@@ -6981,22 +7004,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6981
7004
|
this.invertOverride = function (input, input2) {
|
|
6982
7005
|
var xAxis = 'bottomAxis';
|
|
6983
7006
|
|
|
6984
|
-
if (
|
|
7007
|
+
if (_this41.options.orientation === 'horizontal') {
|
|
6985
7008
|
xAxis = 'leftAxis';
|
|
6986
7009
|
}
|
|
6987
7010
|
|
|
6988
|
-
var width =
|
|
7011
|
+
var width = _this41[xAxis].step();
|
|
6989
7012
|
|
|
6990
7013
|
var output;
|
|
6991
7014
|
|
|
6992
|
-
var domain = _toConsumableArray(
|
|
7015
|
+
var domain = _toConsumableArray(_this41[xAxis].domain());
|
|
6993
7016
|
|
|
6994
|
-
if (
|
|
7017
|
+
if (_this41.options.orientation === 'horizontal') {
|
|
6995
7018
|
domain = domain.reverse();
|
|
6996
7019
|
}
|
|
6997
7020
|
|
|
6998
7021
|
for (var j = 0; j < domain.length; j++) {
|
|
6999
|
-
var breakA =
|
|
7022
|
+
var breakA = _this41[xAxis](domain[j]) - width / 2;
|
|
7000
7023
|
var breakB = breakA + width;
|
|
7001
7024
|
|
|
7002
7025
|
if (input > breakA && input <= breakB) {
|
|
@@ -7096,10 +7119,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7096
7119
|
}, {
|
|
7097
7120
|
key: "handleEventMouseMove",
|
|
7098
7121
|
value: function handleEventMouseMove(event, d) {
|
|
7099
|
-
var
|
|
7122
|
+
var _this42 = this;
|
|
7100
7123
|
|
|
7101
7124
|
var bisectDate = d3.bisector(function (d) {
|
|
7102
|
-
return
|
|
7125
|
+
return _this42.parseX(d.x.value);
|
|
7103
7126
|
}).left;
|
|
7104
7127
|
|
|
7105
7128
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -7138,8 +7161,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7138
7161
|
}
|
|
7139
7162
|
|
|
7140
7163
|
this.options.data.series.forEach(function (s) {
|
|
7141
|
-
if (
|
|
7142
|
-
xPoint =
|
|
7164
|
+
if (_this42.options.data[xData].scale !== 'Time') {
|
|
7165
|
+
xPoint = _this42[xAxis](_this42.parseX(xLabel));
|
|
7143
7166
|
s.data.forEach(function (d) {
|
|
7144
7167
|
if (d.x.value === xLabel) {
|
|
7145
7168
|
if (!tooltipTitle) {
|
|
@@ -7158,13 +7181,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7158
7181
|
var pointA = s.data[index - 1];
|
|
7159
7182
|
var pointB = s.data[index];
|
|
7160
7183
|
|
|
7161
|
-
if (
|
|
7184
|
+
if (_this42.options.orientation === 'horizontal') {
|
|
7162
7185
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7163
7186
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7164
7187
|
}
|
|
7165
7188
|
|
|
7166
7189
|
if (pointA && !pointB) {
|
|
7167
|
-
xPoint =
|
|
7190
|
+
xPoint = _this42[xAxis](_this42.parseX(pointA.x.value));
|
|
7168
7191
|
tooltipTitle = pointA.x.value;
|
|
7169
7192
|
|
|
7170
7193
|
if (!pointA.y.color) {
|
|
@@ -7174,12 +7197,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7174
7197
|
tooltipData.push(pointA.y);
|
|
7175
7198
|
|
|
7176
7199
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7177
|
-
tooltipTitle = d3.timeFormat(
|
|
7200
|
+
tooltipTitle = d3.timeFormat(_this42.options.dateFormat || _this42.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7178
7201
|
}
|
|
7179
7202
|
}
|
|
7180
7203
|
|
|
7181
7204
|
if (pointB && !pointA) {
|
|
7182
|
-
xPoint =
|
|
7205
|
+
xPoint = _this42[xAxis](_this42.parseX(pointB.x.value));
|
|
7183
7206
|
tooltipTitle = pointB.x.value;
|
|
7184
7207
|
|
|
7185
7208
|
if (!pointB.y.color) {
|
|
@@ -7189,14 +7212,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7189
7212
|
tooltipData.push(pointB.y);
|
|
7190
7213
|
|
|
7191
7214
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7192
|
-
tooltipTitle = d3.timeFormat(
|
|
7215
|
+
tooltipTitle = d3.timeFormat(_this42.options.dateFormat || _this42.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7193
7216
|
}
|
|
7194
7217
|
}
|
|
7195
7218
|
|
|
7196
7219
|
if (pointA && pointB) {
|
|
7197
|
-
var d0 =
|
|
7220
|
+
var d0 = _this42[xAxis](_this42.parseX(pointA.x.value));
|
|
7198
7221
|
|
|
7199
|
-
var d1 =
|
|
7222
|
+
var d1 = _this42[xAxis](_this42.parseX(pointB.x.value));
|
|
7200
7223
|
|
|
7201
7224
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7202
7225
|
|
|
@@ -7205,7 +7228,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7205
7228
|
tooltipTitle = pointB.x.value;
|
|
7206
7229
|
|
|
7207
7230
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7208
|
-
tooltipTitle = d3.timeFormat(
|
|
7231
|
+
tooltipTitle = d3.timeFormat(_this42.options.dateFormat || _this42.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7209
7232
|
}
|
|
7210
7233
|
|
|
7211
7234
|
if (!pointB.y.color) {
|
|
@@ -7218,7 +7241,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7218
7241
|
tooltipTitle = pointA.x.value;
|
|
7219
7242
|
|
|
7220
7243
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7221
|
-
tooltipTitle = d3.timeFormat(
|
|
7244
|
+
tooltipTitle = d3.timeFormat(_this42.options.dateFormat || _this42.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7222
7245
|
}
|
|
7223
7246
|
|
|
7224
7247
|
if (!pointA.y.color) {
|
|
@@ -7332,7 +7355,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7332
7355
|
}, {
|
|
7333
7356
|
key: "render",
|
|
7334
7357
|
value: function render(options) {
|
|
7335
|
-
var
|
|
7358
|
+
var _this43 = this;
|
|
7336
7359
|
|
|
7337
7360
|
/* global d3 options WebsyUtils */
|
|
7338
7361
|
if (typeof options !== 'undefined') {
|
|
@@ -7401,7 +7424,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7401
7424
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
7402
7425
|
return {
|
|
7403
7426
|
value: s.label || s.key,
|
|
7404
|
-
color: s.color ||
|
|
7427
|
+
color: s.color || _this43.options.colors[i % _this43.options.colors.length]
|
|
7405
7428
|
};
|
|
7406
7429
|
});
|
|
7407
7430
|
|
|
@@ -7683,7 +7706,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7683
7706
|
|
|
7684
7707
|
if (this.options.data.bottom.formatter) {
|
|
7685
7708
|
bAxisFunc.tickFormat(function (d) {
|
|
7686
|
-
return
|
|
7709
|
+
return _this43.options.data.bottom.formatter(d);
|
|
7687
7710
|
});
|
|
7688
7711
|
}
|
|
7689
7712
|
|
|
@@ -7709,8 +7732,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7709
7732
|
|
|
7710
7733
|
if (this.options.margin.axisLeft > 0) {
|
|
7711
7734
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7712
|
-
if (
|
|
7713
|
-
d =
|
|
7735
|
+
if (_this43.options.data.left.formatter) {
|
|
7736
|
+
d = _this43.options.data.left.formatter(d);
|
|
7714
7737
|
}
|
|
7715
7738
|
|
|
7716
7739
|
return d;
|
|
@@ -7747,8 +7770,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7747
7770
|
|
|
7748
7771
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
7749
7772
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7750
|
-
if (
|
|
7751
|
-
d =
|
|
7773
|
+
if (_this43.options.data.right.formatter) {
|
|
7774
|
+
d = _this43.options.data.right.formatter(d);
|
|
7752
7775
|
}
|
|
7753
7776
|
|
|
7754
7777
|
return d;
|
|
@@ -7787,18 +7810,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7787
7810
|
this.renderedKeys = {};
|
|
7788
7811
|
this.options.data.series.forEach(function (series, index) {
|
|
7789
7812
|
if (!series.key) {
|
|
7790
|
-
series.key =
|
|
7813
|
+
series.key = _this43.createIdentity();
|
|
7791
7814
|
}
|
|
7792
7815
|
|
|
7793
7816
|
if (!series.color) {
|
|
7794
|
-
series.color =
|
|
7817
|
+
series.color = _this43.options.colors[index % _this43.options.colors.length];
|
|
7795
7818
|
}
|
|
7796
7819
|
|
|
7797
|
-
|
|
7820
|
+
_this43["render".concat(series.type || 'bar')](series, index);
|
|
7798
7821
|
|
|
7799
|
-
|
|
7822
|
+
_this43.renderLabels(series, index);
|
|
7800
7823
|
|
|
7801
|
-
|
|
7824
|
+
_this43.renderedKeys[series.key] = series.type;
|
|
7802
7825
|
});
|
|
7803
7826
|
}
|
|
7804
7827
|
}
|
|
@@ -7806,17 +7829,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7806
7829
|
}, {
|
|
7807
7830
|
key: "renderarea",
|
|
7808
7831
|
value: function renderarea(series, index) {
|
|
7809
|
-
var
|
|
7832
|
+
var _this44 = this;
|
|
7810
7833
|
|
|
7811
7834
|
/* global d3 series index */
|
|
7812
7835
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
7813
7836
|
return d3.area().x(function (d) {
|
|
7814
|
-
return
|
|
7837
|
+
return _this44[xAxis](_this44.parseX(d.x.value));
|
|
7815
7838
|
}).y0(function (d) {
|
|
7816
|
-
return
|
|
7839
|
+
return _this44[yAxis](0);
|
|
7817
7840
|
}).y1(function (d) {
|
|
7818
|
-
return
|
|
7819
|
-
}).curve(d3[curveStyle ||
|
|
7841
|
+
return _this44[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7842
|
+
}).curve(d3[curveStyle || _this44.options.curveStyle]);
|
|
7820
7843
|
};
|
|
7821
7844
|
|
|
7822
7845
|
var xAxis = 'bottomAxis';
|
|
@@ -7939,7 +7962,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7939
7962
|
}, {
|
|
7940
7963
|
key: "renderLabels",
|
|
7941
7964
|
value: function renderLabels(series, index) {
|
|
7942
|
-
var
|
|
7965
|
+
var _this45 = this;
|
|
7943
7966
|
|
|
7944
7967
|
/* global series index d3 WebsyDesigns */
|
|
7945
7968
|
var xAxis = 'bottomAxis';
|
|
@@ -7958,11 +7981,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7958
7981
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
7959
7982
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
7960
7983
|
labels.attr('x', function (d) {
|
|
7961
|
-
return getLabelX.call(
|
|
7984
|
+
return getLabelX.call(_this45, d, series.labelPosition);
|
|
7962
7985
|
}).attr('y', function (d) {
|
|
7963
|
-
return getLabelY.call(
|
|
7986
|
+
return getLabelY.call(_this45, d, series.labelPosition);
|
|
7964
7987
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
7965
|
-
return
|
|
7988
|
+
return _this45.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7966
7989
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
7967
7990
|
return d.y.label || d.y.value;
|
|
7968
7991
|
}).each(function (d, i) {
|
|
@@ -7987,11 +8010,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7987
8010
|
}
|
|
7988
8011
|
});
|
|
7989
8012
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
7990
|
-
return getLabelX.call(
|
|
8013
|
+
return getLabelX.call(_this45, d, series.labelPosition);
|
|
7991
8014
|
}).attr('y', function (d) {
|
|
7992
|
-
return getLabelY.call(
|
|
8015
|
+
return getLabelY.call(_this45, d, series.labelPosition);
|
|
7993
8016
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
7994
|
-
return
|
|
8017
|
+
return _this45.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7995
8018
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
7996
8019
|
return d.y.label || d.y.value;
|
|
7997
8020
|
}).each(function (d, i) {
|
|
@@ -8048,16 +8071,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8048
8071
|
}, {
|
|
8049
8072
|
key: "renderline",
|
|
8050
8073
|
value: function renderline(series, index) {
|
|
8051
|
-
var
|
|
8074
|
+
var _this46 = this;
|
|
8052
8075
|
|
|
8053
8076
|
/* global series index d3 */
|
|
8054
8077
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
8055
8078
|
return d3.line().x(function (d) {
|
|
8056
|
-
var adjustment =
|
|
8057
|
-
return
|
|
8079
|
+
var adjustment = _this46.options.data[xAxis].scale === 'Time' ? 0 : _this46["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
8080
|
+
return _this46["".concat(xAxis, "Axis")](_this46.parseX(d.x.value)) + adjustment;
|
|
8058
8081
|
}).y(function (d) {
|
|
8059
|
-
return
|
|
8060
|
-
}).curve(d3[curveStyle ||
|
|
8082
|
+
return _this46["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8083
|
+
}).curve(d3[curveStyle || _this46.options.curveStyle]);
|
|
8061
8084
|
};
|
|
8062
8085
|
|
|
8063
8086
|
var xAxis = 'bottom';
|
|
@@ -8101,14 +8124,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8101
8124
|
}, {
|
|
8102
8125
|
key: "rendersymbol",
|
|
8103
8126
|
value: function rendersymbol(series, index) {
|
|
8104
|
-
var
|
|
8127
|
+
var _this47 = this;
|
|
8105
8128
|
|
|
8106
8129
|
/* global d3 series index series.key */
|
|
8107
8130
|
var drawSymbol = function drawSymbol(size) {
|
|
8108
8131
|
return d3.symbol() // .type(d => {
|
|
8109
8132
|
// return d3.symbols[0]
|
|
8110
8133
|
// })
|
|
8111
|
-
.size(size ||
|
|
8134
|
+
.size(size || _this47.options.symbolSize);
|
|
8112
8135
|
};
|
|
8113
8136
|
|
|
8114
8137
|
var xAxis = 'bottomAxis';
|
|
@@ -8126,7 +8149,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8126
8149
|
symbols.attr('d', function (d) {
|
|
8127
8150
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
8128
8151
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
8129
|
-
return "translate(".concat(
|
|
8152
|
+
return "translate(".concat(_this47[xAxis](_this47.parseX(d.x.value)), ", ").concat(_this47[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8130
8153
|
}); // Enter
|
|
8131
8154
|
|
|
8132
8155
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -8135,7 +8158,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8135
8158
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
8136
8159
|
return "symbol symbol_".concat(series.key);
|
|
8137
8160
|
}).attr('transform', function (d) {
|
|
8138
|
-
return "translate(".concat(
|
|
8161
|
+
return "translate(".concat(_this47[xAxis](_this47.parseX(d.x.value)), ", ").concat(_this47[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8139
8162
|
});
|
|
8140
8163
|
}
|
|
8141
8164
|
}, {
|
|
@@ -8290,7 +8313,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8290
8313
|
}, {
|
|
8291
8314
|
key: "resize",
|
|
8292
8315
|
value: function resize() {
|
|
8293
|
-
var
|
|
8316
|
+
var _this48 = this;
|
|
8294
8317
|
|
|
8295
8318
|
var el = document.getElementById(this.elementId);
|
|
8296
8319
|
|
|
@@ -8303,7 +8326,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8303
8326
|
// }
|
|
8304
8327
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
8305
8328
|
html += this._data.map(function (d, i) {
|
|
8306
|
-
return
|
|
8329
|
+
return _this48.getLegendItemHTML(d);
|
|
8307
8330
|
}).join('');
|
|
8308
8331
|
html += "\n <div>\n ";
|
|
8309
8332
|
el.innerHTML = html;
|
|
@@ -8475,7 +8498,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8475
8498
|
}, {
|
|
8476
8499
|
key: "render",
|
|
8477
8500
|
value: function render() {
|
|
8478
|
-
var
|
|
8501
|
+
var _this49 = this;
|
|
8479
8502
|
|
|
8480
8503
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
8481
8504
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -8484,7 +8507,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8484
8507
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
8485
8508
|
return {
|
|
8486
8509
|
value: s.label || s.key,
|
|
8487
|
-
color: s.color ||
|
|
8510
|
+
color: s.color || _this49.options.colors[i % _this49.options.colors.length]
|
|
8488
8511
|
};
|
|
8489
8512
|
});
|
|
8490
8513
|
var longestValue = legendData.map(function (s) {
|
|
@@ -8548,7 +8571,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8548
8571
|
|
|
8549
8572
|
if (this.polygons) {
|
|
8550
8573
|
this.polygons.forEach(function (p) {
|
|
8551
|
-
return
|
|
8574
|
+
return _this49.map.removeLayer(p);
|
|
8552
8575
|
});
|
|
8553
8576
|
}
|
|
8554
8577
|
|
|
@@ -8606,18 +8629,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8606
8629
|
}
|
|
8607
8630
|
|
|
8608
8631
|
if (!p.options.color) {
|
|
8609
|
-
p.options.color =
|
|
8632
|
+
p.options.color = _this49.options.colors[i % _this49.options.colors.length];
|
|
8610
8633
|
}
|
|
8611
8634
|
|
|
8612
8635
|
var pol = L.polygon(p.data.map(function (c) {
|
|
8613
8636
|
return c.map(function (d) {
|
|
8614
8637
|
return [d.Latitude, d.Longitude];
|
|
8615
8638
|
});
|
|
8616
|
-
}), p.options).addTo(
|
|
8639
|
+
}), p.options).addTo(_this49.map);
|
|
8617
8640
|
|
|
8618
|
-
|
|
8641
|
+
_this49.polygons.push(pol);
|
|
8619
8642
|
|
|
8620
|
-
|
|
8643
|
+
_this49.map.fitBounds(pol.getBounds());
|
|
8621
8644
|
});
|
|
8622
8645
|
} // if (this.data.markers.length > 0) {
|
|
8623
8646
|
// el.classList.remove('hidden')
|