@websy/websy-designs 1.4.3 → 1.4.4
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.
|
@@ -162,7 +162,9 @@ class ButtonGroup {
|
|
|
162
162
|
const DEFAULTS = {
|
|
163
163
|
style: 'button',
|
|
164
164
|
subscribers: {},
|
|
165
|
-
activeItem:
|
|
165
|
+
activeItem: -1,
|
|
166
|
+
tag: 'div',
|
|
167
|
+
allowNone: false
|
|
166
168
|
}
|
|
167
169
|
this.options = Object.assign({}, DEFAULTS, options)
|
|
168
170
|
const el = document.getElementById(this.elementId)
|
|
@@ -175,7 +177,7 @@ class ButtonGroup {
|
|
|
175
177
|
if (event.target.classList.contains('websy-button-group-item')) {
|
|
176
178
|
const index = +event.target.getAttribute('data-index')
|
|
177
179
|
if (this.options.activeItem !== index) {
|
|
178
|
-
if (this.options.onDeactivate) {
|
|
180
|
+
if (this.options.onDeactivate && this.options.activeItem !== -1) {
|
|
179
181
|
this.options.onDeactivate(this.options.items[this.options.activeItem], this.options.activeItem)
|
|
180
182
|
}
|
|
181
183
|
this.options.activeItem = index
|
|
@@ -191,7 +193,14 @@ class ButtonGroup {
|
|
|
191
193
|
})
|
|
192
194
|
event.target.classList.remove('inactive')
|
|
193
195
|
event.target.classList.add('active')
|
|
194
|
-
}
|
|
196
|
+
}
|
|
197
|
+
else if (this.options.activeItem === index && this.options.allowNone === true) {
|
|
198
|
+
if (this.options.onDeactivate) {
|
|
199
|
+
this.options.onDeactivate(this.options.items[this.options.activeItem], this.options.activeItem)
|
|
200
|
+
}
|
|
201
|
+
this.options.activeItem = -1
|
|
202
|
+
event.target.classList.remove('active')
|
|
203
|
+
}
|
|
195
204
|
}
|
|
196
205
|
}
|
|
197
206
|
on (event, fn) {
|
|
@@ -214,7 +223,7 @@ class ButtonGroup {
|
|
|
214
223
|
activeClass = i === this.options.activeItem ? 'active' : 'inactive'
|
|
215
224
|
}
|
|
216
225
|
return `
|
|
217
|
-
|
|
226
|
+
<${this.options.tag} ${(t.attributes || []).join(' ')} data-id="${t.id || t.label}" data-index="${i}" class="websy-button-group-item ${(t.classes || []).join(' ')} ${this.options.style}-style ${activeClass}">${t.label}</${this.options.tag}>
|
|
218
227
|
`
|
|
219
228
|
}).join('')
|
|
220
229
|
}
|
|
@@ -1526,7 +1535,9 @@ class WebsyDropdown {
|
|
|
1526
1535
|
if (el) {
|
|
1527
1536
|
el.style.zIndex = ''
|
|
1528
1537
|
}
|
|
1529
|
-
scrollEl
|
|
1538
|
+
if (scrollEl) {
|
|
1539
|
+
scrollEl.scrollTo(0, 0)
|
|
1540
|
+
}
|
|
1530
1541
|
maskEl.classList.remove('active')
|
|
1531
1542
|
contentEl.classList.remove('active')
|
|
1532
1543
|
contentEl.classList.remove('on-top')
|
|
@@ -6075,12 +6086,16 @@ class WebsyTable3 {
|
|
|
6075
6086
|
if (typeof sizingColumns[sizeIndex] === 'undefined') {
|
|
6076
6087
|
return // need to revisit this logic
|
|
6077
6088
|
}
|
|
6078
|
-
let style =
|
|
6079
|
-
let divStyle =
|
|
6089
|
+
let style = ''
|
|
6090
|
+
let divStyle = ''
|
|
6091
|
+
if (useWidths === true && (+cell.colspan === 1 || !cell.colspan)) {
|
|
6092
|
+
style = `width: ${sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth}px!important; `
|
|
6093
|
+
divStyle = style
|
|
6094
|
+
}
|
|
6080
6095
|
if (cell.style) {
|
|
6081
6096
|
style += cell.style
|
|
6082
6097
|
}
|
|
6083
|
-
if (useWidths === true) {
|
|
6098
|
+
if (useWidths === true && (+cell.colspan === 1 || !cell.colspan)) {
|
|
6084
6099
|
style += `max-width: ${sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth}px!important;`
|
|
6085
6100
|
divStyle += `max-width: ${sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth}px!important;`
|
|
6086
6101
|
}
|
|
@@ -6125,6 +6140,25 @@ class WebsyTable3 {
|
|
|
6125
6140
|
class='websy-table-cell-collapse'
|
|
6126
6141
|
>${WebsyDesigns.Icons.MinusFilled}</i>`
|
|
6127
6142
|
}
|
|
6143
|
+
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
6144
|
+
cell.value = `
|
|
6145
|
+
<a href='${cell.value}' target='${sizingColumns[sizeIndex].openInNewTab === true ? '_blank' : '_self'}'>${cell.displayText || sizingColumns[sizeIndex].linkText || cell.value}</a>
|
|
6146
|
+
`
|
|
6147
|
+
}
|
|
6148
|
+
if (sizingColumns[sizeIndex].showAsRouterLink === true && cell.value.trim() !== '') {
|
|
6149
|
+
cell.value = `
|
|
6150
|
+
<a data-view='${(cell.link || cell.value).replace(/'/g, '\'')}' class='websy-trigger'>${cell.value}</a>
|
|
6151
|
+
`
|
|
6152
|
+
}
|
|
6153
|
+
if (sizingColumns[sizeIndex].showAsImage === true) {
|
|
6154
|
+
cell.value = `
|
|
6155
|
+
<img
|
|
6156
|
+
style="width: ${sizingColumns[sizeIndex].imgWidth ? sizingColumns[sizeIndex].imgWidth : 'auto'}; height: ${sizingColumns[sizeIndex].imgHeight ? sizingColumns[sizeIndex].imgHeight : 'auto'};"
|
|
6157
|
+
src='${cell.value}'
|
|
6158
|
+
${sizingColumns[sizeIndex].errorImage ? 'onerror="this.src=\'' + sizingColumns[sizeIndex].errorImage + '\'"' : ''}
|
|
6159
|
+
/>
|
|
6160
|
+
`
|
|
6161
|
+
}
|
|
6128
6162
|
bodyHtml += `
|
|
6129
6163
|
${cell.value}
|
|
6130
6164
|
</div></td>`
|
|
@@ -6433,14 +6467,16 @@ class WebsyTable3 {
|
|
|
6433
6467
|
this.mouseXStart = null
|
|
6434
6468
|
}
|
|
6435
6469
|
handleScrollWheel (event) {
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6470
|
+
if (this.options.virtualScroll === true) {
|
|
6471
|
+
event.preventDefault()
|
|
6472
|
+
// console.log('scrollwheel', event)
|
|
6473
|
+
if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) {
|
|
6474
|
+
this.scrollX(Math.max(-5, Math.min(5, event.deltaX)))
|
|
6475
|
+
}
|
|
6476
|
+
else {
|
|
6477
|
+
this.scrollY(Math.max(-5, Math.min(5, event.deltaY)))
|
|
6478
|
+
}
|
|
6479
|
+
}
|
|
6444
6480
|
}
|
|
6445
6481
|
hideError () {
|
|
6446
6482
|
const el = document.getElementById(`${this.elementId}_tableContainer`)
|
package/dist/websy-designs.js
CHANGED
|
@@ -232,7 +232,9 @@ var ButtonGroup = /*#__PURE__*/function () {
|
|
|
232
232
|
var DEFAULTS = {
|
|
233
233
|
style: 'button',
|
|
234
234
|
subscribers: {},
|
|
235
|
-
activeItem:
|
|
235
|
+
activeItem: -1,
|
|
236
|
+
tag: 'div',
|
|
237
|
+
allowNone: false
|
|
236
238
|
};
|
|
237
239
|
this.options = _extends({}, DEFAULTS, options);
|
|
238
240
|
var el = document.getElementById(this.elementId);
|
|
@@ -250,7 +252,7 @@ var ButtonGroup = /*#__PURE__*/function () {
|
|
|
250
252
|
var index = +event.target.getAttribute('data-index');
|
|
251
253
|
|
|
252
254
|
if (this.options.activeItem !== index) {
|
|
253
|
-
if (this.options.onDeactivate) {
|
|
255
|
+
if (this.options.onDeactivate && this.options.activeItem !== -1) {
|
|
254
256
|
this.options.onDeactivate(this.options.items[this.options.activeItem], this.options.activeItem);
|
|
255
257
|
}
|
|
256
258
|
|
|
@@ -269,6 +271,13 @@ var ButtonGroup = /*#__PURE__*/function () {
|
|
|
269
271
|
});
|
|
270
272
|
event.target.classList.remove('inactive');
|
|
271
273
|
event.target.classList.add('active');
|
|
274
|
+
} else if (this.options.activeItem === index && this.options.allowNone === true) {
|
|
275
|
+
if (this.options.onDeactivate) {
|
|
276
|
+
this.options.onDeactivate(this.options.items[this.options.activeItem], this.options.activeItem);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
this.options.activeItem = -1;
|
|
280
|
+
event.target.classList.remove('active');
|
|
272
281
|
}
|
|
273
282
|
}
|
|
274
283
|
}
|
|
@@ -303,7 +312,7 @@ var ButtonGroup = /*#__PURE__*/function () {
|
|
|
303
312
|
activeClass = i === _this.options.activeItem ? 'active' : 'inactive';
|
|
304
313
|
}
|
|
305
314
|
|
|
306
|
-
return "\n <
|
|
315
|
+
return "\n <".concat(_this.options.tag, " ").concat((t.attributes || []).join(' '), " data-id=\"").concat(t.id || t.label, "\" data-index=\"").concat(i, "\" class=\"websy-button-group-item ").concat((t.classes || []).join(' '), " ").concat(_this.options.style, "-style ").concat(activeClass, "\">").concat(t.label, "</").concat(_this.options.tag, ">\n ");
|
|
307
316
|
}).join('');
|
|
308
317
|
}
|
|
309
318
|
}
|
|
@@ -1653,7 +1662,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1653
1662
|
el.style.zIndex = '';
|
|
1654
1663
|
}
|
|
1655
1664
|
|
|
1656
|
-
scrollEl
|
|
1665
|
+
if (scrollEl) {
|
|
1666
|
+
scrollEl.scrollTo(0, 0);
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1657
1669
|
maskEl.classList.remove('active');
|
|
1658
1670
|
contentEl.classList.remove('active');
|
|
1659
1671
|
contentEl.classList.remove('on-top');
|
|
@@ -6633,14 +6645,19 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6633
6645
|
return; // need to revisit this logic
|
|
6634
6646
|
}
|
|
6635
6647
|
|
|
6636
|
-
var style =
|
|
6637
|
-
var divStyle =
|
|
6648
|
+
var style = '';
|
|
6649
|
+
var divStyle = '';
|
|
6650
|
+
|
|
6651
|
+
if (useWidths === true && (+cell.colspan === 1 || !cell.colspan)) {
|
|
6652
|
+
style = "width: ".concat(sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth, "px!important; ");
|
|
6653
|
+
divStyle = style;
|
|
6654
|
+
}
|
|
6638
6655
|
|
|
6639
6656
|
if (cell.style) {
|
|
6640
6657
|
style += cell.style;
|
|
6641
6658
|
}
|
|
6642
6659
|
|
|
6643
|
-
if (useWidths === true) {
|
|
6660
|
+
if (useWidths === true && (+cell.colspan === 1 || !cell.colspan)) {
|
|
6644
6661
|
style += "max-width: ".concat(sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth, "px!important;");
|
|
6645
6662
|
divStyle += "max-width: ".concat(sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth, "px!important;");
|
|
6646
6663
|
}
|
|
@@ -6675,6 +6692,18 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6675
6692
|
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(WebsyDesigns.Icons.MinusFilled, "</i>");
|
|
6676
6693
|
}
|
|
6677
6694
|
|
|
6695
|
+
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
6696
|
+
cell.value = "\n <a href='".concat(cell.value, "' target='").concat(sizingColumns[sizeIndex].openInNewTab === true ? '_blank' : '_self', "'>").concat(cell.displayText || sizingColumns[sizeIndex].linkText || cell.value, "</a>\n ");
|
|
6697
|
+
}
|
|
6698
|
+
|
|
6699
|
+
if (sizingColumns[sizeIndex].showAsRouterLink === true && cell.value.trim() !== '') {
|
|
6700
|
+
cell.value = "\n <a data-view='".concat((cell.link || cell.value).replace(/'/g, '\''), "' class='websy-trigger'>").concat(cell.value, "</a>\n ");
|
|
6701
|
+
}
|
|
6702
|
+
|
|
6703
|
+
if (sizingColumns[sizeIndex].showAsImage === true) {
|
|
6704
|
+
cell.value = "\n <img \n style=\"width: ".concat(sizingColumns[sizeIndex].imgWidth ? sizingColumns[sizeIndex].imgWidth : 'auto', "; height: ").concat(sizingColumns[sizeIndex].imgHeight ? sizingColumns[sizeIndex].imgHeight : 'auto', ";\" \n src='").concat(cell.value, "'\n ").concat(sizingColumns[sizeIndex].errorImage ? 'onerror="this.src=\'' + sizingColumns[sizeIndex].errorImage + '\'"' : '', "\n />\n ");
|
|
6705
|
+
}
|
|
6706
|
+
|
|
6678
6707
|
bodyHtml += "\n ".concat(cell.value, "\n </div></td>");
|
|
6679
6708
|
});
|
|
6680
6709
|
bodyHtml += "</tr>";
|
|
@@ -7032,12 +7061,14 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7032
7061
|
}, {
|
|
7033
7062
|
key: "handleScrollWheel",
|
|
7034
7063
|
value: function handleScrollWheel(event) {
|
|
7035
|
-
|
|
7064
|
+
if (this.options.virtualScroll === true) {
|
|
7065
|
+
event.preventDefault(); // console.log('scrollwheel', event)
|
|
7036
7066
|
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7067
|
+
if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) {
|
|
7068
|
+
this.scrollX(Math.max(-5, Math.min(5, event.deltaX)));
|
|
7069
|
+
} else {
|
|
7070
|
+
this.scrollY(Math.max(-5, Math.min(5, event.deltaY)));
|
|
7071
|
+
}
|
|
7041
7072
|
}
|
|
7042
7073
|
}
|
|
7043
7074
|
}, {
|