@steedos/service-pages 2.5.0-beta.8 → 2.5.0
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.
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
Record: {},
|
|
13
13
|
Listview: {},
|
|
14
14
|
Header: {},
|
|
15
|
+
Footer: {},
|
|
15
16
|
RelatedListview: {},
|
|
16
17
|
Form: {
|
|
17
18
|
StandardNew: {},
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
let display = FlowRouter.current().queryParams.display;
|
|
44
45
|
// console.log('=====getDisplay====>', display)
|
|
45
46
|
// const key = `tab.${objectName}.display`;
|
|
46
|
-
const key = '
|
|
47
|
+
const key = 'page_display'
|
|
47
48
|
if(display){
|
|
48
49
|
// console.log('=====getDisplay===setItem=>', key, display)
|
|
49
50
|
localStorage.setItem(key, display)
|
|
@@ -128,6 +129,7 @@
|
|
|
128
129
|
const masterObject = Creator.getObject(FlowRouter.getParam("object_name"))
|
|
129
130
|
const object = Creator.getObject(objectApiName)
|
|
130
131
|
const idFieldName = masterObject.idFieldName;
|
|
132
|
+
relatedKeyRefToField = object.fields[relatedKey].reference_to_field || idFieldName || '_id';
|
|
131
133
|
return {
|
|
132
134
|
render_engine: 'amis',
|
|
133
135
|
name: 'steedosRelatedListPage',
|
|
@@ -141,7 +143,7 @@
|
|
|
141
143
|
api.data = {
|
|
142
144
|
query: \`{
|
|
143
145
|
data: ${masterObject.name}(filters:["${idFieldName}", "=", "${FlowRouter.getParam("record_id")}"]){
|
|
144
|
-
${idFieldName}
|
|
146
|
+
${idFieldName === relatedKeyRefToField ? idFieldName : idFieldName+','+relatedKeyRefToField},
|
|
145
147
|
${masterObject.NAME_FIELD_KEY},
|
|
146
148
|
recordPermissions: _permissions{
|
|
147
149
|
allowCreate,
|
|
@@ -176,6 +178,15 @@
|
|
|
176
178
|
if(payload.data.data){
|
|
177
179
|
var data = payload.data.data[0];
|
|
178
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
|
+
};
|
|
179
190
|
}
|
|
180
191
|
payload.data.$breadcrumb = [
|
|
181
192
|
{
|
|
@@ -246,6 +257,7 @@
|
|
|
246
257
|
app_id: data.appId,
|
|
247
258
|
object_name: data.objectName,
|
|
248
259
|
record_id: data.recordId,
|
|
260
|
+
formFactor: Steedos.isMobile() ? "SMALL" : "LARGE",
|
|
249
261
|
context: {
|
|
250
262
|
rootUrl: rootUrl.endsWith("/") ? rootUrl.substr(0, rootUrl.length-1) : rootUrl,
|
|
251
263
|
tenantId: Creator.USER_CONTEXT.spaceId,
|
|
@@ -351,14 +363,32 @@
|
|
|
351
363
|
if (updateProps && self.pageName) {
|
|
352
364
|
try {
|
|
353
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
|
+
|
|
354
384
|
updatePropsData = {
|
|
355
385
|
objectName: objectName,
|
|
356
386
|
pageType: regions.pageType,
|
|
357
387
|
listViewId: regions.listViewId,
|
|
358
|
-
...
|
|
388
|
+
...queryParams
|
|
359
389
|
};
|
|
360
|
-
if(
|
|
361
|
-
updatePropsData.listName=
|
|
390
|
+
if(queryParams.side_listview_id){
|
|
391
|
+
updatePropsData.listName=queryParams.side_listview_id
|
|
362
392
|
}else if(regions.listViewId){
|
|
363
393
|
updatePropsData.listName=regions.listViewId
|
|
364
394
|
}
|
|
@@ -447,11 +477,36 @@
|
|
|
447
477
|
}
|
|
448
478
|
|
|
449
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
|
+
|
|
450
496
|
if(FlowRouter.current().queryParams.side_listview_id){
|
|
451
497
|
data.listName = FlowRouter.current().queryParams.side_listview_id;
|
|
452
498
|
}else if(data.listViewId){
|
|
453
499
|
data.listName = data.listViewId;
|
|
454
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
|
+
|
|
455
510
|
return Steedos.Page.render($("#" + rootId)[0], page, Object.assign({}, options, data, {recordId}));
|
|
456
511
|
}
|
|
457
512
|
} catch (error) {
|
|
@@ -756,7 +811,13 @@
|
|
|
756
811
|
}
|
|
757
812
|
|
|
758
813
|
Steedos.Page.Header.render = function(appId, tabId){
|
|
759
|
-
|
|
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}) || {}
|
|
760
821
|
if(_.isEmpty(app)){
|
|
761
822
|
return ;
|
|
762
823
|
}
|
|
@@ -806,175 +867,69 @@
|
|
|
806
867
|
name: "globalHeader",
|
|
807
868
|
body: [
|
|
808
869
|
{
|
|
809
|
-
"type": "
|
|
810
|
-
"
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
{
|
|
817
|
-
"type": "wrapper",
|
|
818
|
-
"className": 'flex w-full px-4 h-[50px] p-0 justify-between items-center steedos-header-container-line-one',
|
|
819
|
-
"body": [
|
|
820
|
-
{
|
|
821
|
-
type: "wrapper",
|
|
822
|
-
className: 'p-0 flex flex-1 items-center',
|
|
823
|
-
body: [
|
|
824
|
-
{
|
|
825
|
-
"type": "button",
|
|
826
|
-
"className": "toggle-sidebar flex items-center pr-4",
|
|
827
|
-
"hiddenOn": "${!isMobile}",
|
|
828
|
-
"onEvent": {
|
|
829
|
-
"click": {
|
|
830
|
-
"actions": [
|
|
831
|
-
{
|
|
832
|
-
"actionType": "custom",
|
|
833
|
-
"script": "document.body.classList.toggle('sidebar-open')",
|
|
834
|
-
}
|
|
835
|
-
]
|
|
836
|
-
}
|
|
837
|
-
},
|
|
838
|
-
"body": [
|
|
839
|
-
{
|
|
840
|
-
"type": "steedos-icon",
|
|
841
|
-
"category": "utility",
|
|
842
|
-
"name": "rows",
|
|
843
|
-
"colorVariant": "default",
|
|
844
|
-
"id": "u:afc3a08e8cf3",
|
|
845
|
-
"className": "slds-button_icon slds-global-header__icon"
|
|
846
|
-
}
|
|
847
|
-
],
|
|
848
|
-
},
|
|
849
|
-
{
|
|
850
|
-
"className": 'block h-10 w-auto mr-4',
|
|
851
|
-
"type": "tpl",
|
|
852
|
-
"tpl": `<a href='/app' class='flex items-center '><img class='block h-10 w-auto' src='${logoSrc}'></a>`,
|
|
853
|
-
},
|
|
854
|
-
],
|
|
855
|
-
},
|
|
856
|
-
{
|
|
857
|
-
"type": "steedos-global-header",
|
|
858
|
-
"label": "Global Header",
|
|
859
|
-
className: 'flex flex-nowrap gap-x-3 items-center',
|
|
860
|
-
logoutScript: "window.Steedos.logout();",
|
|
861
|
-
customButtons: [
|
|
862
|
-
{
|
|
863
|
-
"type": "button",
|
|
864
|
-
"className": "toggle-sidebar",
|
|
865
|
-
"visibleOn": "${AND(app.showSidebar,!isMobile)}",
|
|
866
|
-
"onEvent": {
|
|
867
|
-
"click": {
|
|
868
|
-
"actions": [
|
|
869
|
-
{
|
|
870
|
-
"actionType": "custom",
|
|
871
|
-
"script": "document.body.classList.toggle('sidebar-open')",
|
|
872
|
-
}
|
|
873
|
-
]
|
|
874
|
-
}
|
|
875
|
-
},
|
|
876
|
-
"body": [
|
|
877
|
-
{
|
|
878
|
-
"type": "steedos-icon",
|
|
879
|
-
"category": "utility",
|
|
880
|
-
"name": "rows",
|
|
881
|
-
"colorVariant": "default",
|
|
882
|
-
"id": "u:afc3a08e8cf3",
|
|
883
|
-
"className": "slds-button_icon slds-global-header__icon"
|
|
884
|
-
}
|
|
885
|
-
],
|
|
886
|
-
},
|
|
887
|
-
{
|
|
888
|
-
"type": "steedos-app-launcher",
|
|
889
|
-
"showAppName": false,
|
|
890
|
-
"appId": "${app.id}",
|
|
891
|
-
"visibleOn": "${isMobile}",
|
|
892
|
-
},
|
|
893
|
-
]
|
|
894
|
-
}
|
|
895
|
-
],
|
|
896
|
-
},
|
|
897
|
-
|
|
870
|
+
"type": "steedos-global-header",
|
|
871
|
+
"logoSrc": logoSrc
|
|
872
|
+
},
|
|
873
|
+
],
|
|
874
|
+
onEvent: {
|
|
875
|
+
"@appsLoaded": {
|
|
876
|
+
"actions": [
|
|
898
877
|
{
|
|
899
|
-
"
|
|
900
|
-
"
|
|
901
|
-
"className": 'steedos-context-bar flex flex-nowrap h-10 leading-5 pl-4 mb-[-3px] steedos-header-container-line-two',
|
|
902
|
-
"columns": [
|
|
903
|
-
{
|
|
904
|
-
"columnClassName": "items-center flex pb-0",
|
|
905
|
-
"body": [
|
|
906
|
-
{
|
|
907
|
-
"type": "steedos-app-launcher",
|
|
908
|
-
"showAppName": true,
|
|
909
|
-
"appId": "${app.id}",
|
|
910
|
-
}
|
|
911
|
-
],
|
|
912
|
-
"md": "auto",
|
|
913
|
-
"valign": "middle"
|
|
914
|
-
},
|
|
915
|
-
{
|
|
916
|
-
hiddenOn: "${app.showSidebar === true}",
|
|
917
|
-
"columnClassName": "flex overflow-hidden",
|
|
918
|
-
"body": [
|
|
919
|
-
{
|
|
920
|
-
"type": "steedos-app-menu",
|
|
921
|
-
"stacked": false,
|
|
922
|
-
showIcon: false,
|
|
923
|
-
"appId": "${app.id}",
|
|
924
|
-
hiddenOn: "${app.showSidebar === true}",
|
|
925
|
-
overflow: {
|
|
926
|
-
enable: false,
|
|
927
|
-
itemWidth: 80,
|
|
928
|
-
},
|
|
929
|
-
"id": "u:77851eb4aa89",
|
|
930
|
-
}
|
|
931
|
-
],
|
|
932
|
-
"id": "u:5367229505d8",
|
|
933
|
-
"md": "",
|
|
934
|
-
"valign": "middle",
|
|
935
|
-
}
|
|
936
|
-
],
|
|
937
|
-
},
|
|
938
|
-
],
|
|
939
|
-
},
|
|
940
|
-
|
|
941
|
-
{
|
|
942
|
-
|
|
943
|
-
"type": "button",
|
|
944
|
-
"className": 'p-0 absolute inset-0 mt-[50px] sm:mt-[90px]',
|
|
945
|
-
hiddenOn: "${app.showSidebar != true}",
|
|
946
|
-
body: [{
|
|
947
|
-
type: "wrapper",
|
|
948
|
-
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',
|
|
949
|
-
body: [
|
|
950
|
-
{
|
|
951
|
-
"type": "steedos-app-launcher",
|
|
952
|
-
"className": "px-4 pb-4",
|
|
953
|
-
"visibleOn": "${isMobile}",
|
|
954
|
-
"showAppName": true
|
|
955
|
-
},
|
|
956
|
-
{
|
|
957
|
-
"type": "steedos-app-menu",
|
|
958
|
-
"stacked": true,
|
|
959
|
-
"appId": "${app.id}",
|
|
960
|
-
},
|
|
961
|
-
]
|
|
962
|
-
}],
|
|
963
|
-
"onEvent": {
|
|
964
|
-
"click": {
|
|
965
|
-
"actions": [
|
|
966
|
-
{
|
|
967
|
-
"actionType": "custom",
|
|
968
|
-
"script": "console.log(event.target); if(window.innerWidth < 768){ document.body.classList.remove('sidebar-open'); }",
|
|
969
|
-
}
|
|
970
|
-
]
|
|
878
|
+
"actionType": "custom",
|
|
879
|
+
"script": "Session.set('_app_menus', event.data.apps)"
|
|
971
880
|
}
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
},
|
|
976
|
-
]
|
|
881
|
+
]
|
|
882
|
+
}
|
|
883
|
+
}
|
|
977
884
|
}
|
|
978
885
|
}
|
|
979
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
|
+
}
|
|
980
935
|
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-pages",
|
|
3
|
-
"version": "2.5.0
|
|
3
|
+
"version": "2.5.0",
|
|
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": "c4b366d1366ab52eb53da1a3ff4a80b16fd73cc0",
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"ejs": "^3.1.8"
|
|
14
14
|
}
|