@websy/websy-designs 1.4.2 → 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.
- package/dist/websy-designs-es6.debug.js +57 -19
- package/dist/websy-designs-es6.js +110 -75
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +66 -21
- package/dist/websy-designs.js +120 -78
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -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')
|
|
@@ -4479,7 +4490,12 @@ class WebsySearch {
|
|
|
4479
4490
|
if (event.target.classList.contains('clear')) {
|
|
4480
4491
|
const inputEl = document.getElementById(`${this.elementId}_search`)
|
|
4481
4492
|
inputEl.value = ''
|
|
4482
|
-
this.options.onSearch
|
|
4493
|
+
// if (this.options.onSearch) {
|
|
4494
|
+
// this.options.onSearch('')
|
|
4495
|
+
// }
|
|
4496
|
+
if (this.options.onClear) {
|
|
4497
|
+
this.options.onClear()
|
|
4498
|
+
}
|
|
4483
4499
|
}
|
|
4484
4500
|
}
|
|
4485
4501
|
handleKeyDown (event) {
|
|
@@ -4511,7 +4527,9 @@ class WebsySearch {
|
|
|
4511
4527
|
}
|
|
4512
4528
|
else {
|
|
4513
4529
|
if (this.options.onSearch && (event.key === 'Delete' || event.key === 'Backspace')) {
|
|
4514
|
-
this.options.
|
|
4530
|
+
if (this.options.onClear) {
|
|
4531
|
+
this.options.onClear()
|
|
4532
|
+
}
|
|
4515
4533
|
}
|
|
4516
4534
|
}
|
|
4517
4535
|
}
|
|
@@ -6068,12 +6086,16 @@ class WebsyTable3 {
|
|
|
6068
6086
|
if (typeof sizingColumns[sizeIndex] === 'undefined') {
|
|
6069
6087
|
return // need to revisit this logic
|
|
6070
6088
|
}
|
|
6071
|
-
let style =
|
|
6072
|
-
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
|
+
}
|
|
6073
6095
|
if (cell.style) {
|
|
6074
6096
|
style += cell.style
|
|
6075
6097
|
}
|
|
6076
|
-
if (useWidths === true) {
|
|
6098
|
+
if (useWidths === true && (+cell.colspan === 1 || !cell.colspan)) {
|
|
6077
6099
|
style += `max-width: ${sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth}px!important;`
|
|
6078
6100
|
divStyle += `max-width: ${sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth}px!important;`
|
|
6079
6101
|
}
|
|
@@ -6118,6 +6140,25 @@ class WebsyTable3 {
|
|
|
6118
6140
|
class='websy-table-cell-collapse'
|
|
6119
6141
|
>${WebsyDesigns.Icons.MinusFilled}</i>`
|
|
6120
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
|
+
}
|
|
6121
6162
|
bodyHtml += `
|
|
6122
6163
|
${cell.value}
|
|
6123
6164
|
</div></td>`
|
|
@@ -6344,9 +6385,11 @@ class WebsyTable3 {
|
|
|
6344
6385
|
}
|
|
6345
6386
|
else if (data) {
|
|
6346
6387
|
let longest = ''
|
|
6347
|
-
for (let i = 0; i < Math.min(data.length, 1000); i++) {
|
|
6348
|
-
if (
|
|
6349
|
-
longest
|
|
6388
|
+
for (let i = 0; i < Math.min(data.length, 1000); i++) {
|
|
6389
|
+
if (data[i].length === this.options.columns[this.options.columns.length - 1].length) {
|
|
6390
|
+
if (longest.length < data[i][colIndex].value.length) {
|
|
6391
|
+
longest = data[i][colIndex].value
|
|
6392
|
+
}
|
|
6350
6393
|
}
|
|
6351
6394
|
}
|
|
6352
6395
|
output.push({value: longest})
|
|
@@ -6424,14 +6467,16 @@ class WebsyTable3 {
|
|
|
6424
6467
|
this.mouseXStart = null
|
|
6425
6468
|
}
|
|
6426
6469
|
handleScrollWheel (event) {
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
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
|
+
}
|
|
6435
6480
|
}
|
|
6436
6481
|
hideError () {
|
|
6437
6482
|
const el = document.getElementById(`${this.elementId}_tableContainer`)
|