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