@steedos/service-pages 2.4.0-beta.3 → 2.4.0-beta.31

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.
@@ -56,12 +56,12 @@
56
56
  // Object.defineProperty(window, 'MonacoEnvironment', {set: ()=>{}, get: ()=>window.SteedosMonacoEnvironment})
57
57
 
58
58
 
59
- if (window.define)
60
- window.define.amd = undefined;
59
+ // if (window.define)
60
+ // window.define.amd = undefined;
61
61
 
62
62
  // window.ReactDOM = ReactDom;
63
- window.React17 = window.React;
64
- window.ReactDOM17 = window.ReactDOM;
63
+ // window.React17 = window.React;
64
+ // window.ReactDOM17 = window.ReactDOM;
65
65
 
66
66
  // const BuilderSDK = BuilderReact;
67
67
 
@@ -72,16 +72,17 @@
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'),
79
80
  ]).then(()=>{
80
81
  Builder.set({
81
- rootUrl: __meteor_runtime_config__.ROOT_URL,
82
- unpkgUrl: Steedos.absoluteUrl('/unpkg.com'),
82
+ rootUrl: __steedos_runtime_config__.ROOT_URL,
83
+ unpkgUrl: __steedos_runtime_config__.STEEDOS_UNPKG_URL,
83
84
  context: {
84
- rootUrl: __meteor_runtime_config__.ROOT_URL,
85
+ rootUrl: __steedos_runtime_config__.ROOT_URL,
85
86
  tenantId: Creator.USER_CONTEXT.spaceId,
86
87
  userId: Creator.USER_CONTEXT.userId,
87
88
  authToken: Creator.USER_CONTEXT.user.authToken
@@ -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;
@@ -328,7 +278,8 @@
328
278
  now: new Date(),
329
279
  // mode: mode //由表单提供
330
280
  },
331
- scopeId: schema.name || schema.id
281
+ scopeId: schema.name || schema.id,
282
+ $scopeId : schema.name || schema.id
332
283
  }
333
284
  });
334
285
 
@@ -361,24 +312,20 @@
361
312
 
362
313
  if(!lodash.isFunction(root)){
363
314
  //渲染loading
364
- render(BuilderComponent, {
365
- model: "page", content: {
366
- "data": loadingContentData
367
- }
368
- }, root)
369
315
  }
370
316
 
371
317
  Promise.all([
318
+ waitForThing(window, 'renderAmis'),
372
319
  waitForThing(window, 'BuilderComponent'),
373
320
  waitForThing(Builder.components, upperFirst(page.render_engine), findComponent)
374
321
  ]).then(()=>{
375
322
  //渲染page
376
323
  if(!lodash.isFunction(root)){
377
- render(BuilderComponent, {
378
- model: "page", content: {
379
- "data": pageContentData
380
- }
381
- }, root)
324
+ renderAmis(
325
+ root,
326
+ schema,
327
+ data,
328
+ )
382
329
  }else{
383
330
  if(root === SteedosUI.Drawer){
384
331
  data.drawerName = data.drawerName || lodash.uniqueId(`drawer-${page.object_name}`);
@@ -746,19 +693,25 @@
746
693
  }
747
694
 
748
695
  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")
696
+ let app = _.find(Session.get('app_menus'), {id: appId}) || {}
697
+ if (appId === 'admin' || (window.innerWidth < 768))
698
+ app.showSidebar = true;
699
+ if (app.showSidebar)
700
+ document.body.classList.add('sidebar')
701
+ else
702
+ document.body.classList.remove("sidebar")
703
+ if (window.innerWidth >= 768)
704
+ document.body.classList.add('sidebar-open')
705
+ if(app.showSidebar && window.location.pathname.startsWith("/workflow")){
706
+ app = {id: 'workflow'}
707
+ }
708
+ if(window.location.pathname.startsWith("/workflow")){
709
+ document.body.classList.remove("sidebar-open")
757
710
  }
758
-
759
711
  try {
760
712
  const data = {
761
- app
713
+ app,
714
+ isMobile: window.innerWidth <= 768
762
715
  };
763
716
  const page = Steedos.Page.Header.getPage(appId, tabId);
764
717
  var rootId = "steedosGlobalHeaderRoot";
@@ -790,26 +743,45 @@
790
743
  body: [
791
744
  {
792
745
  "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",
746
+ "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
747
  body: [
795
748
  {
796
749
  "type": "wrapper",
797
- "className": 'flex w-full px-4 h-[50px] p-0 justify-between items-center',
750
+ "className": 'flex w-full px-4 h-[50px] p-0 justify-between items-center steedos-header-container-line-one',
798
751
  "body": [
799
752
  {
800
753
  type: "wrapper",
801
754
  className: 'p-0 flex flex-1 items-center',
802
755
  body: [
803
756
  {
804
- "type": "steedos-logo",
805
- "src": "/logo.png",
806
- "className": 'block h-7 w-auto mr-4',
807
- "hiddenOn": "window.innerWidth < 768",
757
+ "type": "button",
758
+ "className": "toggle-sidebar flex items-center pr-4",
759
+ "hiddenOn": "${!isMobile}",
760
+ "onEvent": {
761
+ "click": {
762
+ "actions": [
763
+ {
764
+ "actionType": "custom",
765
+ "script": "document.body.classList.toggle('sidebar-open')",
766
+ }
767
+ ]
768
+ }
769
+ },
770
+ "body": [
771
+ {
772
+ "type": "steedos-icon",
773
+ "category": "utility",
774
+ "name": "rows",
775
+ "colorVariant": "default",
776
+ "id": "u:afc3a08e8cf3",
777
+ "className": "slds-button_icon slds-global-header__icon"
778
+ }
779
+ ],
808
780
  },
809
781
  {
810
- "type": "steedos-app-launcher",
811
- hiddenOn: "${app.showSidebar != true}",
812
- "showAppName": true
782
+ "className": 'block h-10 w-auto mr-4',
783
+ "type": "tpl",
784
+ "tpl": `<a href='/app' class='flex items-center '><img class='block h-10 w-auto' src='${logoSrc}'></a>`,
813
785
  },
814
786
  ],
815
787
  },
@@ -817,12 +789,12 @@
817
789
  "type": "steedos-global-header",
818
790
  "label": "Global Header",
819
791
  className: 'flex flex-nowrap gap-x-3 items-center',
820
- logoutScript: "window.signOut();",
792
+ logoutScript: "window.Steedos.logout();",
821
793
  customButtons: [
822
794
  {
823
795
  "type": "button",
824
796
  "className": "toggle-sidebar",
825
- "hiddenOn": "${app.showSidebar != true}",
797
+ "visibleOn": "${AND(app.showSidebar,!isMobile)}",
826
798
  "onEvent": {
827
799
  "click": {
828
800
  "actions": [
@@ -850,11 +822,11 @@
850
822
 
851
823
  {
852
824
  "type": "grid",
853
- hiddenOn: "${app.showSidebar === true}",
854
- "className": 'steedos-context-bar hidden sm:flex h-10 leading-5 pl-4 mb-[-3px]',
825
+ "hiddenOn": "${isMobile}",
826
+ "className": 'steedos-context-bar flex flex-nowrap h-10 leading-5 pl-4 mb-[-3px] steedos-header-container-line-two',
855
827
  "columns": [
856
828
  {
857
- "columnClassName": "items-center hidden sm:flex pb-0",
829
+ "columnClassName": "items-center flex pb-0",
858
830
  "body": [
859
831
  {
860
832
  "type": "steedos-app-launcher",
@@ -866,13 +838,15 @@
866
838
  "valign": "middle"
867
839
  },
868
840
  {
869
- "columnClassName": "flex ",
841
+ hiddenOn: "${app.showSidebar === true}",
842
+ "columnClassName": "flex overflow-hidden",
870
843
  "body": [
871
844
  {
872
845
  "type": "steedos-app-menu",
873
846
  "stacked": false,
874
847
  showIcon: false,
875
848
  "appId": "${app.id}",
849
+ hiddenOn: "${app.showSidebar === true}",
876
850
  overflow: {
877
851
  enable: false,
878
852
  itemWidth: 80,
@@ -892,17 +866,23 @@
892
866
  {
893
867
 
894
868
  "type": "button",
895
- "className": 'p-0 absolute inset-0 mt-[50px]',
869
+ "className": 'p-0 absolute inset-0 mt-[50px] sm:mt-[90px]',
896
870
  hiddenOn: "${app.showSidebar != true}",
897
871
  body: [{
898
872
  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',
873
+ 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
874
  body: [
901
- {
902
- "type": "steedos-app-menu",
903
- "stacked": true,
904
- "appId": "${app.id}",
905
- },
875
+ {
876
+ "type": "steedos-app-launcher",
877
+ "className": "px-4 pb-4",
878
+ "visibleOn": "${isMobile}",
879
+ "showAppName": true
880
+ },
881
+ {
882
+ "type": "steedos-app-menu",
883
+ "stacked": true,
884
+ "appId": "${app.id}",
885
+ },
906
886
  ]
907
887
  }],
908
888
  "onEvent": {
@@ -30,7 +30,8 @@ module.exports = {
30
30
  };
31
31
  Steedos.authRequest(url, options);
32
32
  },
33
- customPageVisible: function (object_name, record_id, permission, record) {
33
+ customPageVisible: function (object_name, record_id, permission, data) {
34
+ var record = data && data.record;
34
35
  return record && record.is_system;
35
36
  }
36
37
  }
@@ -31,7 +31,8 @@ module.exports = {
31
31
  };
32
32
  Steedos.authRequest(url, options);
33
33
  },
34
- deployVisible: function (object_name, record_id, permission, record) {
34
+ deployVisible: function (object_name, record_id, permission, data) {
35
+ var record = data && data.record;
35
36
  return record && !record.is_system;
36
37
  }
37
38
  }
@@ -24,7 +24,8 @@ module.exports = {
24
24
  };
25
25
  Steedos.authRequest(url, options);
26
26
  },
27
- disableVisible: function (object_name, record_id, permission, record) {
27
+ disableVisible: function (object_name, record_id, permission, data) {
28
+ var record = data && data.record;
28
29
  return record && record.is_active && !record.is_system
29
30
  }
30
31
  }
@@ -24,7 +24,8 @@ module.exports = {
24
24
  };
25
25
  Steedos.authRequest(url, options);
26
26
  },
27
- enableVisible: function (object_name, record_id, permission, record) {
27
+ enableVisible: function (object_name, record_id, permission, data) {
28
+ var record = data && data.record;
28
29
  return record && !record.is_active && !record.is_system
29
30
  }
30
31
  }
@@ -41,7 +41,8 @@ module.exports = {
41
41
  }
42
42
  });
43
43
  },
44
- resetSchemaVisible: function (object_name, record_id, permission, record) {
44
+ resetSchemaVisible: function (object_name, record_id, permission, data) {
45
+ var record = data && data.record;
45
46
  return record && !record.is_system && record.type === 'form';
46
47
  }
47
48
  }
@@ -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.3",
3
+ "version": "2.4.0-beta.31",
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": "1c901ac5b13f425f28aedf0f1bf61199f0012663",
11
+ "gitHead": "a774174cebbb39c961ad03e20e990781082c8c04",
12
12
  "dependencies": {
13
13
  "ejs": "^3.1.8"
14
14
  }