@websy/websy-designs 1.11.0 → 1.11.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/websy-designs-es6.debug.js +107 -26
- package/dist/websy-designs-es6.js +315 -232
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +107 -26
- package/dist/websy-designs.js +322 -239
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -1935,7 +1935,8 @@ class WebsyDropdown {
|
|
|
1935
1935
|
}
|
|
1936
1936
|
get value () {
|
|
1937
1937
|
if (this.selectedItems && this.selectedItems.length > 0) {
|
|
1938
|
-
return this.selectedItems.map((d, i) => this.options.items[+d])
|
|
1938
|
+
// return this.selectedItems.map((d, i) => this.options.items[+d])
|
|
1939
|
+
return this.selectedItems.map((d, i) => this._originalData[+d])
|
|
1939
1940
|
}
|
|
1940
1941
|
return []
|
|
1941
1942
|
}
|
|
@@ -4103,7 +4104,7 @@ class WebsyPDFButton {
|
|
|
4103
4104
|
else {
|
|
4104
4105
|
fileName = this.options.fileName || 'Export'
|
|
4105
4106
|
}
|
|
4106
|
-
msg += `download=
|
|
4107
|
+
msg += `download="${fileName.replace(/'/g, '')}.pdf"`
|
|
4107
4108
|
}
|
|
4108
4109
|
msg += `
|
|
4109
4110
|
>
|
|
@@ -4814,7 +4815,11 @@ class WebsyResultList {
|
|
|
4814
4815
|
}
|
|
4815
4816
|
}
|
|
4816
4817
|
|
|
4817
|
-
/*
|
|
4818
|
+
/*
|
|
4819
|
+
global
|
|
4820
|
+
history
|
|
4821
|
+
WebsyDesigns
|
|
4822
|
+
*/
|
|
4818
4823
|
class WebsyRouter {
|
|
4819
4824
|
constructor (options) {
|
|
4820
4825
|
const defaults = {
|
|
@@ -4831,6 +4836,7 @@ class WebsyRouter {
|
|
|
4831
4836
|
persistentParameters: false,
|
|
4832
4837
|
fieldValueSeparator: ':'
|
|
4833
4838
|
}
|
|
4839
|
+
this.apiService = new WebsyDesigns.APIService('')
|
|
4834
4840
|
this.triggerIdList = []
|
|
4835
4841
|
this.viewIdList = []
|
|
4836
4842
|
this.previousPath = ''
|
|
@@ -4863,7 +4869,7 @@ class WebsyRouter {
|
|
|
4863
4869
|
}
|
|
4864
4870
|
addGroup (group) {
|
|
4865
4871
|
if (!this.groups[group]) {
|
|
4866
|
-
const els = document.querySelectorAll(
|
|
4872
|
+
const els = document.querySelectorAll(`.${this.options.viewClass}[data-group="${group}"]`)
|
|
4867
4873
|
if (els) {
|
|
4868
4874
|
this.getClosestParent(els[0], parent => {
|
|
4869
4875
|
this.groups[group] = {
|
|
@@ -4982,9 +4988,9 @@ class WebsyRouter {
|
|
|
4982
4988
|
if (!this.groups) {
|
|
4983
4989
|
this.groups = {}
|
|
4984
4990
|
}
|
|
4985
|
-
const parentEl = document.querySelector(
|
|
4991
|
+
const parentEl = document.querySelector(`.${this.options.viewClass}[data-view="${parent}"]`)
|
|
4986
4992
|
if (parentEl) {
|
|
4987
|
-
const els = parentEl.querySelectorAll(
|
|
4993
|
+
const els = parentEl.querySelectorAll(`.${this.options.viewClass}[data-group]`)
|
|
4988
4994
|
for (let i = 0; i < els.length; i++) {
|
|
4989
4995
|
const g = els[i].getAttribute('data-group')
|
|
4990
4996
|
const v = els[i].getAttribute('data-view')
|
|
@@ -5242,27 +5248,85 @@ class WebsyRouter {
|
|
|
5242
5248
|
})
|
|
5243
5249
|
}
|
|
5244
5250
|
}
|
|
5251
|
+
preloadView (view, callbackFn) {
|
|
5252
|
+
if (this.options.views[view].load) {
|
|
5253
|
+
this.options.views[view].load(callbackFn)
|
|
5254
|
+
}
|
|
5255
|
+
}
|
|
5256
|
+
initView (view) {
|
|
5257
|
+
return new Promise((resolve, reject) => {
|
|
5258
|
+
if (!this.options.views[view]) {
|
|
5259
|
+
this.options.views[view] = {
|
|
5260
|
+
components: []
|
|
5261
|
+
}
|
|
5262
|
+
}
|
|
5263
|
+
if (this.options.views[view].ready === true) {
|
|
5264
|
+
resolve()
|
|
5265
|
+
}
|
|
5266
|
+
else if (this.options.views[view].template) {
|
|
5267
|
+
this.preloadView(view, (data = {}) => {
|
|
5268
|
+
const viewEl = document.querySelector(`[data-view='${view}'].${this.options.viewClass}`)
|
|
5269
|
+
if (viewEl) {
|
|
5270
|
+
this.options.views[view].templateInstance = new WebsyDesigns.Template(viewEl, {
|
|
5271
|
+
template: this.options.views[view].template,
|
|
5272
|
+
data,
|
|
5273
|
+
readyCallbackFn: () => {
|
|
5274
|
+
this.options.views[view].ready = true
|
|
5275
|
+
resolve()
|
|
5276
|
+
}
|
|
5277
|
+
})
|
|
5278
|
+
}
|
|
5279
|
+
else {
|
|
5280
|
+
console.log(`No view element found for '${view}' to render template`)
|
|
5281
|
+
this.options.views[view].ready = true
|
|
5282
|
+
resolve()
|
|
5283
|
+
}
|
|
5284
|
+
})
|
|
5285
|
+
}
|
|
5286
|
+
else if (this.options.views[view].ready !== true && this.options.views[view].load) {
|
|
5287
|
+
this.preloadView(view, (data = {}) => {
|
|
5288
|
+
this.options.views[view].ready = true
|
|
5289
|
+
resolve()
|
|
5290
|
+
})
|
|
5291
|
+
}
|
|
5292
|
+
else {
|
|
5293
|
+
this.options.views[view].ready = true
|
|
5294
|
+
resolve()
|
|
5295
|
+
}
|
|
5296
|
+
})
|
|
5297
|
+
}
|
|
5245
5298
|
showView (view, params, group) {
|
|
5246
5299
|
if (view === '/' || view === '') {
|
|
5247
5300
|
view = this.options.defaultView || ''
|
|
5248
5301
|
}
|
|
5249
|
-
this.
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5302
|
+
this.initView(view).then(() => {
|
|
5303
|
+
this.activateItem(view, this.options.triggerClass)
|
|
5304
|
+
this.activateItem(view, this.options.viewClass)
|
|
5305
|
+
let children = this.getActiveViewsFromParent(view)
|
|
5306
|
+
for (let c = 0; c < children.length; c++) {
|
|
5307
|
+
this.activateItem(children[c].view, this.options.triggerClass)
|
|
5308
|
+
this.activateItem(children[c].view, this.options.viewClass)
|
|
5309
|
+
this.showComponents(children[c].view)
|
|
5310
|
+
if (children[c].show) {
|
|
5311
|
+
children[c].show.call(children[c])
|
|
5312
|
+
}
|
|
5313
|
+
this.publish('show', [children[c].view, null, group])
|
|
5314
|
+
}
|
|
5315
|
+
if (this.previousView !== this.currentView || group !== 'main') {
|
|
5316
|
+
this.showComponents(view)
|
|
5317
|
+
if (this.options.views[view].show) {
|
|
5318
|
+
this.options.views[view].show.call(this.options.views[view])
|
|
5319
|
+
}
|
|
5320
|
+
this.publish('show', [view, params, group])
|
|
5321
|
+
}
|
|
5322
|
+
else if (this.previousView === this.currentView && this.previousParams.path !== this.currentParams.path) {
|
|
5323
|
+
this.showComponents(view)
|
|
5324
|
+
if (this.options.views[view].show) {
|
|
5325
|
+
this.options.views[view].show.call(this.options.views[view])
|
|
5326
|
+
}
|
|
5327
|
+
this.publish('show', [view, params, group])
|
|
5328
|
+
}
|
|
5329
|
+
})
|
|
5266
5330
|
}
|
|
5267
5331
|
reloadCurrentView () {
|
|
5268
5332
|
this.showView(this.currentView, this.currentParams, 'main')
|
|
@@ -5999,7 +6063,18 @@ class WebsyTemplate {
|
|
|
5999
6063
|
}
|
|
6000
6064
|
}
|
|
6001
6065
|
this.options = Object.assign({}, DEFAULTS, options)
|
|
6002
|
-
|
|
6066
|
+
if (typeof elementId === 'object') {
|
|
6067
|
+
if (elementId.id) {
|
|
6068
|
+
this.elementId = elementId.id
|
|
6069
|
+
}
|
|
6070
|
+
else {
|
|
6071
|
+
elementId.id = WebsyDesigns.Utils.createIdentity()
|
|
6072
|
+
this.elementId = elementId.id
|
|
6073
|
+
}
|
|
6074
|
+
}
|
|
6075
|
+
else {
|
|
6076
|
+
this.elementId = elementId
|
|
6077
|
+
}
|
|
6003
6078
|
this.templateService = new WebsyDesigns.APIService('')
|
|
6004
6079
|
if (!elementId) {
|
|
6005
6080
|
console.log('No element Id provided for Websy Template')
|
|
@@ -6117,6 +6192,10 @@ class WebsyTemplate {
|
|
|
6117
6192
|
}
|
|
6118
6193
|
return html
|
|
6119
6194
|
}
|
|
6195
|
+
set data (d) {
|
|
6196
|
+
this.options.data = d
|
|
6197
|
+
this.render()
|
|
6198
|
+
}
|
|
6120
6199
|
handleClick (event) {
|
|
6121
6200
|
if (event.target.classList.contains('clickable')) {
|
|
6122
6201
|
this.handleEvent(event, 'clickable', 'click')
|
|
@@ -11284,8 +11363,10 @@ class WebsyKPI {
|
|
|
11284
11363
|
}
|
|
11285
11364
|
html += `
|
|
11286
11365
|
<div class="websy-kpi-info">
|
|
11287
|
-
<div class="websy-kpi-label
|
|
11288
|
-
${
|
|
11366
|
+
<div class="websy-kpi-label-container">
|
|
11367
|
+
<div class="websy-kpi-label ${this.options.label.classes.join(' ') || ''}">
|
|
11368
|
+
${(this.options.label || {}).value || ''}
|
|
11369
|
+
</div>
|
|
11289
11370
|
`
|
|
11290
11371
|
if (this.options.tooltip && this.options.tooltip.value) {
|
|
11291
11372
|
html += `
|