@websy/websy-designs 1.2.33 → 1.3.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/pgHelper.js +13 -5
- package/dist/server/routes/v1/api.js +11 -1
- package/dist/server/routes/v1/shop.js +52 -15
- package/dist/websy-designs-es6.debug.js +253 -107
- package/dist/websy-designs-es6.js +461 -293
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +306 -108
- package/dist/websy-designs.js +410 -186
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/index.js +1 -0
- package/package.json +1 -1
|
@@ -375,6 +375,7 @@ class WebsyDatePicker {
|
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
377
|
close (confirm, isRange = false) {
|
|
378
|
+
console.trace()
|
|
378
379
|
const maskEl = document.getElementById(`${this.elementId}_mask`)
|
|
379
380
|
const contentEl = document.getElementById(`${this.elementId}_content`)
|
|
380
381
|
const el = document.getElementById(this.elementId)
|
|
@@ -391,19 +392,19 @@ class WebsyDatePicker {
|
|
|
391
392
|
for (let i = this.selectedRangeDates[0]; i < this.selectedRangeDates[1] + 1; i++) {
|
|
392
393
|
hoursOut.push(this.options.hours[i])
|
|
393
394
|
}
|
|
394
|
-
this.options.onChange(hoursOut, true)
|
|
395
|
+
this.options.onChange(hoursOut, true, this.selectedRange)
|
|
395
396
|
}
|
|
396
397
|
else {
|
|
397
|
-
this.options.onChange(this.selectedRangeDates, true)
|
|
398
|
+
this.options.onChange(this.selectedRangeDates, true, this.selectedRange)
|
|
398
399
|
}
|
|
399
400
|
}
|
|
400
401
|
else {
|
|
401
402
|
if (this.options.mode === 'hour') {
|
|
402
403
|
let hoursOut = this.currentselection.map(h => this.options.hours[h])
|
|
403
|
-
this.options.onChange(hoursOut, true)
|
|
404
|
+
this.options.onChange(hoursOut, true, this.selectedRange)
|
|
404
405
|
}
|
|
405
406
|
else {
|
|
406
|
-
this.options.onChange(this.currentselection, isRange)
|
|
407
|
+
this.options.onChange(this.currentselection, isRange, this.selectedRange)
|
|
407
408
|
}
|
|
408
409
|
}
|
|
409
410
|
}
|
|
@@ -425,7 +426,8 @@ class WebsyDatePicker {
|
|
|
425
426
|
if (typeof d === 'number') {
|
|
426
427
|
d = new Date(d)
|
|
427
428
|
}
|
|
428
|
-
|
|
429
|
+
// d.setTime(d.getTime() + d.getTimezoneOffset() * 60000)
|
|
430
|
+
return new Date(d.setUTCHours(12, 0, 0, 0))
|
|
429
431
|
}
|
|
430
432
|
handleClick (event) {
|
|
431
433
|
if (event.target.classList.contains('websy-date-picker-header')) {
|
|
@@ -443,11 +445,7 @@ class WebsyDatePicker {
|
|
|
443
445
|
this.updateRange(index)
|
|
444
446
|
}
|
|
445
447
|
else if (event.target.classList.contains('websy-dp-date')) {
|
|
446
|
-
//
|
|
447
|
-
// return
|
|
448
|
-
// }
|
|
449
|
-
// const timestamp = event.target.id.split('_')[0]
|
|
450
|
-
// this.selectDate(+timestamp)
|
|
448
|
+
//
|
|
451
449
|
}
|
|
452
450
|
else if (event.target.classList.contains('websy-dp-confirm')) {
|
|
453
451
|
this.close(true)
|
|
@@ -476,7 +474,8 @@ class WebsyDatePicker {
|
|
|
476
474
|
handleMouseDown (event) {
|
|
477
475
|
if (this.shiftPressed === true && this.currentselection.length > 0) {
|
|
478
476
|
this.mouseDownId = this.currentselection[this.currentselection.length - 1]
|
|
479
|
-
|
|
477
|
+
let dateId = event.target.getAttribute('data-id')
|
|
478
|
+
this.selectDate(+dateId)
|
|
480
479
|
}
|
|
481
480
|
else {
|
|
482
481
|
this.mouseDown = true
|
|
@@ -489,7 +488,7 @@ class WebsyDatePicker {
|
|
|
489
488
|
this.currentselection = []
|
|
490
489
|
this.customRangeSelected = false
|
|
491
490
|
}
|
|
492
|
-
this.mouseDownId = +event.target.
|
|
491
|
+
this.mouseDownId = +event.target.getAttribute('data-id')
|
|
493
492
|
this.selectDate(this.mouseDownId)
|
|
494
493
|
}
|
|
495
494
|
}
|
|
@@ -500,9 +499,10 @@ class WebsyDatePicker {
|
|
|
500
499
|
if (event.target.classList.contains('websy-disabled-date')) {
|
|
501
500
|
return
|
|
502
501
|
}
|
|
503
|
-
|
|
502
|
+
let dateId = +event.target.getAttribute('data-id')
|
|
503
|
+
if (dateId !== this.mouseDownId) {
|
|
504
504
|
this.dragging = true
|
|
505
|
-
this.selectDate(
|
|
505
|
+
this.selectDate(dateId)
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
508
|
}
|
|
@@ -550,6 +550,7 @@ class WebsyDatePicker {
|
|
|
550
550
|
let rangeEnd
|
|
551
551
|
if (this.options.mode === 'date') {
|
|
552
552
|
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + (i * this.oneDay)))
|
|
553
|
+
d.setUTCHours(12, 0, 0, 0)
|
|
553
554
|
d = d.getTime()
|
|
554
555
|
rangeStart = this.selectedRangeDates[0].getTime()
|
|
555
556
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime()
|
|
@@ -608,9 +609,11 @@ class WebsyDatePicker {
|
|
|
608
609
|
else if (this.options.mode === 'hour') {
|
|
609
610
|
dateEl = document.getElementById(`${this.elementId}_${d}_hour`)
|
|
610
611
|
}
|
|
611
|
-
dateEl
|
|
612
|
-
|
|
613
|
-
|
|
612
|
+
if (dateEl) {
|
|
613
|
+
dateEl.classList.add('selected')
|
|
614
|
+
dateEl.classList.add('first')
|
|
615
|
+
dateEl.classList.add('last')
|
|
616
|
+
}
|
|
614
617
|
})
|
|
615
618
|
}
|
|
616
619
|
}
|
|
@@ -819,7 +822,7 @@ class WebsyDatePicker {
|
|
|
819
822
|
}
|
|
820
823
|
html += paddedDays.join('')
|
|
821
824
|
}
|
|
822
|
-
html += months[key].map(d => `<li id='${this.elementId}_${d.id}_date' class='websy-dp-date ${d.disabled === true ? 'websy-disabled-date' : ''}'>${d.dayOfMonth}</li>`).join('')
|
|
825
|
+
html += months[key].map(d => `<li id='${this.elementId}_${d.id}_date' data-id='${d.id}' class='websy-dp-date ${d.disabled === true ? 'websy-disabled-date' : ''}'>${d.dayOfMonth}</li>`).join('')
|
|
823
826
|
html += `
|
|
824
827
|
</ul>
|
|
825
828
|
</div>
|
|
@@ -832,7 +835,7 @@ class WebsyDatePicker {
|
|
|
832
835
|
yearList.reverse()
|
|
833
836
|
}
|
|
834
837
|
html += `<div id='${this.elementId}_dateList' class='websy-dp-date-list'><ul>`
|
|
835
|
-
html += yearList.map(d => `<li id='${this.elementId}_${d.id}_year' class='websy-dp-date websy-dp-year ${d.disabled === true ? 'websy-disabled-date' : ''}'>${d.year}</li>`).join('')
|
|
838
|
+
html += yearList.map(d => `<li id='${this.elementId}_${d.id}_year' data-id='${d.id}' class='websy-dp-date websy-dp-year ${d.disabled === true ? 'websy-disabled-date' : ''}'>${d.year}</li>`).join('')
|
|
836
839
|
html += `</ul></div>`
|
|
837
840
|
}
|
|
838
841
|
else if (this.options.mode === 'monthyear') {
|
|
@@ -849,7 +852,7 @@ class WebsyDatePicker {
|
|
|
849
852
|
}
|
|
850
853
|
html += paddedMonths.join('')
|
|
851
854
|
}
|
|
852
|
-
html += this.monthYears[year].map(d => `<li id='${this.elementId}_${d.id}_monthyear' data-year='${d.year}' class='websy-dp-date websy-dp-monthyear'>${d.month}</li>`).join('')
|
|
855
|
+
html += this.monthYears[year].map(d => `<li id='${this.elementId}_${d.id}_monthyear' data-id='${d.id}' data-year='${d.year}' class='websy-dp-date websy-dp-monthyear'>${d.month}</li>`).join('')
|
|
853
856
|
html += `</ul>`
|
|
854
857
|
}
|
|
855
858
|
html += `</div>`
|
|
@@ -940,17 +943,8 @@ class WebsyDatePicker {
|
|
|
940
943
|
selectRange (index, confirm = true) {
|
|
941
944
|
if (this.options.ranges[this.options.mode][index]) {
|
|
942
945
|
this.selectedRangeDates = [...this.options.ranges[this.options.mode][index].range]
|
|
943
|
-
this.currentselection =
|
|
946
|
+
this.currentselection = this.options.ranges[this.options.mode][index].range.map(d => d.getTime())
|
|
944
947
|
this.selectedRange = +index
|
|
945
|
-
const el = document.getElementById(`${this.elementId}_header`)
|
|
946
|
-
if (el) {
|
|
947
|
-
if (this.selectedRange === 0) {
|
|
948
|
-
el.classList.remove('range-selected')
|
|
949
|
-
}
|
|
950
|
-
else {
|
|
951
|
-
el.classList.add('range-selected')
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
948
|
this.highlightRange()
|
|
955
949
|
this.updateRange()
|
|
956
950
|
this.close(confirm, true)
|
|
@@ -959,14 +953,16 @@ class WebsyDatePicker {
|
|
|
959
953
|
selectCustomRange (rangeInput) {
|
|
960
954
|
this.selectedRange = -1
|
|
961
955
|
let isContinuousRange = true
|
|
962
|
-
if (rangeInput.length === 1) {
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
}
|
|
966
|
-
else if (rangeInput.length === 2) {
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
}
|
|
956
|
+
// if (rangeInput.length === 1) {
|
|
957
|
+
// this.selectedRangeDates = [...rangeInput]
|
|
958
|
+
// this.customRangeSelected = true
|
|
959
|
+
// }
|
|
960
|
+
// else if (rangeInput.length === 2) {
|
|
961
|
+
// this.selectedRangeDates = [...rangeInput]
|
|
962
|
+
// this.customRangeSelected = true
|
|
963
|
+
// }
|
|
964
|
+
this.selectedRangeDates = [...rangeInput]
|
|
965
|
+
this.customRangeSelected = true
|
|
970
966
|
rangeInput.forEach((r, i) => {
|
|
971
967
|
if (i > 0) {
|
|
972
968
|
if (this.options.mode === 'date' || this.options.mode === 'monthyear') {
|
|
@@ -1104,6 +1100,15 @@ class WebsyDatePicker {
|
|
|
1104
1100
|
if (labelEl) {
|
|
1105
1101
|
labelEl.innerHTML = range.label
|
|
1106
1102
|
}
|
|
1103
|
+
const headerEl = document.getElementById(`${this.elementId}_header`)
|
|
1104
|
+
if (headerEl) {
|
|
1105
|
+
if (this.selectedRange === 0) {
|
|
1106
|
+
headerEl.classList.remove('range-selected')
|
|
1107
|
+
}
|
|
1108
|
+
else {
|
|
1109
|
+
headerEl.classList.add('range-selected')
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1107
1112
|
}
|
|
1108
1113
|
}
|
|
1109
1114
|
|
|
@@ -1117,7 +1122,8 @@ class WebsyDragDrop {
|
|
|
1117
1122
|
const DEFAULTS = {
|
|
1118
1123
|
items: [],
|
|
1119
1124
|
orientation: 'horizontal',
|
|
1120
|
-
dropPlaceholder: 'Drop item here'
|
|
1125
|
+
dropPlaceholder: 'Drop item here',
|
|
1126
|
+
accepts: 'application/wd-item'
|
|
1121
1127
|
}
|
|
1122
1128
|
this.busy = false
|
|
1123
1129
|
this.options = Object.assign({}, DEFAULTS, options)
|
|
@@ -1143,9 +1149,7 @@ class WebsyDragDrop {
|
|
|
1143
1149
|
else {
|
|
1144
1150
|
console.error(`No element found with ID ${this.elementId}`)
|
|
1145
1151
|
}
|
|
1146
|
-
GlobalPubSub.subscribe(this.elementId, 'requestForDDItem', this.handleRequestForItem.bind(this))
|
|
1147
|
-
console.log('constructor dd')
|
|
1148
|
-
console.trace()
|
|
1152
|
+
GlobalPubSub.subscribe(this.elementId, 'requestForDDItem', this.handleRequestForItem.bind(this))
|
|
1149
1153
|
GlobalPubSub.subscribe(this.elementId, 'add', this.addItem.bind(this))
|
|
1150
1154
|
this.render()
|
|
1151
1155
|
}
|
|
@@ -1178,7 +1182,7 @@ class WebsyDragDrop {
|
|
|
1178
1182
|
item.id = WebsyDesigns.Utils.createIdentity()
|
|
1179
1183
|
}
|
|
1180
1184
|
let html = `
|
|
1181
|
-
<div id='${item.id}_item' class='websy-dragdrop-item' draggable='true' data-id='${item.id}'>
|
|
1185
|
+
<div id='${item.id}_item' class='websy-dragdrop-item ${(item.classes || []).join(' ')}' draggable='true' data-id='${item.id}'>
|
|
1182
1186
|
<div id='${item.id}_itemInner' class='websy-dragdrop-item-inner' data-id='${item.id}'>
|
|
1183
1187
|
`
|
|
1184
1188
|
if (item.component) {
|
|
@@ -1207,24 +1211,27 @@ class WebsyDragDrop {
|
|
|
1207
1211
|
}
|
|
1208
1212
|
handleDragStart (event) {
|
|
1209
1213
|
this.draggedId = event.target.getAttribute('data-id')
|
|
1210
|
-
event.dataTransfer.effectAllowed = 'move'
|
|
1211
|
-
event.dataTransfer.setData(
|
|
1212
|
-
|
|
1213
|
-
event.target.style.opacity = 0.5
|
|
1214
|
+
event.dataTransfer.effectAllowed = 'move'
|
|
1215
|
+
event.dataTransfer.setData(this.options.accepts, JSON.stringify({el: event.target.id, id: this.elementId, itemId: this.draggedId}))
|
|
1216
|
+
event.target.classList.add('dragging')
|
|
1217
|
+
// event.target.style.opacity = 0.5
|
|
1214
1218
|
this.dragging = true
|
|
1215
1219
|
}
|
|
1216
|
-
handleDragOver (event) {
|
|
1217
|
-
console.log('drag over', event.target.classList)
|
|
1220
|
+
handleDragOver (event) {
|
|
1218
1221
|
if (event.preventDefault) {
|
|
1219
1222
|
event.preventDefault()
|
|
1220
1223
|
}
|
|
1224
|
+
console.log('drag', event.target.classList)
|
|
1221
1225
|
if (!event.target.classList.contains('droppable')) {
|
|
1222
1226
|
return
|
|
1223
1227
|
}
|
|
1228
|
+
if (event.dataTransfer.types.indexOf(this.options.accepts) === -1) {
|
|
1229
|
+
return
|
|
1230
|
+
}
|
|
1224
1231
|
event.target.classList.add('drag-over')
|
|
1225
1232
|
}
|
|
1226
1233
|
handleDragLeave (event) {
|
|
1227
|
-
console.log('drag leave', event.target.classList)
|
|
1234
|
+
// console.log('drag leave', event.target.classList)
|
|
1228
1235
|
if (!event.target.classList.contains('droppable')) {
|
|
1229
1236
|
return
|
|
1230
1237
|
}
|
|
@@ -1235,15 +1242,18 @@ class WebsyDragDrop {
|
|
|
1235
1242
|
// this.removeExpandedDrop(side, id, droppedItem)
|
|
1236
1243
|
}
|
|
1237
1244
|
handleDrop (event) {
|
|
1238
|
-
console.log('drag drop')
|
|
1239
|
-
console.log(event.dataTransfer.getData('application/wd-item'))
|
|
1240
|
-
const data = JSON.parse(event.dataTransfer.getData(
|
|
1245
|
+
// console.log('drag drop')
|
|
1246
|
+
// console.log(event.dataTransfer.getData('application/wd-item'))
|
|
1247
|
+
const data = JSON.parse(event.dataTransfer.getData(this.options.accepts))
|
|
1241
1248
|
if (event.preventDefault) {
|
|
1242
1249
|
event.preventDefault()
|
|
1243
1250
|
}
|
|
1244
1251
|
if (!event.target.classList.contains('droppable')) {
|
|
1245
1252
|
return
|
|
1246
1253
|
}
|
|
1254
|
+
if (event.dataTransfer.types.indexOf(this.options.accepts) === -1) {
|
|
1255
|
+
return
|
|
1256
|
+
}
|
|
1247
1257
|
let side = event.target.getAttribute('data-side')
|
|
1248
1258
|
let id = event.target.getAttribute('data-id')
|
|
1249
1259
|
let index = this.getItemIndex(id)
|
|
@@ -1253,7 +1263,7 @@ class WebsyDragDrop {
|
|
|
1253
1263
|
index += 1
|
|
1254
1264
|
}
|
|
1255
1265
|
if (draggedIndex === -1) {
|
|
1256
|
-
console.log('requestForDDItem')
|
|
1266
|
+
// console.log('requestForDDItem')
|
|
1257
1267
|
GlobalPubSub.publish(data.id, 'requestForDDItem', {
|
|
1258
1268
|
group: this.options.group,
|
|
1259
1269
|
source: data.id,
|
|
@@ -1291,8 +1301,9 @@ class WebsyDragDrop {
|
|
|
1291
1301
|
}
|
|
1292
1302
|
}
|
|
1293
1303
|
handleDragEnd (event) {
|
|
1294
|
-
console.log('drag end')
|
|
1304
|
+
// console.log('drag end')
|
|
1295
1305
|
event.target.style.opacity = 1
|
|
1306
|
+
event.target.classList.remove('dragging')
|
|
1296
1307
|
this.draggedId = null
|
|
1297
1308
|
this.dragging = false
|
|
1298
1309
|
const startEl = document.getElementById(`${this.elementId}start_item`)
|
|
@@ -1497,6 +1508,7 @@ class WebsyDropdown {
|
|
|
1497
1508
|
if (typeof d.index === 'undefined') {
|
|
1498
1509
|
d.index = i
|
|
1499
1510
|
}
|
|
1511
|
+
d.currentIndex = i
|
|
1500
1512
|
return d
|
|
1501
1513
|
})
|
|
1502
1514
|
const headerEl = document.getElementById(`${this.elementId}_header`)
|
|
@@ -1504,15 +1516,17 @@ class WebsyDropdown {
|
|
|
1504
1516
|
headerEl.classList[`${this.options.allowClear === true ? 'add' : 'remove'}`]('allow-clear')
|
|
1505
1517
|
}
|
|
1506
1518
|
const el = document.getElementById(`${this.elementId}_items`)
|
|
1507
|
-
if (el
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
else {
|
|
1511
|
-
if (this.options.items.length === 0) {
|
|
1512
|
-
this.options.items = [{label: this.options.noItemsText || 'No Items'}]
|
|
1519
|
+
if (el) {
|
|
1520
|
+
if (el.childElementCount === 0) {
|
|
1521
|
+
this.render()
|
|
1513
1522
|
}
|
|
1514
|
-
|
|
1515
|
-
|
|
1523
|
+
else {
|
|
1524
|
+
if (this.options.items.length === 0) {
|
|
1525
|
+
this.options.items = [{label: this.options.noItemsText || 'No Items'}]
|
|
1526
|
+
}
|
|
1527
|
+
this.renderItems()
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1516
1530
|
}
|
|
1517
1531
|
get data () {
|
|
1518
1532
|
return this.options.items
|
|
@@ -1753,6 +1767,10 @@ class WebsyDropdown {
|
|
|
1753
1767
|
const labelEl = document.getElementById(`${this.elementId}_selectedItems`)
|
|
1754
1768
|
const inputEl = document.getElementById(`${this.elementId}_input`)
|
|
1755
1769
|
const itemEls = el.querySelectorAll(`.websy-dropdown-item`)
|
|
1770
|
+
let dataToUse = this._originalData
|
|
1771
|
+
if (this.options.onSearch) {
|
|
1772
|
+
dataToUse = this.options.items
|
|
1773
|
+
}
|
|
1756
1774
|
for (let i = 0; i < itemEls.length; i++) {
|
|
1757
1775
|
itemEls[i].classList.remove('active')
|
|
1758
1776
|
let index = itemEls[i].getAttribute('data-index')
|
|
@@ -1788,14 +1806,14 @@ class WebsyDropdown {
|
|
|
1788
1806
|
}
|
|
1789
1807
|
else if (this.selectedItems.length > 1) {
|
|
1790
1808
|
if (this.options.showCompleteSelectedList === true) {
|
|
1791
|
-
let selectedLabels = this.selectedItems.map(s =>
|
|
1792
|
-
let selectedValues = this.selectedItems.map(s =>
|
|
1809
|
+
let selectedLabels = this.selectedItems.map(s => dataToUse[s].label || dataToUse[s].value).join(this.options.multiValueDelimiter)
|
|
1810
|
+
let selectedValues = this.selectedItems.map(s => dataToUse[s].value || dataToUse[s].label).join(this.options.multiValueDelimiter)
|
|
1793
1811
|
labelEl.innerHTML = selectedLabels
|
|
1794
1812
|
labelEl.setAttribute('data-info', selectedLabels)
|
|
1795
1813
|
inputEl.value = selectedValues
|
|
1796
1814
|
}
|
|
1797
1815
|
else {
|
|
1798
|
-
let selectedValues = this.selectedItems.map(s =>
|
|
1816
|
+
let selectedValues = this.selectedItems.map(s => dataToUse[s].value || dataToUse[s].label).join(this.options.multiValueDelimiter)
|
|
1799
1817
|
labelEl.innerHTML = `${this.selectedItems.length} selected`
|
|
1800
1818
|
labelEl.setAttribute('data-info', '')
|
|
1801
1819
|
inputEl.value = selectedValues
|
|
@@ -1809,6 +1827,10 @@ class WebsyDropdown {
|
|
|
1809
1827
|
}
|
|
1810
1828
|
}
|
|
1811
1829
|
updateSelected (index) {
|
|
1830
|
+
let dataToUse = this._originalData && this._originalData.length > 0 ? this._originalData : this.options.items
|
|
1831
|
+
if (this.options.onSearch) {
|
|
1832
|
+
dataToUse = this.options.items
|
|
1833
|
+
}
|
|
1812
1834
|
if (typeof index !== 'undefined' && index !== null) {
|
|
1813
1835
|
let pos = this.selectedItems.indexOf(index)
|
|
1814
1836
|
if (this.options.multiSelect === false) {
|
|
@@ -1824,10 +1846,10 @@ class WebsyDropdown {
|
|
|
1824
1846
|
}
|
|
1825
1847
|
}
|
|
1826
1848
|
// const item = this.options.items[index]
|
|
1827
|
-
const item =
|
|
1849
|
+
const item = dataToUse[index]
|
|
1828
1850
|
this.updateHeader(item)
|
|
1829
1851
|
if (item && this.options.onItemSelected) {
|
|
1830
|
-
this.options.onItemSelected(item, this.selectedItems,
|
|
1852
|
+
this.options.onItemSelected(item, this.selectedItems, dataToUse, this.options)
|
|
1831
1853
|
}
|
|
1832
1854
|
if (this.options.closeAfterSelection === true) {
|
|
1833
1855
|
this.close()
|
|
@@ -2755,9 +2777,9 @@ class WebsyPubSub {
|
|
|
2755
2777
|
}
|
|
2756
2778
|
}
|
|
2757
2779
|
else {
|
|
2758
|
-
if (this.subscriptions[
|
|
2759
|
-
this.subscriptions[
|
|
2760
|
-
fn(
|
|
2780
|
+
if (this.subscriptions[id]) {
|
|
2781
|
+
this.subscriptions[id].forEach(fn => {
|
|
2782
|
+
fn(method)
|
|
2761
2783
|
})
|
|
2762
2784
|
}
|
|
2763
2785
|
}
|
|
@@ -2772,10 +2794,10 @@ class WebsyPubSub {
|
|
|
2772
2794
|
}
|
|
2773
2795
|
}
|
|
2774
2796
|
else {
|
|
2775
|
-
if (!this.subscriptions[
|
|
2776
|
-
this.subscriptions[
|
|
2797
|
+
if (!this.subscriptions[id]) {
|
|
2798
|
+
this.subscriptions[id] = []
|
|
2777
2799
|
}
|
|
2778
|
-
this.subscriptions[
|
|
2800
|
+
this.subscriptions[id].push(method)
|
|
2779
2801
|
}
|
|
2780
2802
|
}
|
|
2781
2803
|
}
|
|
@@ -3997,6 +4019,7 @@ const WebsyUtils = {
|
|
|
3997
4019
|
let red = 0
|
|
3998
4020
|
let green = 0
|
|
3999
4021
|
let blue = 0
|
|
4022
|
+
let alpha = 1
|
|
4000
4023
|
if (backgroundColor.indexOf('#') !== -1) {
|
|
4001
4024
|
// hex color
|
|
4002
4025
|
backgroundColor = backgroundColor.replace('#', '')
|
|
@@ -4008,13 +4031,15 @@ const WebsyUtils = {
|
|
|
4008
4031
|
}
|
|
4009
4032
|
else if (backgroundColor.toLowerCase().indexOf('rgb') !== -1) {
|
|
4010
4033
|
// rgb color
|
|
4011
|
-
colorParts = backgroundColor.replace(/
|
|
4034
|
+
colorParts = backgroundColor.replace(/rgba\(/gi, '').replace(/\)/gi, '')
|
|
4035
|
+
colorParts = colorParts.replace(/rgb\(/gi, '')
|
|
4012
4036
|
colorParts = colorParts.split(',')
|
|
4013
4037
|
red = colorParts[0]
|
|
4014
4038
|
green = colorParts[1]
|
|
4015
4039
|
blue = colorParts[2]
|
|
4040
|
+
alpha = colorParts[3] || 1
|
|
4016
4041
|
}
|
|
4017
|
-
return (red * 0.299 + green * 0.587 + blue * 0.114) > 186 ? darkColor : lightColor
|
|
4042
|
+
return ((red * 0.299 + green * 0.587 + blue * 0.114) / alpha) > 186 ? darkColor : lightColor
|
|
4018
4043
|
},
|
|
4019
4044
|
measureText (text, rotation = 0, fontSize = '12px') {
|
|
4020
4045
|
if (!isNaN(fontSize)) {
|
|
@@ -4464,8 +4489,15 @@ class WebsyTable {
|
|
|
4464
4489
|
}
|
|
4465
4490
|
let headHTML = '<tr>' + this.options.columns.map((c, i) => {
|
|
4466
4491
|
if (c.show !== false) {
|
|
4492
|
+
let style = ''
|
|
4493
|
+
if (c.style) {
|
|
4494
|
+
style += c.style
|
|
4495
|
+
}
|
|
4496
|
+
if (c.width) {
|
|
4497
|
+
style += `width: ${(c.width || 'auto')};`
|
|
4498
|
+
}
|
|
4467
4499
|
return `
|
|
4468
|
-
<th ${
|
|
4500
|
+
<th style="${style}">
|
|
4469
4501
|
<div class ="tableHeader">
|
|
4470
4502
|
<div class="leftSection">
|
|
4471
4503
|
<div
|
|
@@ -5140,7 +5172,8 @@ class WebsyTable3 {
|
|
|
5140
5172
|
showTotalsAbove: true,
|
|
5141
5173
|
minHandleSize: 20,
|
|
5142
5174
|
maxColWidth: '50%',
|
|
5143
|
-
allowPivoting: false
|
|
5175
|
+
allowPivoting: false,
|
|
5176
|
+
searchIcon: `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 512 512"><title>ionicons-v5-f</title><path d="M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z" style="fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px"/><line x1="338.29" y1="338.29" x2="448" y2="448" style="fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px"/></svg>`
|
|
5144
5177
|
}
|
|
5145
5178
|
this.options = Object.assign({}, DEFAULTS, options)
|
|
5146
5179
|
this.sizes = {}
|
|
@@ -5251,9 +5284,29 @@ class WebsyTable3 {
|
|
|
5251
5284
|
data.forEach(row => {
|
|
5252
5285
|
bodyHtml += `<tr class="websy-table-row">`
|
|
5253
5286
|
row.forEach((cell, cellIndex) => {
|
|
5287
|
+
if (typeof sizingColumns[cellIndex] === 'undefined') {
|
|
5288
|
+
return // need to revisit this logic
|
|
5289
|
+
}
|
|
5290
|
+
let style = ''
|
|
5291
|
+
if (cell.style) {
|
|
5292
|
+
style += cell.style
|
|
5293
|
+
}
|
|
5294
|
+
if (useWidths === true) {
|
|
5295
|
+
style += `max-width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important;`
|
|
5296
|
+
}
|
|
5297
|
+
if (cell.backgroundColor) {
|
|
5298
|
+
style += `background-color: ${cell.backgroundColor}; `
|
|
5299
|
+
if (!cell.color) {
|
|
5300
|
+
style += `color: ${WebsyDesigns.Utils.getLightDark(cell.backgroundColor)}; `
|
|
5301
|
+
}
|
|
5302
|
+
}
|
|
5303
|
+
if (cell.color) {
|
|
5304
|
+
style += `color: ${cell.color}; `
|
|
5305
|
+
}
|
|
5306
|
+
console.log('rowspan', cell.rowspan)
|
|
5254
5307
|
bodyHtml += `<td
|
|
5255
|
-
class='websy-table-cell'
|
|
5256
|
-
style='${
|
|
5308
|
+
class='websy-table-cell ${(cell.classes || []).join(' ')}'
|
|
5309
|
+
style='${style}'
|
|
5257
5310
|
data-info='${cell.value}'
|
|
5258
5311
|
colspan='${cell.colspan || 1}'
|
|
5259
5312
|
rowspan='${cell.rowspan || 1}'
|
|
@@ -5292,7 +5345,7 @@ class WebsyTable3 {
|
|
|
5292
5345
|
return
|
|
5293
5346
|
}
|
|
5294
5347
|
headerHtml += `<tr class="websy-table-row websy-table-header-row">`
|
|
5295
|
-
row.forEach(col => {
|
|
5348
|
+
row.forEach((col, colIndex) => {
|
|
5296
5349
|
headerHtml += `<td
|
|
5297
5350
|
class='websy-table-cell'
|
|
5298
5351
|
style='${col.style}'
|
|
@@ -5307,13 +5360,35 @@ class WebsyTable3 {
|
|
|
5307
5360
|
// }
|
|
5308
5361
|
headerHtml += `
|
|
5309
5362
|
>
|
|
5310
|
-
|
|
5363
|
+
<div>
|
|
5364
|
+
${col.name}
|
|
5365
|
+
${col.searchable === true ? this.buildSearchIcon(col, colIndex) : ''}
|
|
5366
|
+
</div>
|
|
5311
5367
|
</td>`
|
|
5312
5368
|
})
|
|
5313
5369
|
headerHtml += `</tr>`
|
|
5314
5370
|
})
|
|
5371
|
+
const dropdownEl = document.getElementById(`${this.elementId}_dropdownContainer`)
|
|
5372
|
+
this.options.columns[this.options.columns.length - 1].forEach((c, i) => {
|
|
5373
|
+
if (c.searchable && c.isExternalSearch === true) {
|
|
5374
|
+
const testEl = document.getElementById(`${this.elementId}_columnSearch_${c.dimId || i}`)
|
|
5375
|
+
if (!testEl) {
|
|
5376
|
+
const newE = document.createElement('div')
|
|
5377
|
+
newE.id = `${this.elementId}_columnSearch_${c.dimId || i}`
|
|
5378
|
+
newE.className = 'websy-modal-dropdown'
|
|
5379
|
+
dropdownEl.appendChild(newE)
|
|
5380
|
+
}
|
|
5381
|
+
}
|
|
5382
|
+
})
|
|
5315
5383
|
return headerHtml
|
|
5316
5384
|
}
|
|
5385
|
+
buildSearchIcon (col, index) {
|
|
5386
|
+
return `
|
|
5387
|
+
<div class="websy-table-search-icon" data-col-id="${col.dimId}" data-col-index="${index}">
|
|
5388
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 512 512"><title>ionicons-v5-f</title><path d="M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z" style="fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px"/><line x1="338.29" y1="338.29" x2="448" y2="448" style="fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px"/></svg>
|
|
5389
|
+
</div>
|
|
5390
|
+
`
|
|
5391
|
+
}
|
|
5317
5392
|
buildTotalHtml (useWidths = false) {
|
|
5318
5393
|
if (!this.options.totals) {
|
|
5319
5394
|
return ''
|
|
@@ -5389,11 +5464,13 @@ class WebsyTable3 {
|
|
|
5389
5464
|
}
|
|
5390
5465
|
})
|
|
5391
5466
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce((a, b) => a + (b.width || b.actualWidth), 0)
|
|
5467
|
+
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter((c, i) => i >= this.pinnedColumns).reduce((a, b) => a + (b.width || b.actualWidth), 0)
|
|
5392
5468
|
const outerSize = outerEl.getBoundingClientRect()
|
|
5393
5469
|
if (this.sizes.totalWidth < outerSize.width) {
|
|
5394
5470
|
this.sizes.totalWidth = 0
|
|
5471
|
+
this.sizes.totalNonPinnedWidth = 0
|
|
5395
5472
|
let equalWidth = outerSize.width / this.options.columns[this.options.columns.length - 1].length
|
|
5396
|
-
this.options.columns[this.options.columns.length - 1].forEach((c, i) => {
|
|
5473
|
+
this.options.columns[this.options.columns.length - 1].forEach((c, i) => {
|
|
5397
5474
|
if (!c.width) {
|
|
5398
5475
|
if (c.actualWidth < equalWidth) {
|
|
5399
5476
|
// adjust the width
|
|
@@ -5401,6 +5478,9 @@ class WebsyTable3 {
|
|
|
5401
5478
|
}
|
|
5402
5479
|
}
|
|
5403
5480
|
this.sizes.totalWidth += c.width || c.actualWidth
|
|
5481
|
+
if (i < this.pinnedColumns) {
|
|
5482
|
+
this.sizes.totalNonPinnedWidth += c.width || c.actualWidth
|
|
5483
|
+
}
|
|
5404
5484
|
equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
5405
5485
|
})
|
|
5406
5486
|
}
|
|
@@ -5421,9 +5501,15 @@ class WebsyTable3 {
|
|
|
5421
5501
|
if (this.sizes.rowsToRender < this.totalRowCount) {
|
|
5422
5502
|
this.vScrollRequired = true
|
|
5423
5503
|
}
|
|
5504
|
+
else {
|
|
5505
|
+
this.vScrollRequired = false
|
|
5506
|
+
}
|
|
5424
5507
|
if (this.sizes.totalWidth > this.sizes.outer.width) {
|
|
5425
5508
|
this.hScrollRequired = true
|
|
5426
5509
|
}
|
|
5510
|
+
else {
|
|
5511
|
+
this.hScrollRequired = false
|
|
5512
|
+
}
|
|
5427
5513
|
this.options.allColumns = this.options.columns.map(c => c)
|
|
5428
5514
|
console.log('sizes', this.sizes)
|
|
5429
5515
|
return this.sizes
|
|
@@ -5450,7 +5536,13 @@ class WebsyTable3 {
|
|
|
5450
5536
|
return output
|
|
5451
5537
|
}
|
|
5452
5538
|
handleClick (event) {
|
|
5453
|
-
|
|
5539
|
+
if (event.target.classList.contains('websy-table-search-icon')) {
|
|
5540
|
+
console.log('clicked on search icon')
|
|
5541
|
+
const colIndex = +event.target.getAttribute('data-col-index')
|
|
5542
|
+
if (this.options.columns[this.options.columns.length - 1][colIndex].onSearch) {
|
|
5543
|
+
this.options.columns[this.options.columns.length - 1][colIndex].onSearch(event, this.options.columns[this.options.columns.length - 1][colIndex])
|
|
5544
|
+
}
|
|
5545
|
+
}
|
|
5454
5546
|
}
|
|
5455
5547
|
handleMouseDown (event) {
|
|
5456
5548
|
if (event.target.classList.contains('websy-scroll-handle-y')) {
|
|
@@ -5547,20 +5639,26 @@ class WebsyTable3 {
|
|
|
5547
5639
|
bodyEl.style.height = `calc(100% - ${this.sizes.header.height}px - ${this.sizes.total.height}px)`
|
|
5548
5640
|
if (this.options.virtualScroll === true) {
|
|
5549
5641
|
// set the scroll element positions
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5642
|
+
let vScrollEl = document.getElementById(`${this.elementId}_vScrollContainer`)
|
|
5643
|
+
let vHandleEl = document.getElementById(`${this.elementId}_vScrollHandle`)
|
|
5644
|
+
if (this.vScrollRequired === true) {
|
|
5553
5645
|
vScrollEl.style.top = `${this.sizes.header.height + this.sizes.total.height}px`
|
|
5554
5646
|
vScrollEl.style.height = `${this.sizes.bodyHeight}px`
|
|
5555
5647
|
vHandleEl.style.height = Math.max(this.options.minHandleSize, this.sizes.bodyHeight * (this.sizes.rowsToRenderPrecise / this.totalRowCount)) + 'px'
|
|
5556
|
-
}
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5648
|
+
}
|
|
5649
|
+
else {
|
|
5650
|
+
vHandleEl.style.height = '0px'
|
|
5651
|
+
}
|
|
5652
|
+
let hScrollEl = document.getElementById(`${this.elementId}_hScrollContainer`)
|
|
5653
|
+
let hHandleEl = document.getElementById(`${this.elementId}_hScrollHandle`)
|
|
5654
|
+
if (this.hScrollRequired === true) {
|
|
5560
5655
|
hScrollEl.style.left = `${this.sizes.table.width - this.sizes.scrollableWidth}px`
|
|
5561
5656
|
hScrollEl.style.width = `${this.sizes.scrollableWidth - 20}px`
|
|
5562
|
-
hHandleEl.style.width = Math.max(this.options.minHandleSize, this.sizes.scrollableWidth * (this.sizes.scrollableWidth / this.sizes.
|
|
5563
|
-
}
|
|
5657
|
+
hHandleEl.style.width = Math.max(this.options.minHandleSize, this.sizes.scrollableWidth * (this.sizes.scrollableWidth / this.sizes.totalNonPinnedWidth)) + 'px'
|
|
5658
|
+
}
|
|
5659
|
+
else {
|
|
5660
|
+
hHandleEl.style.width = '0px'
|
|
5661
|
+
}
|
|
5564
5662
|
}
|
|
5565
5663
|
}
|
|
5566
5664
|
renderColumnHeaders () {
|
|
@@ -5589,9 +5687,7 @@ class WebsyTable3 {
|
|
|
5589
5687
|
const el = document.getElementById(`${this.elementId}_tableContainer`)
|
|
5590
5688
|
if (el) {
|
|
5591
5689
|
el.classList.add('has-error')
|
|
5592
|
-
}
|
|
5593
|
-
const tableEl = document.getElementById(`${this.elementId}_tableInner`)
|
|
5594
|
-
tableEl.classList.add('hidden')
|
|
5690
|
+
}
|
|
5595
5691
|
const containerEl = document.getElementById(`${this.elementId}_errorContainer`)
|
|
5596
5692
|
if (containerEl) {
|
|
5597
5693
|
containerEl.classList.add('active')
|
|
@@ -5610,6 +5706,19 @@ class WebsyTable3 {
|
|
|
5610
5706
|
}
|
|
5611
5707
|
}
|
|
5612
5708
|
scrollX (diff) {
|
|
5709
|
+
const el = document.getElementById(`${this.elementId}_tableContainer`)
|
|
5710
|
+
if (!el.classList.contains('scrolling')) {
|
|
5711
|
+
el.classList.add('scrolling')
|
|
5712
|
+
}
|
|
5713
|
+
if (this.scrollTimeoutFn) {
|
|
5714
|
+
clearTimeout(this.scrollTimeoutFn)
|
|
5715
|
+
}
|
|
5716
|
+
this.scrollTimeoutFn = setTimeout(() => {
|
|
5717
|
+
el.classList.remove('scrolling')
|
|
5718
|
+
}, 200)
|
|
5719
|
+
if (this.hScrollRequired === false) {
|
|
5720
|
+
return
|
|
5721
|
+
}
|
|
5613
5722
|
const scrollContainerEl = document.getElementById(`${this.elementId}_hScrollContainer`)
|
|
5614
5723
|
const scrollHandleEl = document.getElementById(`${this.elementId}_hScrollHandle`)
|
|
5615
5724
|
let handlePos
|
|
@@ -5623,13 +5732,13 @@ class WebsyTable3 {
|
|
|
5623
5732
|
console.log('dragging x', diff, scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width)
|
|
5624
5733
|
scrollHandleEl.style.left = Math.min(scrollableSpace, Math.max(0, handlePos)) + 'px'
|
|
5625
5734
|
if (this.options.onScroll) {
|
|
5626
|
-
let actualLeft = (this.sizes.
|
|
5735
|
+
let actualLeft = (this.sizes.totalNonPinnedWidth - this.sizes.scrollableWidth) * (Math.min(scrollableSpace, Math.max(0, handlePos)) / scrollableSpace)
|
|
5627
5736
|
let cumulativeWidth = 0
|
|
5628
5737
|
this.startCol = 0
|
|
5629
5738
|
this.endCol = 0
|
|
5630
|
-
for (let i =
|
|
5739
|
+
for (let i = this.pinnedColumns; i < this.options.allColumns[this.options.allColumns.length - 1].length; i++) {
|
|
5631
5740
|
cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth
|
|
5632
|
-
console.log(actualLeft, this.sizes.totalWidth, cumulativeWidth, cumulativeWidth + this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth)
|
|
5741
|
+
console.log('actualLeft', actualLeft, this.sizes.totalWidth, cumulativeWidth, cumulativeWidth + this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth)
|
|
5633
5742
|
if (actualLeft < cumulativeWidth) {
|
|
5634
5743
|
this.startCol = i
|
|
5635
5744
|
break
|
|
@@ -5653,6 +5762,19 @@ class WebsyTable3 {
|
|
|
5653
5762
|
}
|
|
5654
5763
|
}
|
|
5655
5764
|
scrollY (diff) {
|
|
5765
|
+
const el = document.getElementById(`${this.elementId}_tableContainer`)
|
|
5766
|
+
if (!el.classList.contains('scrolling')) {
|
|
5767
|
+
el.classList.add('scrolling')
|
|
5768
|
+
}
|
|
5769
|
+
if (this.scrollTimeoutFn) {
|
|
5770
|
+
clearTimeout(this.scrollTimeoutFn)
|
|
5771
|
+
}
|
|
5772
|
+
this.scrollTimeoutFn = setTimeout(() => {
|
|
5773
|
+
el.classList.remove('scrolling')
|
|
5774
|
+
}, 200)
|
|
5775
|
+
if (this.vScrollRequired === false) {
|
|
5776
|
+
return
|
|
5777
|
+
}
|
|
5656
5778
|
const scrollContainerEl = document.getElementById(`${this.elementId}_vScrollContainer`)
|
|
5657
5779
|
const scrollHandleEl = document.getElementById(`${this.elementId}_vScrollHandle`)
|
|
5658
5780
|
let handlePos
|
|
@@ -6604,7 +6726,7 @@ bars
|
|
|
6604
6726
|
.attr('x', getBarX.bind(this))
|
|
6605
6727
|
.attr('y', getBarY.bind(this))
|
|
6606
6728
|
.transition(this.transition)
|
|
6607
|
-
.attr('fill', d => d.color || series.color)
|
|
6729
|
+
.attr('fill', d => d.y.color || d.color || series.color)
|
|
6608
6730
|
|
|
6609
6731
|
bars
|
|
6610
6732
|
.enter()
|
|
@@ -6614,7 +6736,7 @@ bars
|
|
|
6614
6736
|
.attr('x', getBarX.bind(this))
|
|
6615
6737
|
.attr('y', getBarY.bind(this))
|
|
6616
6738
|
// .transition(this.transition)
|
|
6617
|
-
.attr('fill', d => d.color || series.color)
|
|
6739
|
+
.attr('fill', d => d.y.color || d.color || series.color)
|
|
6618
6740
|
.attr('class', d => {
|
|
6619
6741
|
return `bar bar_${series.key}`
|
|
6620
6742
|
})
|
|
@@ -6629,7 +6751,7 @@ if (this.options.orientation === 'horizontal') {
|
|
|
6629
6751
|
xAxis = 'leftAxis'
|
|
6630
6752
|
yAxis = 'bottomAxis'
|
|
6631
6753
|
}
|
|
6632
|
-
if (this.options.showLabels) {
|
|
6754
|
+
if (this.options.showLabels === true || series.showLabels === true) {
|
|
6633
6755
|
// need to add logic to handle positioning options
|
|
6634
6756
|
// e.g. Inside, Outide, Auto (this will also affect the available plot space)
|
|
6635
6757
|
// We currently only support 'Auto'
|
|
@@ -6643,10 +6765,30 @@ if (this.options.showLabels) {
|
|
|
6643
6765
|
.attr('x', getLabelX.bind(this))
|
|
6644
6766
|
.attr('y', getLabelY.bind(this))
|
|
6645
6767
|
.attr('class', `label_${series.key}`)
|
|
6646
|
-
.
|
|
6647
|
-
.style('
|
|
6768
|
+
.attr('fill', d => this.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
|
|
6769
|
+
.style('font-size', `${this.options.labelSize || this.options.fontSize}px`)
|
|
6648
6770
|
.transition(this.transition)
|
|
6649
6771
|
.text(d => d.y.label || d.y.value)
|
|
6772
|
+
.each(function (d, i) {
|
|
6773
|
+
if (that.options.orientation === 'horizontal') {
|
|
6774
|
+
if (that.options.grouping === 'stacked') {
|
|
6775
|
+
this.setAttribute('text-anchor', 'middle')
|
|
6776
|
+
}
|
|
6777
|
+
else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
|
|
6778
|
+
this.setAttribute('text-anchor', 'end')
|
|
6779
|
+
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
6780
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
|
|
6781
|
+
}
|
|
6782
|
+
else {
|
|
6783
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
|
|
6784
|
+
}
|
|
6785
|
+
}
|
|
6786
|
+
else {
|
|
6787
|
+
if (that.plotheight - getLabelX.call(that, d) < (that.options.labelSize || that.options.fontSize)) {
|
|
6788
|
+
this.setAttribute('y', +(this.getAttribute('y')) + 8)
|
|
6789
|
+
}
|
|
6790
|
+
}
|
|
6791
|
+
})
|
|
6650
6792
|
|
|
6651
6793
|
labels
|
|
6652
6794
|
.enter()
|
|
@@ -6656,8 +6798,8 @@ if (this.options.showLabels) {
|
|
|
6656
6798
|
.attr('y', getLabelY.bind(this))
|
|
6657
6799
|
.attr('alignment-baseline', 'central')
|
|
6658
6800
|
.attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle')
|
|
6659
|
-
.
|
|
6660
|
-
.style('
|
|
6801
|
+
.attr('fill', d => this.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
|
|
6802
|
+
.style('font-size', `${this.options.labelSize || this.options.fontSize}px`)
|
|
6661
6803
|
.text(d => d.y.label || d.y.value)
|
|
6662
6804
|
.each(function (d, i) {
|
|
6663
6805
|
if (that.options.orientation === 'horizontal') {
|
|
@@ -6666,8 +6808,12 @@ if (this.options.showLabels) {
|
|
|
6666
6808
|
}
|
|
6667
6809
|
else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
|
|
6668
6810
|
this.setAttribute('text-anchor', 'end')
|
|
6669
|
-
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
6811
|
+
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
6812
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
|
|
6670
6813
|
}
|
|
6814
|
+
else {
|
|
6815
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
|
|
6816
|
+
}
|
|
6671
6817
|
}
|
|
6672
6818
|
else {
|
|
6673
6819
|
if (that.plotheight - getLabelX.call(that, d) < (that.options.labelSize || that.options.fontSize)) {
|