@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.
@@ -55,6 +55,10 @@ class APIService {
55
55
  const url = this.buildUrl(entity, id)
56
56
  return this.run('DELETE', url)
57
57
  }
58
+ deleteMany (entity, query) {
59
+ const url = this.buildUrl(entity, null, query)
60
+ return this.run('DELETE', url)
61
+ }
58
62
  get (entity, id, query, offset, limit) {
59
63
  let url = this.buildUrl(entity, id, query)
60
64
  if (offset) {
@@ -65,12 +69,12 @@ class APIService {
65
69
  url += `?offset=${offset}`
66
70
  }
67
71
  }
68
- if (limit) {
72
+ if (limit || this.options.rowLimit) {
69
73
  if (url.indexOf('?') !== -1) {
70
- url += `&limit=${limit}`
74
+ url += `&limit=${limit || this.options.rowLimit}`
71
75
  }
72
76
  else {
73
- url += `?limit=${limit}`
77
+ url += `?limit=${limit || this.options.rowLimit}`
74
78
  }
75
79
  }
76
80
  return this.run('GET', url)
@@ -188,16 +192,51 @@ class ButtonGroup {
188
192
  this.render()
189
193
  }
190
194
  }
195
+ get value () {
196
+ if (this.options.activeItem > -1) {
197
+ return [this.options.items[this.options.activeItem]]
198
+ }
199
+ else if (this.options.multiSelect === true) {
200
+ return this.options.items.filter(d => d.selected)
201
+ }
202
+ return []
203
+ }
204
+ set value (value) {
205
+ let activeIndex = -1
206
+ if (this.options.multiSelect === true) {
207
+ if (Array.isArray(value)) {
208
+ this.options.items.forEach(d => {
209
+ if (value.indexOf(d.value) !== -1) {
210
+ d.selected = true
211
+ }
212
+ else {
213
+ d.selected = false
214
+ }
215
+ })
216
+ }
217
+ }
218
+ else {
219
+ for (let i = 0; i < this.options.items.length; i++) {
220
+ if ((this.options.items[i].value || this.options.items[i].label) === value) {
221
+ activeIndex = i
222
+ }
223
+ }
224
+ this.options.activeItem = activeIndex
225
+ }
226
+ this.render()
227
+ }
191
228
  handleClick (event) {
192
229
  if (event.target.classList.contains('websy-button-group-item')) {
193
230
  const index = +event.target.getAttribute('data-index')
194
231
  if (this.options.multiSelect === true) {
195
232
  if (event.target.classList.contains('active')) {
233
+ this.options.items[index].selected = false
196
234
  this.options.onDeactivate(this.options.items[index], index, event)
197
235
  event.target.classList.remove('active')
198
236
  event.target.classList.add('inactive')
199
237
  }
200
238
  else {
239
+ this.options.items[index].selected = true
201
240
  this.options.onActivate(this.options.items[index], index, event)
202
241
  event.target.classList.add('active')
203
242
  event.target.classList.remove('inactive')
@@ -248,7 +287,10 @@ class ButtonGroup {
248
287
  let activeClass = ''
249
288
  if (this.options.activeItem !== -1) {
250
289
  activeClass = i === this.options.activeItem ? 'active' : 'inactive'
251
- }
290
+ }
291
+ else if (this.options.multiSelect === true) {
292
+ activeClass = t.selected === true ? 'active' : 'inactive'
293
+ }
252
294
  return `
253
295
  <${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}>
254
296
  `
@@ -1858,6 +1900,7 @@ class WebsyDropdown {
1858
1900
  const contentPos = WebsyUtils.getElementPos(contentEl)
1859
1901
  if (this.options.style === 'plain' && headerPos.width > 0 && headerPos.height > 0) {
1860
1902
  contentEl.style.right = `calc(100vw - ${headerPos.right}px)`
1903
+ contentEl.style.width = `${headerEl.clientWidth}px`
1861
1904
  if (headerPos.bottom + contentPos.height > window.innerHeight) {
1862
1905
  // contentEl.classList.add('on-top')
1863
1906
  contentEl.style.bottom = `calc(100vh - ${headerPos.top}px)`
@@ -1869,6 +1912,7 @@ class WebsyDropdown {
1869
1912
  else if (this.options.style === 'plain' && headerPos.width === 0 && headerPos.height === 0) {
1870
1913
  const targetPos = WebsyUtils.getElementPos(event.target)
1871
1914
  contentEl.style.right = `calc(100vw - ${targetPos.right}px)`
1915
+ contentEl.style.width = `${targetPos.width}px`
1872
1916
  }
1873
1917
  if (this.options.disableSearch !== true) {
1874
1918
  const searchEl = document.getElementById(`${this.elementId}_search`)
@@ -1880,6 +1924,19 @@ class WebsyDropdown {
1880
1924
  this.options.onOpen(this.elementId)
1881
1925
  }
1882
1926
  }
1927
+ set items (items) {
1928
+ this.options.items = [...items]
1929
+ if (this.options.items.length > 0) {
1930
+ this.options.items = this.options.items.map((d, i) => {
1931
+ if (typeof d.index === 'undefined') {
1932
+ d.index = i
1933
+ }
1934
+ return d
1935
+ })
1936
+ }
1937
+ this._originalData = [...this.options.items]
1938
+ this.render()
1939
+ }
1883
1940
  render () {
1884
1941
  if (!this.elementId) {
1885
1942
  console.log('No element Id provided for Websy Dropdown')
@@ -2078,9 +2135,7 @@ class WebsyForm {
2078
2135
  }
2079
2136
  GlobalPubSub.subscribe('recaptchaready', this.recaptchaReady.bind(this))
2080
2137
  this.recaptchaResult = null
2081
- this.options = Object.assign(defaults, {}, {
2082
- // defaults go here
2083
- }, options)
2138
+ this.options = Object.assign({}, defaults, options)
2084
2139
  if (!elementId) {
2085
2140
  console.log('No element Id provided')
2086
2141
  return
@@ -2148,8 +2203,27 @@ class WebsyForm {
2148
2203
  const data = {}
2149
2204
  const temp = new FormData(formEl)
2150
2205
  temp.forEach((value, key) => {
2151
- data[key] = value
2206
+ if (this.fieldMap[key] && this.fieldMap[key].type === 'checkbox') {
2207
+ data[key] = true
2208
+ }
2209
+ if (this.fieldMap[key] && this.fieldMap[key].instance && this.fieldMap[key].instance.value) {
2210
+ data[key] = this.fieldMap[key].instance.value
2211
+ }
2212
+ else {
2213
+ data[key] = value
2214
+ }
2152
2215
  })
2216
+ let keys = Object.keys(data)
2217
+ for (const key in this.fieldMap) {
2218
+ if (keys.indexOf(key) === -1) {
2219
+ if (this.fieldMap[key] && this.fieldMap[key].type === 'checkbox') {
2220
+ data[key] = false
2221
+ }
2222
+ else if (this.fieldMap[key] && this.fieldMap[key].instance && this.fieldMap[key].instance.value) {
2223
+ data[key] = this.fieldMap[key].instance.value
2224
+ }
2225
+ }
2226
+ }
2153
2227
  return data
2154
2228
  }
2155
2229
  set data (d) {
@@ -2207,6 +2281,7 @@ class WebsyForm {
2207
2281
  handleClick (event) {
2208
2282
  if (event.target.classList.contains('submit')) {
2209
2283
  event.preventDefault()
2284
+ event.stopPropagation()
2210
2285
  this.submitForm()
2211
2286
  }
2212
2287
  else if (event.target.classList.contains('cancel')) {
@@ -2379,6 +2454,7 @@ class WebsyForm {
2379
2454
  `
2380
2455
  this.options.fields.forEach((f, i) => {
2381
2456
  this.fieldMap[f.field] = f
2457
+ f.owningElement = this.elementId
2382
2458
  if (f.component) {
2383
2459
  componentsToProcess.push(f)
2384
2460
  html += `
@@ -2465,6 +2541,10 @@ class WebsyForm {
2465
2541
  const el = document.getElementById(`${this.elementId}_input_${field}`)
2466
2542
  if (el) {
2467
2543
  el.value = value
2544
+ el.setAttribute('value', value)
2545
+ if (this.fieldMap[field].type === 'checkbox') {
2546
+ el.checked = value
2547
+ }
2468
2548
  }
2469
2549
  else {
2470
2550
  console.error(`Input for ${field} does not exist in form.`)
@@ -2622,6 +2702,10 @@ class MultiForm {
2622
2702
  }
2623
2703
  this.render()
2624
2704
  }
2705
+ addData (data) {
2706
+ this.formData = this.formData.concat(data)
2707
+ this.render()
2708
+ }
2625
2709
  addEntry () {
2626
2710
  const el = document.getElementById(`${this.elementId}_container`)
2627
2711
  let newId = WebsyDesigns.Utils.createIdentity()
@@ -2639,7 +2723,7 @@ class MultiForm {
2639
2723
  </button>
2640
2724
  `
2641
2725
  el.appendChild(newFormEl)
2642
- let formOptions = Object.assign({}, this.options)
2726
+ let formOptions = Object.assign({}, this.options, { fields: [...this.options.fields.map(f => Object.assign({}, f))] })
2643
2727
  this.forms.push(new WebsyDesigns.Form(`${this.elementId}_${newId}_form`, formOptions))
2644
2728
  }
2645
2729
  clear () {
@@ -2653,14 +2737,20 @@ class MultiForm {
2653
2737
  }
2654
2738
  get data () {
2655
2739
  const d = this.forms.map(f => (f.data))
2656
- // we don't return the last form
2657
- d.pop()
2740
+ console.log('forms data', d)
2741
+ if (this.options.allowAdd !== false) {
2742
+ // we don't return the last form
2743
+ d.pop()
2744
+ }
2658
2745
  return d
2659
2746
  }
2660
2747
  set data (d) {
2661
2748
  this.formData = d
2662
2749
  this.render()
2663
2750
  }
2751
+ get deleted () {
2752
+ return this.formData.filter(d => this.recordsToDelete.includes(`${d.id}`))
2753
+ }
2664
2754
  handleClick (event) {
2665
2755
  if (event.target.classList.contains('websy-multi-form-add')) {
2666
2756
  let id = event.target.getAttribute('data-formid')
@@ -2740,15 +2830,17 @@ class MultiForm {
2740
2830
  `
2741
2831
  }
2742
2832
  el.innerHTML = html
2743
- this.formData.forEach(d => {
2744
- let formOptions = Object.assign({}, this.options)
2833
+ this.forms = new Array(this.formData.length)
2834
+ this.formData.forEach((d, i) => {
2835
+ let formOptions = Object.assign({}, this.options, { fields: [...this.options.fields.map(f => Object.assign({}, f))] })
2745
2836
  let formObject = new WebsyDesigns.Form(`${this.elementId}_${d.formId}_form`, formOptions)
2746
2837
  formObject.data = d
2747
- this.forms.push(formObject)
2838
+ this.forms[i] = formObject
2748
2839
  })
2749
2840
  if (this.options.allowAdd === true) {
2750
- let formOptions = Object.assign({}, this.options)
2751
- this.forms.push(new WebsyDesigns.Form(`${this.elementId}_${id}_form`, formOptions))
2841
+ let formOptions = Object.assign({}, this.options, { fields: [...this.options.fields.map(f => Object.assign({}, f))] })
2842
+ let formObject = new WebsyDesigns.Form(`${this.elementId}_${id}_form`, formOptions)
2843
+ this.forms.push(formObject)
2752
2844
  }
2753
2845
  }
2754
2846
  }
@@ -3416,7 +3508,9 @@ class WebsyPDFButton {
3416
3508
  classes: [],
3417
3509
  wait: 0,
3418
3510
  buttonText: 'Download',
3419
- directDownload: false
3511
+ directDownload: false,
3512
+ preProcess: (callbackFn) => (callbackFn(true)),
3513
+ onError: () => {}
3420
3514
  }
3421
3515
  this.elementId = elementId
3422
3516
  this.options = Object.assign({}, DEFAULTS, options)
@@ -3474,87 +3568,95 @@ class WebsyPDFButton {
3474
3568
  handleClick (event) {
3475
3569
  if (event.target.classList.contains('websy-pdf-button')) {
3476
3570
  this.loader.show()
3477
- setTimeout(() => {
3478
- if (this.options.targetId) {
3479
- const el = document.getElementById(this.options.targetId)
3480
- if (el) {
3481
- const pdfData = { options: {} }
3482
- if (this.options.pdfOptions) {
3483
- pdfData.options = Object.assign({}, this.options.pdfOptions)
3484
- }
3485
- if (this.options.header) {
3486
- if (this.options.header.elementId) {
3487
- const headerEl = document.getElementById(this.options.header.elementId)
3488
- if (headerEl) {
3489
- pdfData.header = headerEl.outerHTML
3490
- if (this.options.header.css) {
3491
- pdfData.options.headerCSS = this.options.header.css
3492
- }
3493
- }
3494
- }
3495
- else if (this.options.header.html) {
3496
- pdfData.header = this.options.header.html
3497
- if (this.options.header.css) {
3498
- pdfData.options.headerCSS = this.options.header.css
3571
+ this.options.preProcess((proceed) => {
3572
+ if (proceed === true) {
3573
+ setTimeout(() => {
3574
+ if (this.options.targetId) {
3575
+ const el = document.getElementById(this.options.targetId)
3576
+ if (el) {
3577
+ const pdfData = { options: {} }
3578
+ if (this.options.pdfOptions) {
3579
+ pdfData.options = Object.assign({}, this.options.pdfOptions)
3499
3580
  }
3500
- }
3501
- else {
3502
- pdfData.header = this.options.header
3503
- }
3504
- }
3505
- if (this.options.footer) {
3506
- if (this.options.footer.elementId) {
3507
- const footerEl = document.getElementById(this.options.footer.elementId)
3508
- if (footerEl) {
3509
- pdfData.footer = footerEl.outerHTML
3510
- if (this.options.footer.css) {
3511
- pdfData.options.footerCSS = this.options.footer.css
3581
+ if (this.options.header) {
3582
+ if (this.options.header.elementId) {
3583
+ const headerEl = document.getElementById(this.options.header.elementId)
3584
+ if (headerEl) {
3585
+ pdfData.header = headerEl.outerHTML
3586
+ if (this.options.header.css) {
3587
+ pdfData.options.headerCSS = this.options.header.css
3588
+ }
3589
+ }
3590
+ }
3591
+ else if (this.options.header.html) {
3592
+ pdfData.header = this.options.header.html
3593
+ if (this.options.header.css) {
3594
+ pdfData.options.headerCSS = this.options.header.css
3595
+ }
3596
+ }
3597
+ else {
3598
+ pdfData.header = this.options.header
3512
3599
  }
3513
3600
  }
3514
- }
3515
- else {
3516
- pdfData.footer = this.options.footer
3517
- }
3518
- }
3519
- pdfData.html = el.outerHTML
3520
- // document.getElementById(`${this.elementId}_pdfHeader`).value = pdfData.header
3521
- // document.getElementById(`${this.elementId}_pdfHTML`).value = pdfData.html
3522
- // document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
3523
- // document.getElementById(`${this.elementId}_form`).submit()
3524
- this.service.add('', pdfData, {responseType: 'blob'}).then(response => {
3525
- this.loader.hide()
3526
- const blob = new Blob([response], {type: 'application/pdf'})
3527
- let msg = `
3528
- <div class='text-center websy-pdf-download'>
3529
- <div>Your file is ready to download</div>
3530
- <a href='${URL.createObjectURL(blob)}' target='_blank'
3531
- `
3532
- if (this.options.directDownload === true) {
3533
- let fileName
3534
- if (typeof this.options.fileName === 'function') {
3535
- fileName = this.options.fileName() || 'Export'
3601
+ if (this.options.footer) {
3602
+ if (this.options.footer.elementId) {
3603
+ const footerEl = document.getElementById(this.options.footer.elementId)
3604
+ if (footerEl) {
3605
+ pdfData.footer = footerEl.outerHTML
3606
+ if (this.options.footer.css) {
3607
+ pdfData.options.footerCSS = this.options.footer.css
3608
+ }
3609
+ }
3610
+ }
3611
+ else {
3612
+ pdfData.footer = this.options.footer
3613
+ }
3536
3614
  }
3537
- else {
3538
- fileName = this.options.fileName || 'Export'
3539
- }
3540
- msg += `download='${fileName}.pdf'`
3615
+ pdfData.html = el.outerHTML
3616
+ // document.getElementById(`${this.elementId}_pdfHeader`).value = pdfData.header
3617
+ // document.getElementById(`${this.elementId}_pdfHTML`).value = pdfData.html
3618
+ // document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
3619
+ // document.getElementById(`${this.elementId}_form`).submit()
3620
+ this.service.add('', pdfData, {responseType: 'blob'}).then(response => {
3621
+ this.loader.hide()
3622
+ const blob = new Blob([response], {type: 'application/pdf'})
3623
+ let msg = `
3624
+ <div class='text-center websy-pdf-download'>
3625
+ <div>Your file is ready to download</div>
3626
+ <a href='${URL.createObjectURL(blob)}' target='_blank'
3627
+ `
3628
+ if (this.options.directDownload === true) {
3629
+ let fileName
3630
+ if (typeof this.options.fileName === 'function') {
3631
+ fileName = this.options.fileName() || 'Export'
3632
+ }
3633
+ else {
3634
+ fileName = this.options.fileName || 'Export'
3635
+ }
3636
+ msg += `download='${fileName}.pdf'`
3637
+ }
3638
+ msg += `
3639
+ >
3640
+ <button class='websy-btn download-pdf'>${this.options.buttonText}</button>
3641
+ </a>
3642
+ </div>
3643
+ `
3644
+ this.popup.show({
3645
+ message: msg,
3646
+ mask: true
3647
+ })
3648
+ }, err => {
3649
+ console.error(err)
3650
+ })
3541
3651
  }
3542
- msg += `
3543
- >
3544
- <button class='websy-btn download-pdf'>${this.options.buttonText}</button>
3545
- </a>
3546
- </div>
3547
- `
3548
- this.popup.show({
3549
- message: msg,
3550
- mask: true
3551
- })
3552
- }, err => {
3553
- console.error(err)
3554
- })
3555
- }
3556
- }
3557
- }, this.options.wait)
3652
+ }
3653
+ }, this.options.wait)
3654
+ }
3655
+ else {
3656
+ this.loader.hide()
3657
+ this.options.onError()
3658
+ }
3659
+ })
3558
3660
  }
3559
3661
  else if (event.target.classList.contains('download-pdf')) {
3560
3662
  this.popup.hide()
@@ -3694,6 +3796,9 @@ class WebsyPubSub {
3694
3796
  }
3695
3797
  }
3696
3798
  subscribe (id, method, fn) {
3799
+ if (!this.subscriptions) {
3800
+ this.subscriptions = {}
3801
+ }
3697
3802
  if (arguments.length === 3) {
3698
3803
  if (!this.subscriptions[id]) {
3699
3804
  this.subscriptions[id] = {}
@@ -5097,7 +5202,52 @@ class WebsyTemplate {
5097
5202
  return html
5098
5203
  }
5099
5204
  handleClick (event) {
5100
- //
5205
+ if (event.target.classList.contains('clickable')) {
5206
+ this.handleEvent(event, 'clickable', 'click')
5207
+ }
5208
+ }
5209
+ handleEvent (event, eventType, action) {
5210
+ let l = event.target.getAttribute('data-event')
5211
+ if (l) {
5212
+ l = l.split('(')
5213
+ let params = []
5214
+ const id = event.target.getAttribute('data-id')
5215
+ // const locator = event.target.getAttribute('data-locator')
5216
+ // if (l[1]) {
5217
+ // l[1] = l[1].replace(')', '')
5218
+ // params = l[1].split(',')
5219
+ // }
5220
+ // l = l[0]
5221
+ let data = this.options.data
5222
+ // if (locator !== '') {
5223
+ // let locatorItems = locator.split(';')
5224
+ // locatorItems.forEach(loc => {
5225
+ // let locatorParts = loc.split(':')
5226
+ // if (data[locatorParts[0]]) {
5227
+ // data = data[locatorParts[0]]
5228
+ // let parts = locatorParts[1].split('.')
5229
+ // parts.forEach(p => {
5230
+ // data = data[p]
5231
+ // })
5232
+ // }
5233
+ // })
5234
+ // }
5235
+ // params = params.map(p => {
5236
+ // if (typeof p !== 'string' && typeof p !== 'number') {
5237
+ // if (data[+id]) {
5238
+ // p = data[+id][p]
5239
+ // }
5240
+ // }
5241
+ // else if (typeof p === 'string') {
5242
+ // p = p.replace(/"/g, '').replace(/'/g, '')
5243
+ // }
5244
+ // return p
5245
+ // })
5246
+ if (event.target.classList.contains(eventType) && this.options.listeners[action] && this.options.listeners[action][l]) {
5247
+ event.stopPropagation()
5248
+ this.options.listeners[action][l].call(this, event, data[+id], ...params)
5249
+ }
5250
+ }
5101
5251
  }
5102
5252
  render () {
5103
5253
  this.resize()
@@ -6307,6 +6457,7 @@ class WebsyTable3 {
6307
6457
  autoFitColumns: true
6308
6458
  }
6309
6459
  this.options = Object.assign({}, DEFAULTS, options)
6460
+ this._isRendered = false
6310
6461
  this.isTouchDevice = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)
6311
6462
  if (this.options.disableTouch === true) {
6312
6463
  this.isTouchDevice = false
@@ -6401,6 +6552,9 @@ class WebsyTable3 {
6401
6552
  console.error(`No element found with ID ${this.elementId}`)
6402
6553
  }
6403
6554
  }
6555
+ get isRendered () {
6556
+ return this._isRendered
6557
+ }
6404
6558
  set columns (columns) {
6405
6559
  this.options.columns = columns
6406
6560
  this.renderColumnHeaders()
@@ -6410,6 +6564,7 @@ class WebsyTable3 {
6410
6564
  this.renderTotals()
6411
6565
  }
6412
6566
  appendRows (data) {
6567
+ this._isRendered = false
6413
6568
  this.hideError()
6414
6569
  let bodyEl = document.getElementById(`${this.elementId}_tableBody`)
6415
6570
  if (bodyEl) {
@@ -6423,6 +6578,7 @@ class WebsyTable3 {
6423
6578
  }
6424
6579
  else {
6425
6580
  bodyEl.innerHTML += this.buildBodyHtml(data, true)
6581
+ this._isRendered = true
6426
6582
  }
6427
6583
  this.currentData = this.currentData.concat(data)
6428
6584
  }
@@ -7424,10 +7580,12 @@ class WebsyChart {
7424
7580
  maxBandWidth: 100,
7425
7581
  allowUnevenBands: true,
7426
7582
  allowBrushing: true,
7427
- balancedMinMax: false
7583
+ balancedMinMax: false,
7584
+ onRendered: () => {}
7428
7585
  }
7429
7586
  this.elementId = elementId
7430
7587
  this.options = Object.assign({}, DEFAULTS, options)
7588
+ this._isRendered = false
7431
7589
  this.leftAxis = null
7432
7590
  this.rightAxis = null
7433
7591
  this.topAxis = null
@@ -7466,21 +7624,6 @@ class WebsyChart {
7466
7624
  }
7467
7625
  }
7468
7626
  }
7469
- // }
7470
- // else {
7471
- // let domain = [...this[xAxis].domain()]
7472
- // if (this.options.orientation === 'horizontal') {
7473
- // domain = domain.reverse()
7474
- // }
7475
- // for (let j = 0; j < domain.length; j++) {
7476
- // let breakA = this[xAxis](domain[j]) - (width / 2)
7477
- // let breakB = breakA + width
7478
- // if (input > breakA && input <= breakB) {
7479
- // output = j
7480
- // break
7481
- // }
7482
- // }
7483
- // }
7484
7627
  return output
7485
7628
  }
7486
7629
  let that = this
@@ -7567,6 +7710,9 @@ class WebsyChart {
7567
7710
  this.options.data = d
7568
7711
  this.render()
7569
7712
  }
7713
+ get isRendered () {
7714
+ return this._isRendered
7715
+ }
7570
7716
  close () {
7571
7717
  this.leftAxisLayer && this.leftAxisLayer.selectAll('*').remove()
7572
7718
  this.rightAxisLayer && this.rightAxisLayer.selectAll('*').remove()
@@ -7877,6 +8023,7 @@ this.render()
7877
8023
  }
7878
8024
  render (options) {
7879
8025
  /* global d3 options WebsyUtils */
8026
+ this._isRendered = false
7880
8027
  if (typeof options !== 'undefined') {
7881
8028
  this.options = Object.assign({}, this.options, options)
7882
8029
  if (this.options.legendOptions) {
@@ -8743,6 +8890,7 @@ this.refLineLayer.selectAll('.reference-line-label').remove()
8743
8890
  if (this.options.refLines && this.options.refLines.length > 0) {
8744
8891
  this.options.refLines.forEach(l => this.renderRefLine(l))
8745
8892
  }
8893
+ this._isRendered = true
8746
8894
 
8747
8895
  }
8748
8896
  renderarea (series, index) {
@@ -9746,9 +9894,14 @@ class WebsyKPI {
9746
9894
  }
9747
9895
  this.elementId = elementId
9748
9896
  this.options = Object.assign({}, DEFAULTS, options)
9897
+ this._isRendered = false
9749
9898
  this.render()
9750
9899
  }
9900
+ get isRendered () {
9901
+ return this._isRendered
9902
+ }
9751
9903
  render (options) {
9904
+ this._isRendered = false
9752
9905
  this.options = Object.assign({}, this.options, options)
9753
9906
  if (!this.options.label.classes) {
9754
9907
  this.options.label.classes = []
@@ -9801,6 +9954,7 @@ class WebsyKPI {
9801
9954
  </div>
9802
9955
  `
9803
9956
  el.innerHTML = html
9957
+ this._isRendered = true
9804
9958
  }
9805
9959
  }
9806
9960
  }
@@ -9822,6 +9976,7 @@ class WebsyMap {
9822
9976
  }
9823
9977
  this.elementId = elementId
9824
9978
  this.options = Object.assign({}, DEFAULTS, options)
9979
+ this._isRendered = false
9825
9980
  if (!elementId) {
9826
9981
  console.log('No element Id provided for Websy Map')
9827
9982
  return
@@ -9853,6 +10008,9 @@ class WebsyMap {
9853
10008
  this.render()
9854
10009
  }
9855
10010
  }
10011
+ get isRendered () {
10012
+ return this._isRendered
10013
+ }
9856
10014
  handleClick (event) {
9857
10015
 
9858
10016
  }
@@ -9860,6 +10018,7 @@ class WebsyMap {
9860
10018
 
9861
10019
  }
9862
10020
  render () {
10021
+ this._isRendered = false
9863
10022
  const mapEl = document.getElementById(`${this.elementId}_map`)
9864
10023
  const legendEl = document.getElementById(`${this.elementId}_map`)
9865
10024
  if (this.options.showLegend === true && this.options.data.polygons) {
@@ -9991,6 +10150,7 @@ class WebsyMap {
9991
10150
  else if (this.options.center) {
9992
10151
  this.map.setView(this.options.center, this.options.zoom || null)
9993
10152
  }
10153
+ this._isRendered = true
9994
10154
  }
9995
10155
  }
9996
10156