@steedos/service-pages 2.4.0-beta.2 → 2.4.0-beta.20

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.
@@ -72,7 +72,8 @@
72
72
 
73
73
  window.BuilderComponent = BuilderReact.BuilderComponent;
74
74
 
75
- // window.builder = BuilderReact.builder;
75
+ window.builder = BuilderReact.builder;
76
+ window.builder.init('steedos');
76
77
 
77
78
  Promise.all([
78
79
  waitForThing(Creator, 'USER_CONTEXT'),
@@ -86,13 +86,14 @@
86
86
  "type": "page",
87
87
  name: `amis-${appId}-${objectApiName}-listview`,
88
88
  "title": "Welcome to Steedos",
89
- bodyClassName: 'p-3',
89
+ bodyClassName: 'steedos-listview p-0 sm:border bg-white sm:shadow sm:rounded border-slate-300 border-solid sm:m-3 flex flex-1 flex-col',
90
90
  "body": [
91
91
  {
92
92
  "type": "steedos-object-listview",
93
93
  showHeader: true,
94
94
  "label": "列表视图",
95
95
  "objectApiName": "${objectName}",
96
+ "columnsTogglable": false,
96
97
  "listName": "all",
97
98
  "id": "u:be7c6341cd11"
98
99
  }
@@ -107,9 +108,9 @@
107
108
  return {
108
109
  render_engine: 'amis',
109
110
  name: 'steedosRecordPage',
110
- bodyClassName: 'p-3',
111
111
  schema: {
112
- "type": "page",
112
+ "type": "service",
113
+ "className": 'sm:p-3',
113
114
  "name": `amis-${appId}-${objectApiName}-detail`,
114
115
  "title": "Welcome to Steedos",
115
116
  "body": [
@@ -220,24 +221,21 @@
220
221
  },
221
222
  body: [
222
223
  {
223
- "type": "panel",
224
- "title": {
225
224
  "type": "breadcrumb",
226
- "source": "${$breadcrumb}"
227
- },
228
- "body": [
229
- {
230
- type: 'steedos-object-related-listview',
231
- objectApiName: masterObject.name,
232
- recordId: FlowRouter.getParam("record_id"),
233
- relatedObjectApiName: objectApiName,
234
- foreign_key: relatedKey,
235
- relatedKey: relatedKey,
236
- hiddenOn: "!!!this.$loaded"
237
- // top: 5
238
- }
239
- ]
240
- }
225
+ "source": "${$breadcrumb}",
226
+ "className": "mx-4 my-2",
227
+ },
228
+ {
229
+ type: 'steedos-object-related-listview',
230
+ objectApiName: masterObject.name,
231
+ recordId: FlowRouter.getParam("record_id"),
232
+ relatedObjectApiName: objectApiName,
233
+ foreign_key: relatedKey,
234
+ relatedKey: relatedKey,
235
+ hiddenOn: "!!!this.$loaded",
236
+ "className": "mx-4",
237
+ // top: 5
238
+ }
241
239
  ,
242
240
  // {
243
241
  // type: 'steedos-object-related-listview',
@@ -256,55 +254,7 @@
256
254
  }
257
255
 
258
256
  Steedos.Page.render = function (root, page, data, options = {}) {
259
- const loadingContentData = {
260
- "inputs": [],
261
- // "title": "loading",
262
- "blocks": [
263
- {
264
- "@type": "@builder.io/sdk:Element",
265
- "@version": 2,
266
- "layerName": "Box",
267
- "id": "builder-8070f86b1aed4e78a5878fa5c0d79e49",
268
- "children": [
269
- {
270
- "@type": "@builder.io/sdk:Element",
271
- "@version": 2,
272
- "layerName": "Loading...\n...",
273
- "id": "builder-4b16375a68dc4e49b4844843091bf91d",
274
- "component": {
275
- "name": "Text",
276
- "options": {
277
- "text": "<p>Loading...</p>\n"
278
- }
279
- },
280
- "responsiveStyles": {
281
- "large": {
282
- "display": "flex",
283
- "flexDirection": "column",
284
- "position": "relative",
285
- "flexShrink": "0",
286
- "boxSizing": "border-box",
287
- "marginTop": "20px",
288
- "lineHeight": "normal",
289
- "height": "auto",
290
- "textAlign": "center"
291
- }
292
- }
293
- }
294
- ],
295
- "responsiveStyles": {
296
- "large": {
297
- "display": "flex",
298
- "flexDirection": "column",
299
- "position": "relative",
300
- "flexShrink": "0",
301
- "boxSizing": "border-box"
302
- }
303
- }
304
- }
305
- ]
306
- };
307
-
257
+
308
258
  if (page.render_engine && page.render_engine != 'redash') {
309
259
 
310
260
  let schema = typeof page.schema === 'string' ? JSON.parse(page.schema) : page.schema;
@@ -361,24 +311,20 @@
361
311
 
362
312
  if(!lodash.isFunction(root)){
363
313
  //渲染loading
364
- render(BuilderComponent, {
365
- model: "page", content: {
366
- "data": loadingContentData
367
- }
368
- }, root)
369
314
  }
370
315
 
371
316
  Promise.all([
317
+ waitForThing(window, 'renderAmis'),
372
318
  waitForThing(window, 'BuilderComponent'),
373
319
  waitForThing(Builder.components, upperFirst(page.render_engine), findComponent)
374
320
  ]).then(()=>{
375
321
  //渲染page
376
322
  if(!lodash.isFunction(root)){
377
- render(BuilderComponent, {
378
- model: "page", content: {
379
- "data": pageContentData
380
- }
381
- }, root)
323
+ renderAmis(
324
+ root,
325
+ schema,
326
+ data,
327
+ )
382
328
  }else{
383
329
  if(root === SteedosUI.Drawer){
384
330
  data.drawerName = data.drawerName || lodash.uniqueId(`drawer-${page.object_name}`);
@@ -746,19 +692,22 @@
746
692
  }
747
693
 
748
694
  Steedos.Page.Header.render = function(appId, tabId){
749
- const app = _.find(Session.get('app_menus'), {id: appId})
750
- if (typeof app != 'undefined') {
751
- if (app.id === 'admin' || (window.innerWidth < 768))
752
- app.showSidebar = true;
753
- if (app.showSidebar)
754
- document.body.classList.add('sidebar')
755
- else
756
- document.body.classList.remove("sidebar")
695
+ let app = _.find(Session.get('app_menus'), {id: appId}) || {}
696
+ if (appId === 'admin' || (window.innerWidth < 768))
697
+ app.showSidebar = true;
698
+ if (app.showSidebar)
699
+ document.body.classList.add('sidebar')
700
+ else
701
+ document.body.classList.remove("sidebar")
702
+ if (window.innerWidth >= 768)
703
+ document.body.classList.add('sidebar-open')
704
+ if(app.showSidebar && window.location.pathname.startsWith("/workflow")){
705
+ app = {id: 'workflow'}
757
706
  }
758
-
759
707
  try {
760
708
  const data = {
761
- app
709
+ app,
710
+ isMobile: window.innerWidth <= 768
762
711
  };
763
712
  const page = Steedos.Page.Header.getPage(appId, tabId);
764
713
  var rootId = "steedosGlobalHeaderRoot";
@@ -790,26 +739,45 @@
790
739
  body: [
791
740
  {
792
741
  "type": "wrapper",
793
- "className": "p-0 slds-global-header_container sticky top-0 z-40 w-full flex-none backdrop-blur transition-colors duration-500 lg:z-50 sm:shadow border-b-[3px] border-sky-500 border-solid",
742
+ "className": "bg-white sticky p-0 top-0 z-40 w-full flex-none backdrop-blur transition-colors duration-500 lg:z-50 sm:shadow border-b-[3px] border-sky-500 border-solid steedos-header-container",
794
743
  body: [
795
744
  {
796
745
  "type": "wrapper",
797
- "className": 'flex w-full px-4 h-[50px] p-0 justify-between items-center',
746
+ "className": 'flex w-full px-4 h-[50px] p-0 justify-between items-center steedos-header-container-line-one',
798
747
  "body": [
799
748
  {
800
749
  type: "wrapper",
801
750
  className: 'p-0 flex flex-1 items-center',
802
751
  body: [
803
752
  {
804
- "type": "steedos-logo",
805
- "src": "/logo.png",
806
- "className": 'block h-7 w-auto mr-4',
807
- "hiddenOn": "window.innerWidth < 768",
753
+ "type": "button",
754
+ "className": "toggle-sidebar flex items-center pr-4",
755
+ "hiddenOn": "${!isMobile}",
756
+ "onEvent": {
757
+ "click": {
758
+ "actions": [
759
+ {
760
+ "actionType": "custom",
761
+ "script": "document.body.classList.toggle('sidebar-open')",
762
+ }
763
+ ]
764
+ }
765
+ },
766
+ "body": [
767
+ {
768
+ "type": "steedos-icon",
769
+ "category": "utility",
770
+ "name": "rows",
771
+ "colorVariant": "default",
772
+ "id": "u:afc3a08e8cf3",
773
+ "className": "slds-button_icon slds-global-header__icon"
774
+ }
775
+ ],
808
776
  },
809
777
  {
810
- "type": "steedos-app-launcher",
811
- hiddenOn: "${app.showSidebar != true}",
812
- "showAppName": true
778
+ "className": 'block h-10 w-auto mr-4',
779
+ "type": "tpl",
780
+ "tpl": `<a href='/app' class='flex items-center '><img class='block h-10 w-auto' src='${logoSrc}'></a>`,
813
781
  },
814
782
  ],
815
783
  },
@@ -817,12 +785,12 @@
817
785
  "type": "steedos-global-header",
818
786
  "label": "Global Header",
819
787
  className: 'flex flex-nowrap gap-x-3 items-center',
820
- logoutScript: "window.signOut();",
788
+ logoutScript: "window.Steedos.logout();",
821
789
  customButtons: [
822
790
  {
823
791
  "type": "button",
824
792
  "className": "toggle-sidebar",
825
- "hiddenOn": "${app.showSidebar != true}",
793
+ "visibleOn": "${AND(app.showSidebar,!isMobile)}",
826
794
  "onEvent": {
827
795
  "click": {
828
796
  "actions": [
@@ -850,11 +818,11 @@
850
818
 
851
819
  {
852
820
  "type": "grid",
853
- hiddenOn: "${app.showSidebar === true}",
854
- "className": 'steedos-context-bar hidden sm:flex h-10 leading-5 pl-4 mb-[-3px]',
821
+ "hiddenOn": "${isMobile}",
822
+ "className": 'steedos-context-bar flex flex-nowrap h-10 leading-5 pl-4 mb-[-3px] steedos-header-container-line-two',
855
823
  "columns": [
856
824
  {
857
- "columnClassName": "items-center hidden sm:flex pb-0",
825
+ "columnClassName": "items-center flex pb-0",
858
826
  "body": [
859
827
  {
860
828
  "type": "steedos-app-launcher",
@@ -866,13 +834,15 @@
866
834
  "valign": "middle"
867
835
  },
868
836
  {
869
- "columnClassName": "flex ",
837
+ hiddenOn: "${app.showSidebar === true}",
838
+ "columnClassName": "flex overflow-hidden",
870
839
  "body": [
871
840
  {
872
841
  "type": "steedos-app-menu",
873
842
  "stacked": false,
874
843
  showIcon: false,
875
844
  "appId": "${app.id}",
845
+ hiddenOn: "${app.showSidebar === true}",
876
846
  overflow: {
877
847
  enable: false,
878
848
  itemWidth: 80,
@@ -892,17 +862,23 @@
892
862
  {
893
863
 
894
864
  "type": "button",
895
- "className": 'p-0 absolute inset-0 mt-[50px]',
865
+ "className": 'p-0 absolute inset-0 mt-[50px] sm:mt-[90px]',
896
866
  hiddenOn: "${app.showSidebar != true}",
897
867
  body: [{
898
868
  type: "wrapper",
899
- className: 'sidebar-wrapper p-0 pt-2 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',
869
+ className: 'sidebar-wrapper px-0 pt-4 pb-16 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',
900
870
  body: [
901
- {
902
- "type": "steedos-app-menu",
903
- "stacked": true,
904
- "appId": "${app.id}",
905
- },
871
+ {
872
+ "type": "steedos-app-launcher",
873
+ "className": "px-4 pb-4",
874
+ "visibleOn": "${isMobile}",
875
+ "showAppName": true
876
+ },
877
+ {
878
+ "type": "steedos-app-menu",
879
+ "stacked": true,
880
+ "appId": "${app.id}",
881
+ },
906
882
  ]
907
883
  }],
908
884
  "onEvent": {
@@ -4,9 +4,9 @@ type: lookup
4
4
  sort_no: 135
5
5
  reference_to: objects
6
6
  reference_to_field: name
7
- optionsFunction: !!js/function |
8
- function () {
9
- return Steedos.getObjectsOptions()
7
+ filtersFunction: !!js/function |
8
+ function(filters, values){
9
+ return ['name', '!=', 'cfs_instances_filerecord']
10
10
  }
11
11
  filterable: true
12
12
  required: "{{'record' == formData.type || 'list' == formData.type || 'form' == formData.type ? true: false}}"
@@ -5,7 +5,7 @@ defaultValue: amis
5
5
  options:
6
6
  - label: Amis
7
7
  value: amis
8
- - label: Redash
9
- value: redash
8
+ # - label: Redash
9
+ # value: redash
10
10
  required: true
11
11
  sort_no: 125
@@ -2,7 +2,7 @@
2
2
  * @Author: baozhoutao@steedos.com
3
3
  * @Date: 2022-05-23 10:02:16
4
4
  * @LastEditors: baozhoutao@steedos.com
5
- * @LastEditTime: 2022-05-28 11:15:32
5
+ * @LastEditTime: 2023-02-06 10:50:08
6
6
  * @Description:
7
7
  */
8
8
  const auth = require('@steedos/auth');
@@ -24,6 +24,22 @@ module.exports = {
24
24
  }
25
25
  });
26
26
 
27
+ // 默认添加 全组织 全设备授权
28
+ if(page.type != 'app'){
29
+ await objectql.getObject('page_assignments').insert({
30
+ type: "orgDefault",
31
+ page: id,
32
+ desktop: true,
33
+ mobile: true,
34
+ space: page.space,
35
+ owner: page.owner,
36
+ created_by: page.created_by,
37
+ modified_by: page.modified_by,
38
+ company_id: page.company_id,
39
+ company_ids: page.company_ids
40
+ })
41
+ }
42
+
27
43
  // const actions = broker.registry.getActionList({
28
44
  // onlyLocal: false
29
45
  // });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/service-pages",
3
- "version": "2.4.0-beta.2",
3
+ "version": "2.4.0-beta.20",
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": "4bbd9ee44a8cc1e75db2027c135b9e208b93964a",
11
+ "gitHead": "21e6705921d682193a70b10a2e0e402a3ca32539",
12
12
  "dependencies": {
13
13
  "ejs": "^3.1.8"
14
14
  }