@steedos/service-pages 2.5.0-beta.3 → 2.5.0-beta.30
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.
|
@@ -6,9 +6,13 @@
|
|
|
6
6
|
;(function(){
|
|
7
7
|
Steedos.Page = {
|
|
8
8
|
App: {},
|
|
9
|
+
Object: {
|
|
10
|
+
Template: {}
|
|
11
|
+
},
|
|
9
12
|
Record: {},
|
|
10
13
|
Listview: {},
|
|
11
14
|
Header: {},
|
|
15
|
+
Footer: {},
|
|
12
16
|
RelatedListview: {},
|
|
13
17
|
Form: {
|
|
14
18
|
StandardNew: {},
|
|
@@ -35,6 +39,23 @@
|
|
|
35
39
|
return modalRoot;
|
|
36
40
|
}
|
|
37
41
|
|
|
42
|
+
Steedos.Page.getDisplay = (objectName)=>{
|
|
43
|
+
|
|
44
|
+
let display = FlowRouter.current().queryParams.display;
|
|
45
|
+
// console.log('=====getDisplay====>', display)
|
|
46
|
+
// const key = `tab.${objectName}.display`;
|
|
47
|
+
const key = 'page_display'
|
|
48
|
+
if(display){
|
|
49
|
+
// console.log('=====getDisplay===setItem=>', key, display)
|
|
50
|
+
localStorage.setItem(key, display)
|
|
51
|
+
}else{
|
|
52
|
+
display = localStorage.getItem(key);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return display;
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
|
|
38
59
|
Steedos.Page.getPage = function (type, appId, objectApiName, recordId, pageId) {
|
|
39
60
|
let objectInfo = null;
|
|
40
61
|
let searchParams = FlowRouter.current().queryParams;
|
|
@@ -65,32 +86,42 @@
|
|
|
65
86
|
if(type === 'list'){
|
|
66
87
|
return {
|
|
67
88
|
render_engine: 'amis',
|
|
68
|
-
name:
|
|
69
|
-
schema:{
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"showHeader": true,
|
|
73
|
-
"objectApiName": objectApiName,
|
|
74
|
-
"appId": appId,
|
|
75
|
-
"display": display,
|
|
76
|
-
"columnsTogglable": false,
|
|
77
|
-
// "listName": "all",
|
|
89
|
+
name: "steedosPageObjectControl",
|
|
90
|
+
schema: {
|
|
91
|
+
"type": "steedos-page-object-control",
|
|
92
|
+
"name": "steedosPageObjectControl"
|
|
78
93
|
}
|
|
94
|
+
// name: 'steedosListviewPage',
|
|
95
|
+
// schema:{
|
|
96
|
+
// "name": `${objectApiName}-listview-${listViewId}`,
|
|
97
|
+
// "type": "steedos-page-listview",
|
|
98
|
+
// "showHeader": true,
|
|
99
|
+
// "objectApiName": objectApiName,
|
|
100
|
+
// "appId": appId,
|
|
101
|
+
// "display": display,
|
|
102
|
+
// "columnsTogglable": false,
|
|
103
|
+
// // "listName": "all",
|
|
104
|
+
// }
|
|
79
105
|
}
|
|
80
106
|
}else if(type === 'record'){
|
|
81
107
|
return {
|
|
82
108
|
render_engine: 'amis',
|
|
83
|
-
name:
|
|
109
|
+
name: "steedosPageObjectControl",
|
|
84
110
|
schema: {
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"objectApiName": objectApiName,
|
|
88
|
-
"sideObject": sideObject,
|
|
89
|
-
"sideListviewId": sideListviewId,
|
|
90
|
-
// "recordId": recordId,
|
|
91
|
-
"display": display,
|
|
92
|
-
"appId": appId,
|
|
111
|
+
"type": "steedos-page-object-control",
|
|
112
|
+
"name": "steedosPageObjectControl"
|
|
93
113
|
}
|
|
114
|
+
// name: 'steedosRecordPage',
|
|
115
|
+
// schema: {
|
|
116
|
+
// "name": `${objectApiName}-recordDetail-${recordId}`,
|
|
117
|
+
// "type": "steedos-page-record-detail",
|
|
118
|
+
// "objectApiName": objectApiName,
|
|
119
|
+
// "sideObject": sideObject,
|
|
120
|
+
// "sideListviewId": sideListviewId,
|
|
121
|
+
// // "recordId": recordId,
|
|
122
|
+
// "display": display,
|
|
123
|
+
// "appId": appId,
|
|
124
|
+
// }
|
|
94
125
|
}
|
|
95
126
|
|
|
96
127
|
}else if(type === 'related_list'){
|
|
@@ -98,6 +129,7 @@
|
|
|
98
129
|
const masterObject = Creator.getObject(FlowRouter.getParam("object_name"))
|
|
99
130
|
const object = Creator.getObject(objectApiName)
|
|
100
131
|
const idFieldName = masterObject.idFieldName;
|
|
132
|
+
relatedKeyRefToField = object.fields[relatedKey].reference_to_field || idFieldName || '_id';
|
|
101
133
|
return {
|
|
102
134
|
render_engine: 'amis',
|
|
103
135
|
name: 'steedosRelatedListPage',
|
|
@@ -111,7 +143,7 @@
|
|
|
111
143
|
api.data = {
|
|
112
144
|
query: \`{
|
|
113
145
|
data: ${masterObject.name}(filters:["${idFieldName}", "=", "${FlowRouter.getParam("record_id")}"]){
|
|
114
|
-
${idFieldName}
|
|
146
|
+
${idFieldName === relatedKeyRefToField ? idFieldName : idFieldName+','+relatedKeyRefToField},
|
|
115
147
|
${masterObject.NAME_FIELD_KEY},
|
|
116
148
|
recordPermissions: _permissions{
|
|
117
149
|
allowCreate,
|
|
@@ -146,6 +178,15 @@
|
|
|
146
178
|
if(payload.data.data){
|
|
147
179
|
var data = payload.data.data[0];
|
|
148
180
|
payload.data = data;
|
|
181
|
+
payload.data._master = {
|
|
182
|
+
objectName: "${masterObject.name}",
|
|
183
|
+
recordId: data["${idFieldName}"],
|
|
184
|
+
record: {
|
|
185
|
+
"${idFieldName}": data["${idFieldName}"],
|
|
186
|
+
"${masterObject.NAME_FIELD_KEY}": data["${masterObject.NAME_FIELD_KEY}"],
|
|
187
|
+
"${relatedKeyRefToField}": data["${relatedKeyRefToField}"]
|
|
188
|
+
}
|
|
189
|
+
};
|
|
149
190
|
}
|
|
150
191
|
payload.data.$breadcrumb = [
|
|
151
192
|
{
|
|
@@ -216,6 +257,7 @@
|
|
|
216
257
|
app_id: data.appId,
|
|
217
258
|
object_name: data.objectName,
|
|
218
259
|
record_id: data.recordId,
|
|
260
|
+
formFactor: Steedos.isMobile() ? "SMALL" : "LARGE",
|
|
219
261
|
context: {
|
|
220
262
|
rootUrl: rootUrl.endsWith("/") ? rootUrl.substr(0, rootUrl.length-1) : rootUrl,
|
|
221
263
|
tenantId: Creator.USER_CONTEXT.spaceId,
|
|
@@ -301,6 +343,177 @@
|
|
|
301
343
|
return container
|
|
302
344
|
};
|
|
303
345
|
|
|
346
|
+
Steedos.Page.Object.Template.onRendered = function(){
|
|
347
|
+
var objectName, recordId, self;
|
|
348
|
+
self = this;
|
|
349
|
+
objectName = Session.get("object_name");
|
|
350
|
+
this.containerList = [];
|
|
351
|
+
this.pageName = null;
|
|
352
|
+
return this.autorun(function(computation) {
|
|
353
|
+
// console.log('autorun=====>computation:', computation)
|
|
354
|
+
// Session.get("record_id");
|
|
355
|
+
var container, e, lastData, ref, ref1, ref2, regions, schema, updateProps, updatePropsData;
|
|
356
|
+
regions = self.data.regions();
|
|
357
|
+
// console.log('regions====>', regions, this.lastRegions);
|
|
358
|
+
updateProps = true;
|
|
359
|
+
if (regions.objectName !== ((ref = this.lastRegions) != null ? ref.objectName : void 0)) {
|
|
360
|
+
updateProps = false;
|
|
361
|
+
}
|
|
362
|
+
this.lastRegions = regions;
|
|
363
|
+
if (updateProps && self.pageName) {
|
|
364
|
+
try {
|
|
365
|
+
if (SteedosUI.refs[self.pageName]) {
|
|
366
|
+
let queryParams = FlowRouter.current().queryParams
|
|
367
|
+
|
|
368
|
+
if(_.isArray(queryParams.side_object)){
|
|
369
|
+
if(queryParams.side_object.length >= 1){
|
|
370
|
+
queryParams.side_object = queryParams.side_object[0]
|
|
371
|
+
}else{
|
|
372
|
+
queryParams.side_object = ''
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
if(_.isArray(queryParams.side_listview_id)){
|
|
377
|
+
if(queryParams.side_listview_id.length >= 1){
|
|
378
|
+
queryParams.side_listview_id = queryParams.side_listview_id[0]
|
|
379
|
+
}else{
|
|
380
|
+
queryParams.side_listview_id = ''
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
updatePropsData = {
|
|
385
|
+
objectName: objectName,
|
|
386
|
+
pageType: regions.pageType,
|
|
387
|
+
listViewId: regions.listViewId,
|
|
388
|
+
...queryParams
|
|
389
|
+
};
|
|
390
|
+
if(queryParams.side_listview_id){
|
|
391
|
+
updatePropsData.listName=queryParams.side_listview_id
|
|
392
|
+
}else if(regions.listViewId){
|
|
393
|
+
updatePropsData.listName=regions.listViewId
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
updatePropsData.display = Steedos.Page.getDisplay()
|
|
397
|
+
|
|
398
|
+
updatePropsData.recordId = Tracker.nonreactive(function() {
|
|
399
|
+
return Session.get("record_id");
|
|
400
|
+
});
|
|
401
|
+
lastData = ((ref1 = SteedosUI.refs[self.pageName]) != null ? (ref2 = ref1.__$schema) != null ? ref2.data : void 0 : void 0) || {};
|
|
402
|
+
// console.log("page_object Steedos.Page.Record.updateProps", {
|
|
403
|
+
// data: window._.defaultsDeep(updatePropsData, lastData)
|
|
404
|
+
// });
|
|
405
|
+
return SteedosUI.refs[self.pageName].updateProps({
|
|
406
|
+
data: window._.defaultsDeep(updatePropsData, lastData)
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
} catch (error) {
|
|
410
|
+
e = error;
|
|
411
|
+
console.error(self.pageName + ": " + e);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
if (!updateProps && self.pageName && SteedosUI.refs[self.pageName]) {
|
|
415
|
+
try {
|
|
416
|
+
SteedosUI.refs[self.pageName].unmount();
|
|
417
|
+
} catch (error) {
|
|
418
|
+
e = error;
|
|
419
|
+
console.error(self.pageName + ": " + e);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
if (self.data.regions) {
|
|
423
|
+
regions = Tracker.nonreactive(self.data.regions);
|
|
424
|
+
this.lastRegions = regions;
|
|
425
|
+
if (regions && regions.page && regions.page.schema) {
|
|
426
|
+
schema = regions.page.schema;
|
|
427
|
+
if (_.isString(schema)) {
|
|
428
|
+
schema = JSON.parse(schema);
|
|
429
|
+
}
|
|
430
|
+
self.pageName = schema.name;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
objectName = Tracker.nonreactive(function() {
|
|
434
|
+
return Session.get("object_name");
|
|
435
|
+
});
|
|
436
|
+
recordId = Tracker.nonreactive(function() {
|
|
437
|
+
return Session.get("record_id");
|
|
438
|
+
});
|
|
439
|
+
container = Steedos.Page.Object.render(self, objectName, recordId);
|
|
440
|
+
// console.log("page_object Steedos.Page.Object.render");
|
|
441
|
+
if (container) {
|
|
442
|
+
return self.containerList.push(container);
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
};
|
|
446
|
+
Steedos.Page.Object.Template.onDestroyed = function(){
|
|
447
|
+
var e, self;
|
|
448
|
+
self = this;
|
|
449
|
+
try {
|
|
450
|
+
SteedosUI.refs[this.pageName].unmount();
|
|
451
|
+
} catch (error) {
|
|
452
|
+
e = error;
|
|
453
|
+
console.error(this.pageName + ": " + e);
|
|
454
|
+
}
|
|
455
|
+
return _.each(this.containerList, function(container) {
|
|
456
|
+
if (container) {
|
|
457
|
+
return ReactDOM.unmountComponentAtNode(container);
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
};
|
|
461
|
+
Steedos.Page.Object.render = function(template, objectApiName, recordId = null, options){
|
|
462
|
+
try {
|
|
463
|
+
if (!template.data.regions || !objectApiName) {
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
const { page, ...data } = Tracker.nonreactive(template.data.regions);
|
|
467
|
+
var rootId = "steedosPageObjetRoot";
|
|
468
|
+
var modalRoot = document.getElementById(rootId);
|
|
469
|
+
// if(modalRoot){
|
|
470
|
+
// modalRoot.remove();
|
|
471
|
+
// }
|
|
472
|
+
if (!modalRoot) {
|
|
473
|
+
modalRoot = document.createElement('div');
|
|
474
|
+
modalRoot.setAttribute('id', rootId);
|
|
475
|
+
modalRoot.setAttribute('class', 'h-full')
|
|
476
|
+
$(".page-object-root")[0].appendChild(modalRoot);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
if (page.render_engine && page.render_engine != 'redash') {
|
|
480
|
+
if(_.isArray(data.side_object)){
|
|
481
|
+
if(data.side_object.length >= 1){
|
|
482
|
+
data.side_object = data.side_object[0]
|
|
483
|
+
}else{
|
|
484
|
+
data.side_object = ''
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
if(_.isArray(data.side_listview_id)){
|
|
489
|
+
if(data.side_listview_id.length >= 1){
|
|
490
|
+
data.side_listview_id = data.side_listview_id[0]
|
|
491
|
+
}else{
|
|
492
|
+
data.side_listview_id = ''
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
if(FlowRouter.current().queryParams.side_listview_id){
|
|
497
|
+
data.listName = FlowRouter.current().queryParams.side_listview_id;
|
|
498
|
+
}else if(data.listViewId){
|
|
499
|
+
data.listName = data.listViewId;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
if(_.isArray(data.listName)){
|
|
503
|
+
if(data.listName.length >= 1){
|
|
504
|
+
data.listName = data.listName[0]
|
|
505
|
+
}else{
|
|
506
|
+
data.listName = ''
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
return Steedos.Page.render($("#" + rootId)[0], page, Object.assign({}, options, data, {recordId}));
|
|
511
|
+
}
|
|
512
|
+
} catch (error) {
|
|
513
|
+
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
304
517
|
Steedos.Page.Listview.getDefaultName = function (objectApiName, listViewName) {
|
|
305
518
|
return `listview_${objectApiName}_${listViewName}`;
|
|
306
519
|
};
|
|
@@ -598,7 +811,13 @@
|
|
|
598
811
|
}
|
|
599
812
|
|
|
600
813
|
Steedos.Page.Header.render = function(appId, tabId){
|
|
601
|
-
|
|
814
|
+
|
|
815
|
+
const defApps = Session.get('app_menus'); //触发 autorun
|
|
816
|
+
|
|
817
|
+
const apps = Tracker.nonreactive(()=>{
|
|
818
|
+
return Session.get('_app_menus') || defApps || []
|
|
819
|
+
})
|
|
820
|
+
let app = _.find(apps, {id: appId}) || {}
|
|
602
821
|
if(_.isEmpty(app)){
|
|
603
822
|
return ;
|
|
604
823
|
}
|
|
@@ -648,175 +867,69 @@
|
|
|
648
867
|
name: "globalHeader",
|
|
649
868
|
body: [
|
|
650
869
|
{
|
|
651
|
-
"type": "
|
|
652
|
-
"
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
{
|
|
659
|
-
"type": "wrapper",
|
|
660
|
-
"className": 'flex w-full px-4 h-[50px] p-0 justify-between items-center steedos-header-container-line-one',
|
|
661
|
-
"body": [
|
|
662
|
-
{
|
|
663
|
-
type: "wrapper",
|
|
664
|
-
className: 'p-0 flex flex-1 items-center',
|
|
665
|
-
body: [
|
|
666
|
-
{
|
|
667
|
-
"type": "button",
|
|
668
|
-
"className": "toggle-sidebar flex items-center pr-4",
|
|
669
|
-
"hiddenOn": "${!isMobile}",
|
|
670
|
-
"onEvent": {
|
|
671
|
-
"click": {
|
|
672
|
-
"actions": [
|
|
673
|
-
{
|
|
674
|
-
"actionType": "custom",
|
|
675
|
-
"script": "document.body.classList.toggle('sidebar-open')",
|
|
676
|
-
}
|
|
677
|
-
]
|
|
678
|
-
}
|
|
679
|
-
},
|
|
680
|
-
"body": [
|
|
681
|
-
{
|
|
682
|
-
"type": "steedos-icon",
|
|
683
|
-
"category": "utility",
|
|
684
|
-
"name": "rows",
|
|
685
|
-
"colorVariant": "default",
|
|
686
|
-
"id": "u:afc3a08e8cf3",
|
|
687
|
-
"className": "slds-button_icon slds-global-header__icon"
|
|
688
|
-
}
|
|
689
|
-
],
|
|
690
|
-
},
|
|
691
|
-
{
|
|
692
|
-
"className": 'block h-10 w-auto mr-4',
|
|
693
|
-
"type": "tpl",
|
|
694
|
-
"tpl": `<a href='/app' class='flex items-center '><img class='block h-10 w-auto' src='${logoSrc}'></a>`,
|
|
695
|
-
},
|
|
696
|
-
],
|
|
697
|
-
},
|
|
698
|
-
{
|
|
699
|
-
"type": "steedos-global-header",
|
|
700
|
-
"label": "Global Header",
|
|
701
|
-
className: 'flex flex-nowrap gap-x-3 items-center',
|
|
702
|
-
logoutScript: "window.Steedos.logout();",
|
|
703
|
-
customButtons: [
|
|
704
|
-
{
|
|
705
|
-
"type": "button",
|
|
706
|
-
"className": "toggle-sidebar",
|
|
707
|
-
"visibleOn": "${AND(app.showSidebar,!isMobile)}",
|
|
708
|
-
"onEvent": {
|
|
709
|
-
"click": {
|
|
710
|
-
"actions": [
|
|
711
|
-
{
|
|
712
|
-
"actionType": "custom",
|
|
713
|
-
"script": "document.body.classList.toggle('sidebar-open')",
|
|
714
|
-
}
|
|
715
|
-
]
|
|
716
|
-
}
|
|
717
|
-
},
|
|
718
|
-
"body": [
|
|
719
|
-
{
|
|
720
|
-
"type": "steedos-icon",
|
|
721
|
-
"category": "utility",
|
|
722
|
-
"name": "rows",
|
|
723
|
-
"colorVariant": "default",
|
|
724
|
-
"id": "u:afc3a08e8cf3",
|
|
725
|
-
"className": "slds-button_icon slds-global-header__icon"
|
|
726
|
-
}
|
|
727
|
-
],
|
|
728
|
-
},
|
|
729
|
-
{
|
|
730
|
-
"type": "steedos-app-launcher",
|
|
731
|
-
"showAppName": false,
|
|
732
|
-
"appId": "${app.id}",
|
|
733
|
-
"visibleOn": "${isMobile}",
|
|
734
|
-
},
|
|
735
|
-
]
|
|
736
|
-
}
|
|
737
|
-
],
|
|
738
|
-
},
|
|
739
|
-
|
|
870
|
+
"type": "steedos-global-header",
|
|
871
|
+
"logoSrc": logoSrc
|
|
872
|
+
},
|
|
873
|
+
],
|
|
874
|
+
onEvent: {
|
|
875
|
+
"@appsLoaded": {
|
|
876
|
+
"actions": [
|
|
740
877
|
{
|
|
741
|
-
"
|
|
742
|
-
"
|
|
743
|
-
"className": 'steedos-context-bar flex flex-nowrap h-10 leading-5 pl-4 mb-[-3px] steedos-header-container-line-two',
|
|
744
|
-
"columns": [
|
|
745
|
-
{
|
|
746
|
-
"columnClassName": "items-center flex pb-0",
|
|
747
|
-
"body": [
|
|
748
|
-
{
|
|
749
|
-
"type": "steedos-app-launcher",
|
|
750
|
-
"showAppName": true,
|
|
751
|
-
"appId": "${app.id}",
|
|
752
|
-
}
|
|
753
|
-
],
|
|
754
|
-
"md": "auto",
|
|
755
|
-
"valign": "middle"
|
|
756
|
-
},
|
|
757
|
-
{
|
|
758
|
-
hiddenOn: "${app.showSidebar === true}",
|
|
759
|
-
"columnClassName": "flex overflow-hidden",
|
|
760
|
-
"body": [
|
|
761
|
-
{
|
|
762
|
-
"type": "steedos-app-menu",
|
|
763
|
-
"stacked": false,
|
|
764
|
-
showIcon: false,
|
|
765
|
-
"appId": "${app.id}",
|
|
766
|
-
hiddenOn: "${app.showSidebar === true}",
|
|
767
|
-
overflow: {
|
|
768
|
-
enable: false,
|
|
769
|
-
itemWidth: 80,
|
|
770
|
-
},
|
|
771
|
-
"id": "u:77851eb4aa89",
|
|
772
|
-
}
|
|
773
|
-
],
|
|
774
|
-
"id": "u:5367229505d8",
|
|
775
|
-
"md": "",
|
|
776
|
-
"valign": "middle",
|
|
777
|
-
}
|
|
778
|
-
],
|
|
779
|
-
},
|
|
780
|
-
],
|
|
781
|
-
},
|
|
782
|
-
|
|
783
|
-
{
|
|
784
|
-
|
|
785
|
-
"type": "button",
|
|
786
|
-
"className": 'p-0 absolute inset-0 mt-[50px] sm:mt-[90px]',
|
|
787
|
-
hiddenOn: "${app.showSidebar != true}",
|
|
788
|
-
body: [{
|
|
789
|
-
type: "wrapper",
|
|
790
|
-
className: 'sidebar-wrapper px-0 pt-4 pb-24 fixed z-20 h-full ease-in-out duration-300 flex flex-col border-r overflow-y-auto bg-white border-slate-200 block -translate-x-0 sm:w-[220px] w-64',
|
|
791
|
-
body: [
|
|
792
|
-
{
|
|
793
|
-
"type": "steedos-app-launcher",
|
|
794
|
-
"className": "px-4 pb-4",
|
|
795
|
-
"visibleOn": "${isMobile}",
|
|
796
|
-
"showAppName": true
|
|
797
|
-
},
|
|
798
|
-
{
|
|
799
|
-
"type": "steedos-app-menu",
|
|
800
|
-
"stacked": true,
|
|
801
|
-
"appId": "${app.id}",
|
|
802
|
-
},
|
|
803
|
-
]
|
|
804
|
-
}],
|
|
805
|
-
"onEvent": {
|
|
806
|
-
"click": {
|
|
807
|
-
"actions": [
|
|
808
|
-
{
|
|
809
|
-
"actionType": "custom",
|
|
810
|
-
"script": "console.log(event.target); if(window.innerWidth < 768){ document.body.classList.remove('sidebar-open'); }",
|
|
811
|
-
}
|
|
812
|
-
]
|
|
878
|
+
"actionType": "custom",
|
|
879
|
+
"script": "Session.set('_app_menus', event.data.apps)"
|
|
813
880
|
}
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
},
|
|
818
|
-
]
|
|
881
|
+
]
|
|
882
|
+
}
|
|
883
|
+
}
|
|
819
884
|
}
|
|
820
885
|
}
|
|
821
886
|
}
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
Steedos.Page.Footer.render = function(appId, tabId){
|
|
891
|
+
let app = _.find(Session.get('app_menus'), {id: appId}) || {}
|
|
892
|
+
if(_.isEmpty(app)){
|
|
893
|
+
return ;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
try {
|
|
897
|
+
const data = {
|
|
898
|
+
app,
|
|
899
|
+
isMobile: window.innerWidth <= 768
|
|
900
|
+
};
|
|
901
|
+
const page = Steedos.Page.Footer.getPage(appId, tabId);
|
|
902
|
+
var rootId = "steedosGlobalFooterRoot";
|
|
903
|
+
var modalRoot = document.getElementById(rootId);
|
|
904
|
+
if (!modalRoot) {
|
|
905
|
+
modalRoot = document.createElement('div');
|
|
906
|
+
modalRoot.setAttribute('id', rootId);
|
|
907
|
+
modalRoot.setAttribute('class', 'h-full');
|
|
908
|
+
$(".steedos-global-footer-root")[0].appendChild(modalRoot);
|
|
909
|
+
}
|
|
910
|
+
if (page.render_engine && page.render_engine != 'redash') {
|
|
911
|
+
// console.log("Steedos.Page.Header.render", appId, tabId, page)
|
|
912
|
+
return Steedos.Page.render($("#" + rootId)[0], page, Object.assign({}, data));
|
|
913
|
+
}
|
|
914
|
+
} catch (error) {
|
|
915
|
+
console.error(`Steedos.Page.Footer.render`, error)
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
Steedos.Page.Footer.getPage = function(appId, tabId){
|
|
919
|
+
return {
|
|
920
|
+
render_engine: 'amis',
|
|
921
|
+
name: 'steedosGlobalFooterPage',
|
|
922
|
+
schema: {
|
|
923
|
+
"type": "service",
|
|
924
|
+
"name": "globalFooter",
|
|
925
|
+
"body": [
|
|
926
|
+
{
|
|
927
|
+
"type": "steedos-global-Footer",
|
|
928
|
+
"id": "u:77851eb4aa89",
|
|
929
|
+
"appId": "${app.id}"
|
|
930
|
+
},
|
|
931
|
+
]
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
}
|
|
822
935
|
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-pages",
|
|
3
|
-
"version": "2.5.0-beta.
|
|
3
|
+
"version": "2.5.0-beta.30",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"scripts": {},
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public"
|
|
10
10
|
},
|
|
11
|
-
"gitHead": "
|
|
11
|
+
"gitHead": "d33d736a3009ecfe57981d03d7062e52eaf27609",
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"ejs": "^3.1.8"
|
|
14
14
|
}
|