@websy/websy-designs 1.3.1 → 1.3.3
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/pdfHelper.js +13 -4
- package/dist/server/routes/v1/shop.js +2 -1
- package/dist/websy-designs-es6.debug.js +78 -19
- package/dist/websy-designs-es6.js +86 -13
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +79 -20
- package/dist/websy-designs.js +87 -14
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -737,8 +737,9 @@ class WebsyDatePicker {
|
|
|
737
737
|
let rangeEnd
|
|
738
738
|
if (this.options.mode === 'date') {
|
|
739
739
|
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + (i * this.oneDay)))
|
|
740
|
-
d.setUTCHours(12, 0, 0, 0)
|
|
740
|
+
// d.setUTCHours(12, 0, 0, 0)
|
|
741
741
|
d = d.getTime()
|
|
742
|
+
// console.log('highlighting', this.selectedRangeDates[0].getTime(), d)
|
|
742
743
|
rangeStart = this.selectedRangeDates[0].getTime()
|
|
743
744
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime()
|
|
744
745
|
}
|
|
@@ -747,8 +748,10 @@ class WebsyDatePicker {
|
|
|
747
748
|
rangeStart = this.selectedRangeDates[0]
|
|
748
749
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1]
|
|
749
750
|
}
|
|
750
|
-
else if (this.options.mode === 'monthyear') {
|
|
751
|
-
d = new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + i)
|
|
751
|
+
else if (this.options.mode === 'monthyear') {
|
|
752
|
+
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + i))
|
|
753
|
+
d = d.getTime()
|
|
754
|
+
console.log('highlighting', this.selectedRangeDates[0].getTime(), d)
|
|
752
755
|
rangeStart = this.selectedRangeDates[0].getTime()
|
|
753
756
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime()
|
|
754
757
|
}
|
|
@@ -3307,6 +3310,7 @@ class WebsyResultList {
|
|
|
3307
3310
|
this.rows = []
|
|
3308
3311
|
this.apiService = new WebsyDesigns.APIService('/api')
|
|
3309
3312
|
this.templateService = new WebsyDesigns.APIService('')
|
|
3313
|
+
this.activeTemplate = ''
|
|
3310
3314
|
if (!elementId) {
|
|
3311
3315
|
console.log('No element Id provided for Websy Search List')
|
|
3312
3316
|
return
|
|
@@ -3328,16 +3332,17 @@ class WebsyResultList {
|
|
|
3328
3332
|
appendData (d) {
|
|
3329
3333
|
let startIndex = this.rows.length
|
|
3330
3334
|
this.rows = this.rows.concat(d)
|
|
3335
|
+
this.activeTemplate = this.options.template
|
|
3331
3336
|
const html = this.buildHTML(d, startIndex)
|
|
3332
3337
|
const el = document.getElementById(this.elementId)
|
|
3333
3338
|
el.innerHTML += html.replace(/\n/g, '')
|
|
3334
3339
|
}
|
|
3335
|
-
buildHTML (d, startIndex = 0) {
|
|
3340
|
+
buildHTML (d, startIndex = 0, inputTemplate) {
|
|
3336
3341
|
let html = ``
|
|
3337
3342
|
if (this.options.template) {
|
|
3338
3343
|
if (d.length > 0) {
|
|
3339
3344
|
d.forEach((row, ix) => {
|
|
3340
|
-
let template = `${ix > 0 ? '-->' : ''}${this.options.template}${ix < d.length - 1 ? '<!--' : ''}`
|
|
3345
|
+
let template = `${ix > 0 ? '-->' : ''}${inputTemplate || this.options.template}${ix < d.length - 1 ? '<!--' : ''}`
|
|
3341
3346
|
// find conditional elements
|
|
3342
3347
|
let ifMatches = [...template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g)]
|
|
3343
3348
|
ifMatches.forEach(m => {
|
|
@@ -3416,16 +3421,39 @@ class WebsyResultList {
|
|
|
3416
3421
|
}
|
|
3417
3422
|
}
|
|
3418
3423
|
})
|
|
3424
|
+
let forMatches = [...template.matchAll(/<\s*for[^>]*>([\s\S]*?)<\s*\/\s*for>/g)]
|
|
3425
|
+
forMatches.forEach(m => {
|
|
3426
|
+
let itemsMatch = m[0].match(/(items=["|']\w.+)["|']/g)
|
|
3427
|
+
let forMarkup = m[0].match(/<\s*for[^>]*>/)
|
|
3428
|
+
let withoutFor = m[0].replace(forMarkup, '').replace('</for>', '').replace(/<\s*for[^>]*>/g, '')
|
|
3429
|
+
if (itemsMatch && itemsMatch[0]) {
|
|
3430
|
+
let c = itemsMatch[0].trim().replace('items=', '')
|
|
3431
|
+
if (c.split('')[0] === '"') {
|
|
3432
|
+
c = c.replace(/"/g, '')
|
|
3433
|
+
}
|
|
3434
|
+
else if (c.split('')[0] === '\'') {
|
|
3435
|
+
c = c.replace(/'/g, '')
|
|
3436
|
+
}
|
|
3437
|
+
let items = row
|
|
3438
|
+
let parts = c.split('.')
|
|
3439
|
+
parts.forEach(p => {
|
|
3440
|
+
items = items[p]
|
|
3441
|
+
})
|
|
3442
|
+
template = template.replace(m[0], this.buildHTML(items, 0, withoutFor))
|
|
3443
|
+
}
|
|
3444
|
+
})
|
|
3419
3445
|
let tagMatches = [...template.matchAll(/(\sdata-event=["|']\w.+)["|']/g)]
|
|
3420
3446
|
tagMatches.forEach(m => {
|
|
3421
3447
|
if (m[0] && m.index > -1) {
|
|
3422
3448
|
template = template.replace(m[0], `${m[0]} data-id=${startIndex + ix}`)
|
|
3423
3449
|
}
|
|
3424
|
-
})
|
|
3425
|
-
|
|
3450
|
+
})
|
|
3451
|
+
let flatRow = this.flattenObject(row)
|
|
3452
|
+
for (let key in flatRow) {
|
|
3426
3453
|
let rg = new RegExp(`{${key}}`, 'gm')
|
|
3427
|
-
template = template.replace(rg,
|
|
3454
|
+
template = template.replace(rg, flatRow[key] || '')
|
|
3428
3455
|
}
|
|
3456
|
+
template = template.replace(/\{(.*?)\}/g, '')
|
|
3429
3457
|
html += template
|
|
3430
3458
|
})
|
|
3431
3459
|
}
|
|
@@ -3450,6 +3478,27 @@ class WebsyResultList {
|
|
|
3450
3478
|
}
|
|
3451
3479
|
return null
|
|
3452
3480
|
}
|
|
3481
|
+
flattenObject (obj) {
|
|
3482
|
+
const toReturn = {}
|
|
3483
|
+
for (const i in obj) {
|
|
3484
|
+
if (!obj.hasOwnProperty(i)) {
|
|
3485
|
+
continue
|
|
3486
|
+
}
|
|
3487
|
+
if (typeof obj[i] === 'object') {
|
|
3488
|
+
const flatObject = this.flattenObject(obj[i])
|
|
3489
|
+
for (const x in flatObject) {
|
|
3490
|
+
if (!flatObject.hasOwnProperty(x)) {
|
|
3491
|
+
continue
|
|
3492
|
+
}
|
|
3493
|
+
toReturn[i + '.' + x] = flatObject[x]
|
|
3494
|
+
}
|
|
3495
|
+
}
|
|
3496
|
+
else {
|
|
3497
|
+
toReturn[i] = obj[i]
|
|
3498
|
+
}
|
|
3499
|
+
}
|
|
3500
|
+
return JSON.parse(JSON.stringify(toReturn))
|
|
3501
|
+
}
|
|
3453
3502
|
handleClick (event) {
|
|
3454
3503
|
if (event.target.classList.contains('clickable')) {
|
|
3455
3504
|
let l = event.target.getAttribute('data-event')
|
|
@@ -3535,7 +3584,7 @@ class WebsyRouter {
|
|
|
3535
3584
|
if (this.options.onHide) {
|
|
3536
3585
|
this.on('hide', this.options.onHide)
|
|
3537
3586
|
}
|
|
3538
|
-
this.init()
|
|
3587
|
+
// this.init()
|
|
3539
3588
|
}
|
|
3540
3589
|
addGroup (group) {
|
|
3541
3590
|
if (!this.groups[group]) {
|
|
@@ -4084,7 +4133,7 @@ class WebsySearch {
|
|
|
4084
4133
|
}, this.options.searchTimeout)
|
|
4085
4134
|
}
|
|
4086
4135
|
else {
|
|
4087
|
-
if (this.options.onSearch) {
|
|
4136
|
+
if (this.options.onSearch && (event.key === 'Delete' || event.key === 'Backspace')) {
|
|
4088
4137
|
this.options.onSearch('')
|
|
4089
4138
|
}
|
|
4090
4139
|
}
|
|
@@ -7119,15 +7168,20 @@ if (this.options.showLabels === true || series.showLabels === true) {
|
|
|
7119
7168
|
.text(d => d.y.label || d.y.value)
|
|
7120
7169
|
.each(function (d, i) {
|
|
7121
7170
|
if (that.options.orientation === 'horizontal') {
|
|
7122
|
-
if (that.options.grouping === 'stacked') {
|
|
7171
|
+
if (that.options.grouping === 'stacked' && series.labelPosition !== 'outside') {
|
|
7123
7172
|
this.setAttribute('text-anchor', 'middle')
|
|
7124
7173
|
}
|
|
7125
7174
|
else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
|
|
7126
7175
|
this.setAttribute('text-anchor', 'end')
|
|
7127
|
-
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
7176
|
+
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
7128
7177
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
|
|
7129
7178
|
}
|
|
7130
|
-
else {
|
|
7179
|
+
else if (series.labelPosition === 'outside') {
|
|
7180
|
+
this.setAttribute('text-anchor', 'start')
|
|
7181
|
+
this.setAttribute('x', +(this.getAttribute('x')) + 8)
|
|
7182
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
|
|
7183
|
+
}
|
|
7184
|
+
else {
|
|
7131
7185
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
|
|
7132
7186
|
}
|
|
7133
7187
|
}
|
|
@@ -7151,15 +7205,20 @@ if (this.options.showLabels === true || series.showLabels === true) {
|
|
|
7151
7205
|
.text(d => d.y.label || d.y.value)
|
|
7152
7206
|
.each(function (d, i) {
|
|
7153
7207
|
if (that.options.orientation === 'horizontal') {
|
|
7154
|
-
if (that.options.grouping === 'stacked') {
|
|
7208
|
+
if (that.options.grouping === 'stacked' && series.labelPosition !== 'outside') {
|
|
7155
7209
|
this.setAttribute('text-anchor', 'middle')
|
|
7156
7210
|
}
|
|
7157
7211
|
else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
|
|
7158
7212
|
this.setAttribute('text-anchor', 'end')
|
|
7159
|
-
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
7213
|
+
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
7160
7214
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
|
|
7161
7215
|
}
|
|
7162
|
-
else {
|
|
7216
|
+
else if (series.labelPosition === 'outside') {
|
|
7217
|
+
this.setAttribute('text-anchor', 'start')
|
|
7218
|
+
this.setAttribute('x', +(this.getAttribute('x')) + 8)
|
|
7219
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
|
|
7220
|
+
}
|
|
7221
|
+
else {
|
|
7163
7222
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
|
|
7164
7223
|
}
|
|
7165
7224
|
}
|
|
@@ -7171,10 +7230,10 @@ if (this.options.showLabels === true || series.showLabels === true) {
|
|
|
7171
7230
|
})
|
|
7172
7231
|
}
|
|
7173
7232
|
|
|
7174
|
-
function getLabelX (d) {
|
|
7233
|
+
function getLabelX (d, labelPosition = 'inside') {
|
|
7175
7234
|
if (this.options.orientation === 'horizontal') {
|
|
7176
7235
|
if (this.options.grouping === 'stacked') {
|
|
7177
|
-
return this[yAxis](d.y.accumulative) + (this[yAxis](d.y.value) / 2)
|
|
7236
|
+
return this[yAxis](d.y.accumulative) + (this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1))
|
|
7178
7237
|
}
|
|
7179
7238
|
else {
|
|
7180
7239
|
return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) + 4
|
|
@@ -7184,13 +7243,13 @@ function getLabelX (d) {
|
|
|
7184
7243
|
return this[xAxis](this.parseX(d.x.value)) + (this[xAxis].bandwidth() / 2)
|
|
7185
7244
|
}
|
|
7186
7245
|
}
|
|
7187
|
-
function getLabelY (d) {
|
|
7246
|
+
function getLabelY (d, labelPosition = 'inside') {
|
|
7188
7247
|
if (this.options.orientation === 'horizontal') {
|
|
7189
7248
|
return this[xAxis](this.parseX(d.x.value)) + (this[xAxis].bandwidth() / 2)
|
|
7190
7249
|
}
|
|
7191
7250
|
else {
|
|
7192
7251
|
if (this.options.grouping === 'stacked') {
|
|
7193
|
-
|
|
7252
|
+
return this[yAxis](d.y.accumulative) + (this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1))
|
|
7194
7253
|
}
|
|
7195
7254
|
else {
|
|
7196
7255
|
return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) - 4
|
package/dist/websy-designs.js
CHANGED
|
@@ -829,9 +829,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
829
829
|
var rangeEnd = void 0;
|
|
830
830
|
|
|
831
831
|
if (this.options.mode === 'date') {
|
|
832
|
-
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + _i * this.oneDay));
|
|
833
|
-
|
|
834
|
-
d = d.getTime();
|
|
832
|
+
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + _i * this.oneDay)); // d.setUTCHours(12, 0, 0, 0)
|
|
833
|
+
|
|
834
|
+
d = d.getTime(); // console.log('highlighting', this.selectedRangeDates[0].getTime(), d)
|
|
835
|
+
|
|
835
836
|
rangeStart = this.selectedRangeDates[0].getTime();
|
|
836
837
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
837
838
|
} else if (this.options.mode === 'year') {
|
|
@@ -839,7 +840,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
839
840
|
rangeStart = this.selectedRangeDates[0];
|
|
840
841
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
|
|
841
842
|
} else if (this.options.mode === 'monthyear') {
|
|
842
|
-
d = new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + _i);
|
|
843
|
+
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + _i));
|
|
844
|
+
d = d.getTime();
|
|
845
|
+
console.log('highlighting', this.selectedRangeDates[0].getTime(), d);
|
|
843
846
|
rangeStart = this.selectedRangeDates[0].getTime();
|
|
844
847
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
845
848
|
} else if (this.options.mode === 'hour') {
|
|
@@ -3625,6 +3628,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3625
3628
|
this.rows = [];
|
|
3626
3629
|
this.apiService = new WebsyDesigns.APIService('/api');
|
|
3627
3630
|
this.templateService = new WebsyDesigns.APIService('');
|
|
3631
|
+
this.activeTemplate = '';
|
|
3628
3632
|
|
|
3629
3633
|
if (!elementId) {
|
|
3630
3634
|
console.log('No element Id provided for Websy Search List');
|
|
@@ -3653,6 +3657,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3653
3657
|
value: function appendData(d) {
|
|
3654
3658
|
var startIndex = this.rows.length;
|
|
3655
3659
|
this.rows = this.rows.concat(d);
|
|
3660
|
+
this.activeTemplate = this.options.template;
|
|
3656
3661
|
var html = this.buildHTML(d, startIndex);
|
|
3657
3662
|
var el = document.getElementById(this.elementId);
|
|
3658
3663
|
el.innerHTML += html.replace(/\n/g, '');
|
|
@@ -3663,12 +3668,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3663
3668
|
var _this23 = this;
|
|
3664
3669
|
|
|
3665
3670
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3671
|
+
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
3666
3672
|
var html = "";
|
|
3667
3673
|
|
|
3668
3674
|
if (this.options.template) {
|
|
3669
3675
|
if (d.length > 0) {
|
|
3670
3676
|
d.forEach(function (row, ix) {
|
|
3671
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(_this23.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
3677
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this23.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
3672
3678
|
|
|
3673
3679
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3674
3680
|
|
|
@@ -3752,6 +3758,31 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3752
3758
|
}
|
|
3753
3759
|
});
|
|
3754
3760
|
|
|
3761
|
+
var forMatches = _toConsumableArray(template.matchAll(/<\s*for[^>]*>([\s\S]*?)<\s*\/\s*for>/g));
|
|
3762
|
+
|
|
3763
|
+
forMatches.forEach(function (m) {
|
|
3764
|
+
var itemsMatch = m[0].match(/(items=["|']\w.+)["|']/g);
|
|
3765
|
+
var forMarkup = m[0].match(/<\s*for[^>]*>/);
|
|
3766
|
+
var withoutFor = m[0].replace(forMarkup, '').replace('</for>', '').replace(/<\s*for[^>]*>/g, '');
|
|
3767
|
+
|
|
3768
|
+
if (itemsMatch && itemsMatch[0]) {
|
|
3769
|
+
var c = itemsMatch[0].trim().replace('items=', '');
|
|
3770
|
+
|
|
3771
|
+
if (c.split('')[0] === '"') {
|
|
3772
|
+
c = c.replace(/"/g, '');
|
|
3773
|
+
} else if (c.split('')[0] === '\'') {
|
|
3774
|
+
c = c.replace(/'/g, '');
|
|
3775
|
+
}
|
|
3776
|
+
|
|
3777
|
+
var items = row;
|
|
3778
|
+
var parts = c.split('.');
|
|
3779
|
+
parts.forEach(function (p) {
|
|
3780
|
+
items = items[p];
|
|
3781
|
+
});
|
|
3782
|
+
template = template.replace(m[0], _this23.buildHTML(items, 0, withoutFor));
|
|
3783
|
+
}
|
|
3784
|
+
});
|
|
3785
|
+
|
|
3755
3786
|
var tagMatches = _toConsumableArray(template.matchAll(/(\sdata-event=["|']\w.+)["|']/g));
|
|
3756
3787
|
|
|
3757
3788
|
tagMatches.forEach(function (m) {
|
|
@@ -3760,11 +3791,14 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3760
3791
|
}
|
|
3761
3792
|
});
|
|
3762
3793
|
|
|
3763
|
-
|
|
3794
|
+
var flatRow = _this23.flattenObject(row);
|
|
3795
|
+
|
|
3796
|
+
for (var key in flatRow) {
|
|
3764
3797
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
3765
|
-
template = template.replace(rg,
|
|
3798
|
+
template = template.replace(rg, flatRow[key] || '');
|
|
3766
3799
|
}
|
|
3767
3800
|
|
|
3801
|
+
template = template.replace(/\{(.*?)\}/g, '');
|
|
3768
3802
|
html += template;
|
|
3769
3803
|
});
|
|
3770
3804
|
} else if (this.options.noRowsHTML) {
|
|
@@ -3785,6 +3819,33 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3785
3819
|
|
|
3786
3820
|
return null;
|
|
3787
3821
|
}
|
|
3822
|
+
}, {
|
|
3823
|
+
key: "flattenObject",
|
|
3824
|
+
value: function flattenObject(obj) {
|
|
3825
|
+
var toReturn = {};
|
|
3826
|
+
|
|
3827
|
+
for (var i in obj) {
|
|
3828
|
+
if (!obj.hasOwnProperty(i)) {
|
|
3829
|
+
continue;
|
|
3830
|
+
}
|
|
3831
|
+
|
|
3832
|
+
if (_typeof(obj[i]) === 'object') {
|
|
3833
|
+
var flatObject = this.flattenObject(obj[i]);
|
|
3834
|
+
|
|
3835
|
+
for (var x in flatObject) {
|
|
3836
|
+
if (!flatObject.hasOwnProperty(x)) {
|
|
3837
|
+
continue;
|
|
3838
|
+
}
|
|
3839
|
+
|
|
3840
|
+
toReturn[i + '.' + x] = flatObject[x];
|
|
3841
|
+
}
|
|
3842
|
+
} else {
|
|
3843
|
+
toReturn[i] = obj[i];
|
|
3844
|
+
}
|
|
3845
|
+
}
|
|
3846
|
+
|
|
3847
|
+
return JSON.parse(JSON.stringify(toReturn));
|
|
3848
|
+
}
|
|
3788
3849
|
}, {
|
|
3789
3850
|
key: "handleClick",
|
|
3790
3851
|
value: function handleClick(event) {
|
|
@@ -3906,9 +3967,8 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3906
3967
|
|
|
3907
3968
|
if (this.options.onHide) {
|
|
3908
3969
|
this.on('hide', this.options.onHide);
|
|
3909
|
-
}
|
|
3970
|
+
} // this.init()
|
|
3910
3971
|
|
|
3911
|
-
this.init();
|
|
3912
3972
|
}
|
|
3913
3973
|
|
|
3914
3974
|
_createClass(WebsyRouter, [{
|
|
@@ -4585,7 +4645,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
4585
4645
|
}
|
|
4586
4646
|
}, this.options.searchTimeout);
|
|
4587
4647
|
} else {
|
|
4588
|
-
if (this.options.onSearch) {
|
|
4648
|
+
if (this.options.onSearch && (event.key === 'Delete' || event.key === 'Backspace')) {
|
|
4589
4649
|
this.options.onSearch('');
|
|
4590
4650
|
}
|
|
4591
4651
|
}
|
|
@@ -7825,12 +7885,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7825
7885
|
return d.y.label || d.y.value;
|
|
7826
7886
|
}).each(function (d, i) {
|
|
7827
7887
|
if (that.options.orientation === 'horizontal') {
|
|
7828
|
-
if (that.options.grouping === 'stacked') {
|
|
7888
|
+
if (that.options.grouping === 'stacked' && series.labelPosition !== 'outside') {
|
|
7829
7889
|
this.setAttribute('text-anchor', 'middle');
|
|
7830
7890
|
} else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
|
|
7831
7891
|
this.setAttribute('text-anchor', 'end');
|
|
7832
7892
|
this.setAttribute('x', +this.getAttribute('x') - 8);
|
|
7833
7893
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
|
|
7894
|
+
} else if (series.labelPosition === 'outside') {
|
|
7895
|
+
this.setAttribute('text-anchor', 'start');
|
|
7896
|
+
this.setAttribute('x', +this.getAttribute('x') + 8);
|
|
7897
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
|
|
7834
7898
|
} else {
|
|
7835
7899
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
|
|
7836
7900
|
}
|
|
@@ -7846,12 +7910,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7846
7910
|
return d.y.label || d.y.value;
|
|
7847
7911
|
}).each(function (d, i) {
|
|
7848
7912
|
if (that.options.orientation === 'horizontal') {
|
|
7849
|
-
if (that.options.grouping === 'stacked') {
|
|
7913
|
+
if (that.options.grouping === 'stacked' && series.labelPosition !== 'outside') {
|
|
7850
7914
|
this.setAttribute('text-anchor', 'middle');
|
|
7851
7915
|
} else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
|
|
7852
7916
|
this.setAttribute('text-anchor', 'end');
|
|
7853
7917
|
this.setAttribute('x', +this.getAttribute('x') - 8);
|
|
7854
7918
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
|
|
7919
|
+
} else if (series.labelPosition === 'outside') {
|
|
7920
|
+
this.setAttribute('text-anchor', 'start');
|
|
7921
|
+
this.setAttribute('x', +this.getAttribute('x') + 8);
|
|
7922
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
|
|
7855
7923
|
} else {
|
|
7856
7924
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
|
|
7857
7925
|
}
|
|
@@ -7864,9 +7932,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7864
7932
|
}
|
|
7865
7933
|
|
|
7866
7934
|
function getLabelX(d) {
|
|
7935
|
+
var labelPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'inside';
|
|
7936
|
+
|
|
7867
7937
|
if (this.options.orientation === 'horizontal') {
|
|
7868
7938
|
if (this.options.grouping === 'stacked') {
|
|
7869
|
-
return this[yAxis](d.y.accumulative) + this[yAxis](d.y.value) / 2;
|
|
7939
|
+
return this[yAxis](d.y.accumulative) + this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1);
|
|
7870
7940
|
} else {
|
|
7871
7941
|
return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) + 4;
|
|
7872
7942
|
}
|
|
@@ -7876,10 +7946,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7876
7946
|
}
|
|
7877
7947
|
|
|
7878
7948
|
function getLabelY(d) {
|
|
7949
|
+
var labelPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'inside';
|
|
7950
|
+
|
|
7879
7951
|
if (this.options.orientation === 'horizontal') {
|
|
7880
7952
|
return this[xAxis](this.parseX(d.x.value)) + this[xAxis].bandwidth() / 2;
|
|
7881
7953
|
} else {
|
|
7882
|
-
if (this.options.grouping === 'stacked') {
|
|
7954
|
+
if (this.options.grouping === 'stacked') {
|
|
7955
|
+
return this[yAxis](d.y.accumulative) + this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1);
|
|
7883
7956
|
} else {
|
|
7884
7957
|
return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) - 4;
|
|
7885
7958
|
}
|