@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
|
@@ -3089,7 +3089,7 @@ class WebsyResultList {
|
|
|
3089
3089
|
const el = document.getElementById(this.elementId)
|
|
3090
3090
|
el.innerHTML += html.replace(/\n/g, '')
|
|
3091
3091
|
}
|
|
3092
|
-
buildHTML (d, startIndex = 0, inputTemplate) {
|
|
3092
|
+
buildHTML (d, startIndex = 0, inputTemplate, locator = []) {
|
|
3093
3093
|
let html = ``
|
|
3094
3094
|
if (this.options.template) {
|
|
3095
3095
|
if (d.length > 0) {
|
|
@@ -3191,13 +3191,13 @@ class WebsyResultList {
|
|
|
3191
3191
|
parts.forEach(p => {
|
|
3192
3192
|
items = items[p]
|
|
3193
3193
|
})
|
|
3194
|
-
template = template.replace(m[0], this.buildHTML(items, 0, withoutFor))
|
|
3194
|
+
template = template.replace(m[0], this.buildHTML(items, 0, withoutFor, [...locator, `${startIndex + ix}:${c}`]))
|
|
3195
3195
|
}
|
|
3196
3196
|
})
|
|
3197
3197
|
let tagMatches = [...template.matchAll(/(\sdata-event=["|']\w.+)["|']/g)]
|
|
3198
3198
|
tagMatches.forEach(m => {
|
|
3199
3199
|
if (m[0] && m.index > -1) {
|
|
3200
|
-
template = template.replace(m[0], `${m[0]} data-id=${startIndex + ix}`)
|
|
3200
|
+
template = template.replace(m[0], `${m[0]} data-id=${startIndex + ix} data-locator='${locator.join(';')}'`)
|
|
3201
3201
|
}
|
|
3202
3202
|
})
|
|
3203
3203
|
let flatRow = this.flattenObject(row)
|
|
@@ -3258,15 +3258,30 @@ class WebsyResultList {
|
|
|
3258
3258
|
l = l.split('(')
|
|
3259
3259
|
let params = []
|
|
3260
3260
|
const id = event.target.getAttribute('data-id')
|
|
3261
|
+
const locator = event.target.getAttribute('data-locator')
|
|
3261
3262
|
if (l[1]) {
|
|
3262
3263
|
l[1] = l[1].replace(')', '')
|
|
3263
3264
|
params = l[1].split(',')
|
|
3264
3265
|
}
|
|
3265
3266
|
l = l[0]
|
|
3267
|
+
let data = this.rows
|
|
3268
|
+
if (locator !== '') {
|
|
3269
|
+
let locatorItems = locator.split(';')
|
|
3270
|
+
locatorItems.forEach(loc => {
|
|
3271
|
+
let locatorParts = loc.split(':')
|
|
3272
|
+
if (data[locatorParts[0]]) {
|
|
3273
|
+
data = data[locatorParts[0]]
|
|
3274
|
+
let parts = locatorParts[1].split('.')
|
|
3275
|
+
parts.forEach(p => {
|
|
3276
|
+
data = data[p]
|
|
3277
|
+
})
|
|
3278
|
+
}
|
|
3279
|
+
})
|
|
3280
|
+
}
|
|
3266
3281
|
params = params.map(p => {
|
|
3267
3282
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
3268
|
-
if (
|
|
3269
|
-
p =
|
|
3283
|
+
if (data[+id]) {
|
|
3284
|
+
p = data[+id][p]
|
|
3270
3285
|
}
|
|
3271
3286
|
}
|
|
3272
3287
|
else if (typeof p === 'string') {
|
|
@@ -3276,7 +3291,7 @@ class WebsyResultList {
|
|
|
3276
3291
|
})
|
|
3277
3292
|
if (event.target.classList.contains('clickable') && this.options.listeners.click[l]) {
|
|
3278
3293
|
event.stopPropagation()
|
|
3279
|
-
this.options.listeners.click[l].call(this, event,
|
|
3294
|
+
this.options.listeners.click[l].call(this, event, data[+id], ...params)
|
|
3280
3295
|
}
|
|
3281
3296
|
}
|
|
3282
3297
|
}
|