@websy/websy-designs 1.9.14 → 1.10.1
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/authHelper.js +11 -11
- package/dist/server/helpers/v1/pgHelper.js +78 -7
- package/dist/server/routes/v1/api.js +26 -10
- package/dist/websy-designs-es6.debug.js +270 -110
- package/dist/websy-designs-es6.js +562 -368
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +280 -115
- package/dist/websy-designs.js +568 -373
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -60,6 +60,10 @@ class APIService {
|
|
|
60
60
|
const url = this.buildUrl(entity, id)
|
|
61
61
|
return this.run('DELETE', url)
|
|
62
62
|
}
|
|
63
|
+
deleteMany (entity, query) {
|
|
64
|
+
const url = this.buildUrl(entity, null, query)
|
|
65
|
+
return this.run('DELETE', url)
|
|
66
|
+
}
|
|
63
67
|
get (entity, id, query, offset, limit) {
|
|
64
68
|
let url = this.buildUrl(entity, id, query)
|
|
65
69
|
if (offset) {
|
|
@@ -70,12 +74,12 @@ class APIService {
|
|
|
70
74
|
url += `?offset=${offset}`
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
|
-
if (limit) {
|
|
77
|
+
if (limit || this.options.rowLimit) {
|
|
74
78
|
if (url.indexOf('?') !== -1) {
|
|
75
|
-
url += `&limit=${limit}`
|
|
79
|
+
url += `&limit=${limit || this.options.rowLimit}`
|
|
76
80
|
}
|
|
77
81
|
else {
|
|
78
|
-
url += `?limit=${limit}`
|
|
82
|
+
url += `?limit=${limit || this.options.rowLimit}`
|
|
79
83
|
}
|
|
80
84
|
}
|
|
81
85
|
return this.run('GET', url)
|
|
@@ -193,16 +197,51 @@ class ButtonGroup {
|
|
|
193
197
|
this.render()
|
|
194
198
|
}
|
|
195
199
|
}
|
|
200
|
+
get value () {
|
|
201
|
+
if (this.options.activeItem > -1) {
|
|
202
|
+
return [this.options.items[this.options.activeItem]]
|
|
203
|
+
}
|
|
204
|
+
else if (this.options.multiSelect === true) {
|
|
205
|
+
return this.options.items.filter(d => d.selected)
|
|
206
|
+
}
|
|
207
|
+
return []
|
|
208
|
+
}
|
|
209
|
+
set value (value) {
|
|
210
|
+
let activeIndex = -1
|
|
211
|
+
if (this.options.multiSelect === true) {
|
|
212
|
+
if (Array.isArray(value)) {
|
|
213
|
+
this.options.items.forEach(d => {
|
|
214
|
+
if (value.indexOf(d.value) !== -1) {
|
|
215
|
+
d.selected = true
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
d.selected = false
|
|
219
|
+
}
|
|
220
|
+
})
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
for (let i = 0; i < this.options.items.length; i++) {
|
|
225
|
+
if ((this.options.items[i].value || this.options.items[i].label) === value) {
|
|
226
|
+
activeIndex = i
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
this.options.activeItem = activeIndex
|
|
230
|
+
}
|
|
231
|
+
this.render()
|
|
232
|
+
}
|
|
196
233
|
handleClick (event) {
|
|
197
234
|
if (event.target.classList.contains('websy-button-group-item')) {
|
|
198
235
|
const index = +event.target.getAttribute('data-index')
|
|
199
236
|
if (this.options.multiSelect === true) {
|
|
200
237
|
if (event.target.classList.contains('active')) {
|
|
238
|
+
this.options.items[index].selected = false
|
|
201
239
|
this.options.onDeactivate(this.options.items[index], index, event)
|
|
202
240
|
event.target.classList.remove('active')
|
|
203
241
|
event.target.classList.add('inactive')
|
|
204
242
|
}
|
|
205
243
|
else {
|
|
244
|
+
this.options.items[index].selected = true
|
|
206
245
|
this.options.onActivate(this.options.items[index], index, event)
|
|
207
246
|
event.target.classList.add('active')
|
|
208
247
|
event.target.classList.remove('inactive')
|
|
@@ -253,7 +292,10 @@ class ButtonGroup {
|
|
|
253
292
|
let activeClass = ''
|
|
254
293
|
if (this.options.activeItem !== -1) {
|
|
255
294
|
activeClass = i === this.options.activeItem ? 'active' : 'inactive'
|
|
256
|
-
}
|
|
295
|
+
}
|
|
296
|
+
else if (this.options.multiSelect === true) {
|
|
297
|
+
activeClass = t.selected === true ? 'active' : 'inactive'
|
|
298
|
+
}
|
|
257
299
|
return `
|
|
258
300
|
<${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}>
|
|
259
301
|
`
|
|
@@ -272,7 +314,12 @@ class WebsyCarousel {
|
|
|
272
314
|
showFrameSelector: true,
|
|
273
315
|
showPrevNext: true,
|
|
274
316
|
autoPlay: true,
|
|
275
|
-
frames: []
|
|
317
|
+
frames: [],
|
|
318
|
+
frameSelectorIcon: `
|
|
319
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 512 512">
|
|
320
|
+
<circle cx="256" cy="256" r="192" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32"/>
|
|
321
|
+
</svg>
|
|
322
|
+
`
|
|
276
323
|
}
|
|
277
324
|
this.playTimeoutFn = null
|
|
278
325
|
this.options = Object.assign({}, DEFAULTS, options)
|
|
@@ -383,10 +430,10 @@ class WebsyCarousel {
|
|
|
383
430
|
html += `<div class="websy-btn-parent">`
|
|
384
431
|
this.options.frames.forEach((frame, frameIndex) => {
|
|
385
432
|
html += `
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
433
|
+
<div data-index="${frameIndex}" id="${this.elementId}_selector_${frameIndex}"
|
|
434
|
+
class="websy-progress-btn ${this.options.currentFrame === frameIndex ? 'websy-progress-btn-active' : ''}">
|
|
435
|
+
${this.options.frameSelectorIcon}
|
|
436
|
+
</div>
|
|
390
437
|
`
|
|
391
438
|
})
|
|
392
439
|
html += `</div>`
|
|
@@ -1779,6 +1826,7 @@ class WebsyDropdown {
|
|
|
1779
1826
|
const contentPos = WebsyUtils.getElementPos(contentEl)
|
|
1780
1827
|
if (this.options.style === 'plain' && headerPos.width > 0 && headerPos.height > 0) {
|
|
1781
1828
|
contentEl.style.right = `calc(100vw - ${headerPos.right}px)`
|
|
1829
|
+
contentEl.style.width = `${headerEl.clientWidth}px`
|
|
1782
1830
|
if (headerPos.bottom + contentPos.height > window.innerHeight) {
|
|
1783
1831
|
// contentEl.classList.add('on-top')
|
|
1784
1832
|
contentEl.style.bottom = `calc(100vh - ${headerPos.top}px)`
|
|
@@ -1790,6 +1838,7 @@ class WebsyDropdown {
|
|
|
1790
1838
|
else if (this.options.style === 'plain' && headerPos.width === 0 && headerPos.height === 0) {
|
|
1791
1839
|
const targetPos = WebsyUtils.getElementPos(event.target)
|
|
1792
1840
|
contentEl.style.right = `calc(100vw - ${targetPos.right}px)`
|
|
1841
|
+
contentEl.style.width = `${targetPos.width}px`
|
|
1793
1842
|
}
|
|
1794
1843
|
if (this.options.disableSearch !== true) {
|
|
1795
1844
|
const searchEl = document.getElementById(`${this.elementId}_search`)
|
|
@@ -1801,6 +1850,19 @@ class WebsyDropdown {
|
|
|
1801
1850
|
this.options.onOpen(this.elementId)
|
|
1802
1851
|
}
|
|
1803
1852
|
}
|
|
1853
|
+
set items (items) {
|
|
1854
|
+
this.options.items = [...items]
|
|
1855
|
+
if (this.options.items.length > 0) {
|
|
1856
|
+
this.options.items = this.options.items.map((d, i) => {
|
|
1857
|
+
if (typeof d.index === 'undefined') {
|
|
1858
|
+
d.index = i
|
|
1859
|
+
}
|
|
1860
|
+
return d
|
|
1861
|
+
})
|
|
1862
|
+
}
|
|
1863
|
+
this._originalData = [...this.options.items]
|
|
1864
|
+
this.render()
|
|
1865
|
+
}
|
|
1804
1866
|
render () {
|
|
1805
1867
|
if (!this.elementId) {
|
|
1806
1868
|
console.log('No element Id provided for Websy Dropdown')
|
|
@@ -2277,9 +2339,7 @@ class WebsyForm {
|
|
|
2277
2339
|
}
|
|
2278
2340
|
GlobalPubSub.subscribe('recaptchaready', this.recaptchaReady.bind(this))
|
|
2279
2341
|
this.recaptchaResult = null
|
|
2280
|
-
this.options = Object.assign(
|
|
2281
|
-
// defaults go here
|
|
2282
|
-
}, options)
|
|
2342
|
+
this.options = Object.assign({}, defaults, options)
|
|
2283
2343
|
if (!elementId) {
|
|
2284
2344
|
console.log('No element Id provided')
|
|
2285
2345
|
return
|
|
@@ -2347,8 +2407,27 @@ class WebsyForm {
|
|
|
2347
2407
|
const data = {}
|
|
2348
2408
|
const temp = new FormData(formEl)
|
|
2349
2409
|
temp.forEach((value, key) => {
|
|
2350
|
-
|
|
2410
|
+
if (this.fieldMap[key] && this.fieldMap[key].type === 'checkbox') {
|
|
2411
|
+
data[key] = true
|
|
2412
|
+
}
|
|
2413
|
+
if (this.fieldMap[key] && this.fieldMap[key].instance && this.fieldMap[key].instance.value) {
|
|
2414
|
+
data[key] = this.fieldMap[key].instance.value
|
|
2415
|
+
}
|
|
2416
|
+
else {
|
|
2417
|
+
data[key] = value
|
|
2418
|
+
}
|
|
2351
2419
|
})
|
|
2420
|
+
let keys = Object.keys(data)
|
|
2421
|
+
for (const key in this.fieldMap) {
|
|
2422
|
+
if (keys.indexOf(key) === -1) {
|
|
2423
|
+
if (this.fieldMap[key] && this.fieldMap[key].type === 'checkbox') {
|
|
2424
|
+
data[key] = false
|
|
2425
|
+
}
|
|
2426
|
+
else if (this.fieldMap[key] && this.fieldMap[key].instance && this.fieldMap[key].instance.value) {
|
|
2427
|
+
data[key] = this.fieldMap[key].instance.value
|
|
2428
|
+
}
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2352
2431
|
return data
|
|
2353
2432
|
}
|
|
2354
2433
|
set data (d) {
|
|
@@ -2406,6 +2485,7 @@ class WebsyForm {
|
|
|
2406
2485
|
handleClick (event) {
|
|
2407
2486
|
if (event.target.classList.contains('submit')) {
|
|
2408
2487
|
event.preventDefault()
|
|
2488
|
+
event.stopPropagation()
|
|
2409
2489
|
this.submitForm()
|
|
2410
2490
|
}
|
|
2411
2491
|
else if (event.target.classList.contains('cancel')) {
|
|
@@ -2578,6 +2658,7 @@ class WebsyForm {
|
|
|
2578
2658
|
`
|
|
2579
2659
|
this.options.fields.forEach((f, i) => {
|
|
2580
2660
|
this.fieldMap[f.field] = f
|
|
2661
|
+
f.owningElement = this.elementId
|
|
2581
2662
|
if (f.component) {
|
|
2582
2663
|
componentsToProcess.push(f)
|
|
2583
2664
|
html += `
|
|
@@ -2664,6 +2745,10 @@ class WebsyForm {
|
|
|
2664
2745
|
const el = document.getElementById(`${this.elementId}_input_${field}`)
|
|
2665
2746
|
if (el) {
|
|
2666
2747
|
el.value = value
|
|
2748
|
+
el.setAttribute('value', value)
|
|
2749
|
+
if (this.fieldMap[field].type === 'checkbox') {
|
|
2750
|
+
el.checked = value
|
|
2751
|
+
}
|
|
2667
2752
|
}
|
|
2668
2753
|
else {
|
|
2669
2754
|
console.error(`Input for ${field} does not exist in form.`)
|
|
@@ -2821,6 +2906,10 @@ class MultiForm {
|
|
|
2821
2906
|
}
|
|
2822
2907
|
this.render()
|
|
2823
2908
|
}
|
|
2909
|
+
addData (data) {
|
|
2910
|
+
this.formData = this.formData.concat(data)
|
|
2911
|
+
this.render()
|
|
2912
|
+
}
|
|
2824
2913
|
addEntry () {
|
|
2825
2914
|
const el = document.getElementById(`${this.elementId}_container`)
|
|
2826
2915
|
let newId = WebsyDesigns.Utils.createIdentity()
|
|
@@ -2838,7 +2927,7 @@ class MultiForm {
|
|
|
2838
2927
|
</button>
|
|
2839
2928
|
`
|
|
2840
2929
|
el.appendChild(newFormEl)
|
|
2841
|
-
let formOptions = Object.assign({}, this.options)
|
|
2930
|
+
let formOptions = Object.assign({}, this.options, { fields: [...this.options.fields.map(f => Object.assign({}, f))] })
|
|
2842
2931
|
this.forms.push(new WebsyDesigns.Form(`${this.elementId}_${newId}_form`, formOptions))
|
|
2843
2932
|
}
|
|
2844
2933
|
clear () {
|
|
@@ -2852,14 +2941,20 @@ class MultiForm {
|
|
|
2852
2941
|
}
|
|
2853
2942
|
get data () {
|
|
2854
2943
|
const d = this.forms.map(f => (f.data))
|
|
2855
|
-
|
|
2856
|
-
|
|
2944
|
+
console.log('forms data', d)
|
|
2945
|
+
if (this.options.allowAdd !== false) {
|
|
2946
|
+
// we don't return the last form
|
|
2947
|
+
d.pop()
|
|
2948
|
+
}
|
|
2857
2949
|
return d
|
|
2858
2950
|
}
|
|
2859
2951
|
set data (d) {
|
|
2860
2952
|
this.formData = d
|
|
2861
2953
|
this.render()
|
|
2862
2954
|
}
|
|
2955
|
+
get deleted () {
|
|
2956
|
+
return this.formData.filter(d => this.recordsToDelete.includes(`${d.id}`))
|
|
2957
|
+
}
|
|
2863
2958
|
handleClick (event) {
|
|
2864
2959
|
if (event.target.classList.contains('websy-multi-form-add')) {
|
|
2865
2960
|
let id = event.target.getAttribute('data-formid')
|
|
@@ -2939,15 +3034,17 @@ class MultiForm {
|
|
|
2939
3034
|
`
|
|
2940
3035
|
}
|
|
2941
3036
|
el.innerHTML = html
|
|
2942
|
-
this.formData.
|
|
2943
|
-
|
|
3037
|
+
this.forms = new Array(this.formData.length)
|
|
3038
|
+
this.formData.forEach((d, i) => {
|
|
3039
|
+
let formOptions = Object.assign({}, this.options, { fields: [...this.options.fields.map(f => Object.assign({}, f))] })
|
|
2944
3040
|
let formObject = new WebsyDesigns.Form(`${this.elementId}_${d.formId}_form`, formOptions)
|
|
2945
3041
|
formObject.data = d
|
|
2946
|
-
this.forms
|
|
3042
|
+
this.forms[i] = formObject
|
|
2947
3043
|
})
|
|
2948
3044
|
if (this.options.allowAdd === true) {
|
|
2949
|
-
let formOptions = Object.assign({}, this.options)
|
|
2950
|
-
|
|
3045
|
+
let formOptions = Object.assign({}, this.options, { fields: [...this.options.fields.map(f => Object.assign({}, f))] })
|
|
3046
|
+
let formObject = new WebsyDesigns.Form(`${this.elementId}_${id}_form`, formOptions)
|
|
3047
|
+
this.forms.push(formObject)
|
|
2951
3048
|
}
|
|
2952
3049
|
}
|
|
2953
3050
|
}
|
|
@@ -3679,7 +3776,9 @@ class WebsyPDFButton {
|
|
|
3679
3776
|
classes: [],
|
|
3680
3777
|
wait: 0,
|
|
3681
3778
|
buttonText: 'Download',
|
|
3682
|
-
directDownload: false
|
|
3779
|
+
directDownload: false,
|
|
3780
|
+
preProcess: (callbackFn) => (callbackFn(true)),
|
|
3781
|
+
onError: () => {}
|
|
3683
3782
|
}
|
|
3684
3783
|
this.elementId = elementId
|
|
3685
3784
|
this.options = Object.assign({}, DEFAULTS, options)
|
|
@@ -3737,87 +3836,95 @@ class WebsyPDFButton {
|
|
|
3737
3836
|
handleClick (event) {
|
|
3738
3837
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
3739
3838
|
this.loader.show()
|
|
3740
|
-
|
|
3741
|
-
if (
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
if (this.options.header.elementId) {
|
|
3750
|
-
const headerEl = document.getElementById(this.options.header.elementId)
|
|
3751
|
-
if (headerEl) {
|
|
3752
|
-
pdfData.header = headerEl.outerHTML
|
|
3753
|
-
if (this.options.header.css) {
|
|
3754
|
-
pdfData.options.headerCSS = this.options.header.css
|
|
3755
|
-
}
|
|
3839
|
+
this.options.preProcess((proceed) => {
|
|
3840
|
+
if (proceed === true) {
|
|
3841
|
+
setTimeout(() => {
|
|
3842
|
+
if (this.options.targetId) {
|
|
3843
|
+
const el = document.getElementById(this.options.targetId)
|
|
3844
|
+
if (el) {
|
|
3845
|
+
const pdfData = { options: {} }
|
|
3846
|
+
if (this.options.pdfOptions) {
|
|
3847
|
+
pdfData.options = Object.assign({}, this.options.pdfOptions)
|
|
3756
3848
|
}
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
pdfData.
|
|
3849
|
+
if (this.options.header) {
|
|
3850
|
+
if (this.options.header.elementId) {
|
|
3851
|
+
const headerEl = document.getElementById(this.options.header.elementId)
|
|
3852
|
+
if (headerEl) {
|
|
3853
|
+
pdfData.header = headerEl.outerHTML
|
|
3854
|
+
if (this.options.header.css) {
|
|
3855
|
+
pdfData.options.headerCSS = this.options.header.css
|
|
3856
|
+
}
|
|
3857
|
+
}
|
|
3858
|
+
}
|
|
3859
|
+
else if (this.options.header.html) {
|
|
3860
|
+
pdfData.header = this.options.header.html
|
|
3861
|
+
if (this.options.header.css) {
|
|
3862
|
+
pdfData.options.headerCSS = this.options.header.css
|
|
3863
|
+
}
|
|
3864
|
+
}
|
|
3865
|
+
else {
|
|
3866
|
+
pdfData.header = this.options.header
|
|
3775
3867
|
}
|
|
3776
3868
|
}
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
let msg = `
|
|
3791
|
-
<div class='text-center websy-pdf-download'>
|
|
3792
|
-
<div>Your file is ready to download</div>
|
|
3793
|
-
<a href='${URL.createObjectURL(blob)}' target='_blank'
|
|
3794
|
-
`
|
|
3795
|
-
if (this.options.directDownload === true) {
|
|
3796
|
-
let fileName
|
|
3797
|
-
if (typeof this.options.fileName === 'function') {
|
|
3798
|
-
fileName = this.options.fileName() || 'Export'
|
|
3869
|
+
if (this.options.footer) {
|
|
3870
|
+
if (this.options.footer.elementId) {
|
|
3871
|
+
const footerEl = document.getElementById(this.options.footer.elementId)
|
|
3872
|
+
if (footerEl) {
|
|
3873
|
+
pdfData.footer = footerEl.outerHTML
|
|
3874
|
+
if (this.options.footer.css) {
|
|
3875
|
+
pdfData.options.footerCSS = this.options.footer.css
|
|
3876
|
+
}
|
|
3877
|
+
}
|
|
3878
|
+
}
|
|
3879
|
+
else {
|
|
3880
|
+
pdfData.footer = this.options.footer
|
|
3881
|
+
}
|
|
3799
3882
|
}
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
}
|
|
3803
|
-
|
|
3883
|
+
pdfData.html = el.outerHTML
|
|
3884
|
+
// document.getElementById(`${this.elementId}_pdfHeader`).value = pdfData.header
|
|
3885
|
+
// document.getElementById(`${this.elementId}_pdfHTML`).value = pdfData.html
|
|
3886
|
+
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
3887
|
+
// document.getElementById(`${this.elementId}_form`).submit()
|
|
3888
|
+
this.service.add('', pdfData, {responseType: 'blob'}).then(response => {
|
|
3889
|
+
this.loader.hide()
|
|
3890
|
+
const blob = new Blob([response], {type: 'application/pdf'})
|
|
3891
|
+
let msg = `
|
|
3892
|
+
<div class='text-center websy-pdf-download'>
|
|
3893
|
+
<div>Your file is ready to download</div>
|
|
3894
|
+
<a href='${URL.createObjectURL(blob)}' target='_blank'
|
|
3895
|
+
`
|
|
3896
|
+
if (this.options.directDownload === true) {
|
|
3897
|
+
let fileName
|
|
3898
|
+
if (typeof this.options.fileName === 'function') {
|
|
3899
|
+
fileName = this.options.fileName() || 'Export'
|
|
3900
|
+
}
|
|
3901
|
+
else {
|
|
3902
|
+
fileName = this.options.fileName || 'Export'
|
|
3903
|
+
}
|
|
3904
|
+
msg += `download='${fileName}.pdf'`
|
|
3905
|
+
}
|
|
3906
|
+
msg += `
|
|
3907
|
+
>
|
|
3908
|
+
<button class='websy-btn download-pdf'>${this.options.buttonText}</button>
|
|
3909
|
+
</a>
|
|
3910
|
+
</div>
|
|
3911
|
+
`
|
|
3912
|
+
this.popup.show({
|
|
3913
|
+
message: msg,
|
|
3914
|
+
mask: true
|
|
3915
|
+
})
|
|
3916
|
+
}, err => {
|
|
3917
|
+
console.error(err)
|
|
3918
|
+
})
|
|
3804
3919
|
}
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
mask: true
|
|
3814
|
-
})
|
|
3815
|
-
}, err => {
|
|
3816
|
-
console.error(err)
|
|
3817
|
-
})
|
|
3818
|
-
}
|
|
3819
|
-
}
|
|
3820
|
-
}, this.options.wait)
|
|
3920
|
+
}
|
|
3921
|
+
}, this.options.wait)
|
|
3922
|
+
}
|
|
3923
|
+
else {
|
|
3924
|
+
this.loader.hide()
|
|
3925
|
+
this.options.onError()
|
|
3926
|
+
}
|
|
3927
|
+
})
|
|
3821
3928
|
}
|
|
3822
3929
|
else if (event.target.classList.contains('download-pdf')) {
|
|
3823
3930
|
this.popup.hide()
|
|
@@ -3957,6 +4064,9 @@ class WebsyPubSub {
|
|
|
3957
4064
|
}
|
|
3958
4065
|
}
|
|
3959
4066
|
subscribe (id, method, fn) {
|
|
4067
|
+
if (!this.subscriptions) {
|
|
4068
|
+
this.subscriptions = {}
|
|
4069
|
+
}
|
|
3960
4070
|
if (arguments.length === 3) {
|
|
3961
4071
|
if (!this.subscriptions[id]) {
|
|
3962
4072
|
this.subscriptions[id] = {}
|
|
@@ -5513,7 +5623,52 @@ class WebsyTemplate {
|
|
|
5513
5623
|
return html
|
|
5514
5624
|
}
|
|
5515
5625
|
handleClick (event) {
|
|
5516
|
-
|
|
5626
|
+
if (event.target.classList.contains('clickable')) {
|
|
5627
|
+
this.handleEvent(event, 'clickable', 'click')
|
|
5628
|
+
}
|
|
5629
|
+
}
|
|
5630
|
+
handleEvent (event, eventType, action) {
|
|
5631
|
+
let l = event.target.getAttribute('data-event')
|
|
5632
|
+
if (l) {
|
|
5633
|
+
l = l.split('(')
|
|
5634
|
+
let params = []
|
|
5635
|
+
const id = event.target.getAttribute('data-id')
|
|
5636
|
+
// const locator = event.target.getAttribute('data-locator')
|
|
5637
|
+
// if (l[1]) {
|
|
5638
|
+
// l[1] = l[1].replace(')', '')
|
|
5639
|
+
// params = l[1].split(',')
|
|
5640
|
+
// }
|
|
5641
|
+
// l = l[0]
|
|
5642
|
+
let data = this.options.data
|
|
5643
|
+
// if (locator !== '') {
|
|
5644
|
+
// let locatorItems = locator.split(';')
|
|
5645
|
+
// locatorItems.forEach(loc => {
|
|
5646
|
+
// let locatorParts = loc.split(':')
|
|
5647
|
+
// if (data[locatorParts[0]]) {
|
|
5648
|
+
// data = data[locatorParts[0]]
|
|
5649
|
+
// let parts = locatorParts[1].split('.')
|
|
5650
|
+
// parts.forEach(p => {
|
|
5651
|
+
// data = data[p]
|
|
5652
|
+
// })
|
|
5653
|
+
// }
|
|
5654
|
+
// })
|
|
5655
|
+
// }
|
|
5656
|
+
// params = params.map(p => {
|
|
5657
|
+
// if (typeof p !== 'string' && typeof p !== 'number') {
|
|
5658
|
+
// if (data[+id]) {
|
|
5659
|
+
// p = data[+id][p]
|
|
5660
|
+
// }
|
|
5661
|
+
// }
|
|
5662
|
+
// else if (typeof p === 'string') {
|
|
5663
|
+
// p = p.replace(/"/g, '').replace(/'/g, '')
|
|
5664
|
+
// }
|
|
5665
|
+
// return p
|
|
5666
|
+
// })
|
|
5667
|
+
if (event.target.classList.contains(eventType) && this.options.listeners[action] && this.options.listeners[action][l]) {
|
|
5668
|
+
event.stopPropagation()
|
|
5669
|
+
this.options.listeners[action][l].call(this, event, data[+id], ...params)
|
|
5670
|
+
}
|
|
5671
|
+
}
|
|
5517
5672
|
}
|
|
5518
5673
|
render () {
|
|
5519
5674
|
this.resize()
|
|
@@ -6723,6 +6878,7 @@ class WebsyTable3 {
|
|
|
6723
6878
|
autoFitColumns: true
|
|
6724
6879
|
}
|
|
6725
6880
|
this.options = Object.assign({}, DEFAULTS, options)
|
|
6881
|
+
this._isRendered = false
|
|
6726
6882
|
this.isTouchDevice = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)
|
|
6727
6883
|
if (this.options.disableTouch === true) {
|
|
6728
6884
|
this.isTouchDevice = false
|
|
@@ -6817,6 +6973,9 @@ class WebsyTable3 {
|
|
|
6817
6973
|
console.error(`No element found with ID ${this.elementId}`)
|
|
6818
6974
|
}
|
|
6819
6975
|
}
|
|
6976
|
+
get isRendered () {
|
|
6977
|
+
return this._isRendered
|
|
6978
|
+
}
|
|
6820
6979
|
set columns (columns) {
|
|
6821
6980
|
this.options.columns = columns
|
|
6822
6981
|
this.renderColumnHeaders()
|
|
@@ -6826,6 +6985,7 @@ class WebsyTable3 {
|
|
|
6826
6985
|
this.renderTotals()
|
|
6827
6986
|
}
|
|
6828
6987
|
appendRows (data) {
|
|
6988
|
+
this._isRendered = false
|
|
6829
6989
|
this.hideError()
|
|
6830
6990
|
let bodyEl = document.getElementById(`${this.elementId}_tableBody`)
|
|
6831
6991
|
if (bodyEl) {
|
|
@@ -6839,6 +6999,7 @@ class WebsyTable3 {
|
|
|
6839
6999
|
}
|
|
6840
7000
|
else {
|
|
6841
7001
|
bodyEl.innerHTML += this.buildBodyHtml(data, true)
|
|
7002
|
+
this._isRendered = true
|
|
6842
7003
|
}
|
|
6843
7004
|
this.currentData = this.currentData.concat(data)
|
|
6844
7005
|
}
|
|
@@ -7840,10 +8001,12 @@ class WebsyChart {
|
|
|
7840
8001
|
maxBandWidth: 100,
|
|
7841
8002
|
allowUnevenBands: true,
|
|
7842
8003
|
allowBrushing: true,
|
|
7843
|
-
balancedMinMax: false
|
|
8004
|
+
balancedMinMax: false,
|
|
8005
|
+
onRendered: () => {}
|
|
7844
8006
|
}
|
|
7845
8007
|
this.elementId = elementId
|
|
7846
8008
|
this.options = Object.assign({}, DEFAULTS, options)
|
|
8009
|
+
this._isRendered = false
|
|
7847
8010
|
this.leftAxis = null
|
|
7848
8011
|
this.rightAxis = null
|
|
7849
8012
|
this.topAxis = null
|
|
@@ -7882,21 +8045,6 @@ class WebsyChart {
|
|
|
7882
8045
|
}
|
|
7883
8046
|
}
|
|
7884
8047
|
}
|
|
7885
|
-
// }
|
|
7886
|
-
// else {
|
|
7887
|
-
// let domain = [...this[xAxis].domain()]
|
|
7888
|
-
// if (this.options.orientation === 'horizontal') {
|
|
7889
|
-
// domain = domain.reverse()
|
|
7890
|
-
// }
|
|
7891
|
-
// for (let j = 0; j < domain.length; j++) {
|
|
7892
|
-
// let breakA = this[xAxis](domain[j]) - (width / 2)
|
|
7893
|
-
// let breakB = breakA + width
|
|
7894
|
-
// if (input > breakA && input <= breakB) {
|
|
7895
|
-
// output = j
|
|
7896
|
-
// break
|
|
7897
|
-
// }
|
|
7898
|
-
// }
|
|
7899
|
-
// }
|
|
7900
8048
|
return output
|
|
7901
8049
|
}
|
|
7902
8050
|
let that = this
|
|
@@ -7983,6 +8131,9 @@ class WebsyChart {
|
|
|
7983
8131
|
this.options.data = d
|
|
7984
8132
|
this.render()
|
|
7985
8133
|
}
|
|
8134
|
+
get isRendered () {
|
|
8135
|
+
return this._isRendered
|
|
8136
|
+
}
|
|
7986
8137
|
close () {
|
|
7987
8138
|
this.leftAxisLayer && this.leftAxisLayer.selectAll('*').remove()
|
|
7988
8139
|
this.rightAxisLayer && this.rightAxisLayer.selectAll('*').remove()
|
|
@@ -8293,6 +8444,7 @@ this.render()
|
|
|
8293
8444
|
}
|
|
8294
8445
|
render (options) {
|
|
8295
8446
|
/* global d3 options WebsyUtils */
|
|
8447
|
+
this._isRendered = false
|
|
8296
8448
|
if (typeof options !== 'undefined') {
|
|
8297
8449
|
this.options = Object.assign({}, this.options, options)
|
|
8298
8450
|
if (this.options.legendOptions) {
|
|
@@ -9159,6 +9311,7 @@ this.refLineLayer.selectAll('.reference-line-label').remove()
|
|
|
9159
9311
|
if (this.options.refLines && this.options.refLines.length > 0) {
|
|
9160
9312
|
this.options.refLines.forEach(l => this.renderRefLine(l))
|
|
9161
9313
|
}
|
|
9314
|
+
this._isRendered = true
|
|
9162
9315
|
|
|
9163
9316
|
}
|
|
9164
9317
|
renderarea (series, index) {
|
|
@@ -10590,9 +10743,14 @@ class WebsyKPI {
|
|
|
10590
10743
|
}
|
|
10591
10744
|
this.elementId = elementId
|
|
10592
10745
|
this.options = Object.assign({}, DEFAULTS, options)
|
|
10746
|
+
this._isRendered = false
|
|
10593
10747
|
this.render()
|
|
10594
10748
|
}
|
|
10749
|
+
get isRendered () {
|
|
10750
|
+
return this._isRendered
|
|
10751
|
+
}
|
|
10595
10752
|
render (options) {
|
|
10753
|
+
this._isRendered = false
|
|
10596
10754
|
this.options = Object.assign({}, this.options, options)
|
|
10597
10755
|
if (!this.options.label.classes) {
|
|
10598
10756
|
this.options.label.classes = []
|
|
@@ -10645,6 +10803,7 @@ class WebsyKPI {
|
|
|
10645
10803
|
</div>
|
|
10646
10804
|
`
|
|
10647
10805
|
el.innerHTML = html
|
|
10806
|
+
this._isRendered = true
|
|
10648
10807
|
}
|
|
10649
10808
|
}
|
|
10650
10809
|
}
|
|
@@ -10666,6 +10825,7 @@ class WebsyMap {
|
|
|
10666
10825
|
}
|
|
10667
10826
|
this.elementId = elementId
|
|
10668
10827
|
this.options = Object.assign({}, DEFAULTS, options)
|
|
10828
|
+
this._isRendered = false
|
|
10669
10829
|
if (!elementId) {
|
|
10670
10830
|
console.log('No element Id provided for Websy Map')
|
|
10671
10831
|
return
|
|
@@ -10697,6 +10857,9 @@ class WebsyMap {
|
|
|
10697
10857
|
this.render()
|
|
10698
10858
|
}
|
|
10699
10859
|
}
|
|
10860
|
+
get isRendered () {
|
|
10861
|
+
return this._isRendered
|
|
10862
|
+
}
|
|
10700
10863
|
handleClick (event) {
|
|
10701
10864
|
|
|
10702
10865
|
}
|
|
@@ -10704,6 +10867,7 @@ class WebsyMap {
|
|
|
10704
10867
|
|
|
10705
10868
|
}
|
|
10706
10869
|
render () {
|
|
10870
|
+
this._isRendered = false
|
|
10707
10871
|
const mapEl = document.getElementById(`${this.elementId}_map`)
|
|
10708
10872
|
const legendEl = document.getElementById(`${this.elementId}_map`)
|
|
10709
10873
|
if (this.options.showLegend === true && this.options.data.polygons) {
|
|
@@ -10835,6 +10999,7 @@ class WebsyMap {
|
|
|
10835
10999
|
else if (this.options.center) {
|
|
10836
11000
|
this.map.setView(this.options.center, this.options.zoom || null)
|
|
10837
11001
|
}
|
|
11002
|
+
this._isRendered = true
|
|
10838
11003
|
}
|
|
10839
11004
|
}
|
|
10840
11005
|
|