@websy/websy-designs 1.3.3 → 1.3.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 +21 -6
- package/dist/websy-designs-es6.js +150 -133
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +21 -6
- package/dist/websy-designs.js +153 -136
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -3337,7 +3337,7 @@ class WebsyResultList {
|
|
|
3337
3337
|
const el = document.getElementById(this.elementId)
|
|
3338
3338
|
el.innerHTML += html.replace(/\n/g, '')
|
|
3339
3339
|
}
|
|
3340
|
-
buildHTML (d, startIndex = 0, inputTemplate) {
|
|
3340
|
+
buildHTML (d, startIndex = 0, inputTemplate, locator = []) {
|
|
3341
3341
|
let html = ``
|
|
3342
3342
|
if (this.options.template) {
|
|
3343
3343
|
if (d.length > 0) {
|
|
@@ -3439,13 +3439,13 @@ class WebsyResultList {
|
|
|
3439
3439
|
parts.forEach(p => {
|
|
3440
3440
|
items = items[p]
|
|
3441
3441
|
})
|
|
3442
|
-
template = template.replace(m[0], this.buildHTML(items, 0, withoutFor))
|
|
3442
|
+
template = template.replace(m[0], this.buildHTML(items, 0, withoutFor, [...locator, `${startIndex + ix}:${c}`]))
|
|
3443
3443
|
}
|
|
3444
3444
|
})
|
|
3445
3445
|
let tagMatches = [...template.matchAll(/(\sdata-event=["|']\w.+)["|']/g)]
|
|
3446
3446
|
tagMatches.forEach(m => {
|
|
3447
3447
|
if (m[0] && m.index > -1) {
|
|
3448
|
-
template = template.replace(m[0], `${m[0]} data-id=${startIndex + ix}`)
|
|
3448
|
+
template = template.replace(m[0], `${m[0]} data-id=${startIndex + ix} data-locator='${locator.join(';')}'`)
|
|
3449
3449
|
}
|
|
3450
3450
|
})
|
|
3451
3451
|
let flatRow = this.flattenObject(row)
|
|
@@ -3506,15 +3506,30 @@ class WebsyResultList {
|
|
|
3506
3506
|
l = l.split('(')
|
|
3507
3507
|
let params = []
|
|
3508
3508
|
const id = event.target.getAttribute('data-id')
|
|
3509
|
+
const locator = event.target.getAttribute('data-locator')
|
|
3509
3510
|
if (l[1]) {
|
|
3510
3511
|
l[1] = l[1].replace(')', '')
|
|
3511
3512
|
params = l[1].split(',')
|
|
3512
3513
|
}
|
|
3513
3514
|
l = l[0]
|
|
3515
|
+
let data = this.rows
|
|
3516
|
+
if (locator !== '') {
|
|
3517
|
+
let locatorItems = locator.split(';')
|
|
3518
|
+
locatorItems.forEach(loc => {
|
|
3519
|
+
let locatorParts = loc.split(':')
|
|
3520
|
+
if (data[locatorParts[0]]) {
|
|
3521
|
+
data = data[locatorParts[0]]
|
|
3522
|
+
let parts = locatorParts[1].split('.')
|
|
3523
|
+
parts.forEach(p => {
|
|
3524
|
+
data = data[p]
|
|
3525
|
+
})
|
|
3526
|
+
}
|
|
3527
|
+
})
|
|
3528
|
+
}
|
|
3514
3529
|
params = params.map(p => {
|
|
3515
3530
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
3516
|
-
if (
|
|
3517
|
-
p =
|
|
3531
|
+
if (data[+id]) {
|
|
3532
|
+
p = data[+id][p]
|
|
3518
3533
|
}
|
|
3519
3534
|
}
|
|
3520
3535
|
else if (typeof p === 'string') {
|
|
@@ -3524,7 +3539,7 @@ class WebsyResultList {
|
|
|
3524
3539
|
})
|
|
3525
3540
|
if (event.target.classList.contains('clickable') && this.options.listeners.click[l]) {
|
|
3526
3541
|
event.stopPropagation()
|
|
3527
|
-
this.options.listeners.click[l].call(this, event,
|
|
3542
|
+
this.options.listeners.click[l].call(this, event, data[+id], ...params)
|
|
3528
3543
|
}
|
|
3529
3544
|
}
|
|
3530
3545
|
}
|