@steedos/standard-ui 2.4.12 → 2.5.0-beta.3

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,7 +12,7 @@ amis_schema: |-
12
12
  "actions": [
13
13
  {
14
14
  "actionType": "custom",
15
- "script": "const appId = null;\nconst page = Steedos.Page.getPage('app', appId, null, null, \"apps_form\");\nif (page && page.schema) {\n const pageSchema = JSON.parse(page.schema);\n let formSchema = pageSchema.body[0];\n // 设置form的canAccessSuperData属性防止弹出窗口从父级取字段默认值\n formSchema.canAccessSuperData = false;\n // 设置form的wrapWithPanel属性隐藏其底部保存取消按钮\n formSchema.wrapWithPanel = false;\n formSchema.className = \"steedos-amis-form\";\n const title = \"编辑 应用程序\";\n doAction({\n \"actionType\": \"dialog\",\n \"dialog\": {\n \"type\": \"dialog\",\n \"title\": title,\n \"body\": [{\n \"type\": \"service\",\n \"body\": [formSchema],\n \"data\": {\n \"objectName\": \"${object_name}\",\n \"recordId\": \"${record_id}\"\n }\n }],\n \"size\": \"lg\"\n }\n });\n}"
15
+ "script": "const appId = null;\nconst page = Steedos.Page.getPage('app', appId, null, null, \"apps_form\");\nif (page && page.schema) {\n const pageSchema = JSON.parse(page.schema);\n let formSchema = pageSchema.body[0];\n // 设置form的canAccessSuperData属性防止弹出窗口从父级取字段默认值\n formSchema.canAccessSuperData = false;\n // 设置form的wrapWithPanel属性隐藏其底部保存取消按钮\n formSchema.wrapWithPanel = false;\n formSchema.className = \"steedos-amis-form\";\n const title = \"编辑 应用程序\";\n doAction({\n \"actionType\": \"dialog\",\n \"dialog\": {\n \"type\": \"dialog\",\n \"title\": title,\n \"body\": [formSchema],\n \"size\": \"lg\"\n }\n });\n}"
16
16
  }
17
17
  ],
18
18
  "weight": 0
@@ -124,18 +124,10 @@ fields:
124
124
  # defaultValue: true
125
125
 
126
126
  showSidebar:
127
- label: 显示左侧导航
127
+ label: Show Sidebar
128
128
  type: boolean
129
129
  defaultValue: false
130
- enable_nav_schema:
131
- label: 启用自定义导航
132
- type: boolean
133
- required: false
134
- nav_schema:
135
- label: 自定义导航
136
- type: code
137
- language: json
138
- visible_on: "{{false}}"
130
+
139
131
  # members:
140
132
  # type: object
141
133
  # label: Members
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/standard-ui",
3
- "version": "2.4.12",
3
+ "version": "2.5.0-beta.3",
4
4
  "main": "package.service.js",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -12,5 +12,5 @@
12
12
  "description": "steedos package",
13
13
  "repository": {},
14
14
  "license": "MIT",
15
- "gitHead": "9e0c93d90964dc1a7aef679c64f977d2352ef013"
15
+ "gitHead": "48546b91b2a44dd6f6673af7f5ab707faff6e07c"
16
16
  }
@@ -1,31 +0,0 @@
1
- /*
2
- * @Author: baozhoutao@steedos.com
3
- * @Date: 2023-04-11 14:05:42
4
- * @LastEditors: baozhoutao@steedos.com
5
- * @LastEditTime: 2023-04-11 14:08:41
6
- * @Description:
7
- */
8
- module.exports = {
9
- amis_nav_schema_design: function (object_name, record_id) {
10
- document.location = Steedos.absoluteUrl(`/api/amisAppNavSchemaDesign?id=${record_id}&object=${this.record.object_name}&assetUrls=${Builder.settings.assetUrls}`);
11
- },
12
- amis_nav_schema_designVisible: function (object_name, record_id, record_permissions) {
13
- var perms= {};
14
- var record = Creator.getObjectRecord(object_name, record_id);
15
- if(!record){
16
- return false;
17
- }
18
- if(!record.enable_nav_schema){
19
- return false;
20
- }
21
- if (record_permissions) {
22
- perms = record_permissions;
23
- } else {
24
- record_permissions = Creator.getRecordPermissions(object_name, record, Meteor.userId());
25
- if (record_permissions) {
26
- perms = record_permissions;
27
- }
28
- }
29
- return perms["allowEdit"];
30
- }
31
- }
@@ -1,4 +0,0 @@
1
- name: amis_nav_schema_design
2
- is_enable: true
3
- label: 导航设计器
4
- 'on': record_only
@@ -1,165 +0,0 @@
1
- <!--
2
- * @Author: baozhoutao@steedos.com
3
- * @Date: 2022-06-02 17:45:15
4
- * @LastEditors: baozhoutao@steedos.com
5
- * @LastEditTime: 2023-04-11 14:02:31
6
- * @Description:
7
- -->
8
- <html>
9
- <head>
10
- <script src="/unpkg.com/@steedos-builder/fiddle@0.0.5/dist/builder-fiddle.umd.js"></script>
11
- <script src="/unpkg.com/axios@0.26.1/dist/axios.min.js"></script>
12
- </head>
13
-
14
- <body>
15
- <builder-fiddle host="<%=builderHost%>"></builder-fiddle>
16
- <script>
17
- const settings = {
18
- assetUrls: "<%=assetUrls%>",
19
- rootUrl: "<%=rootUrl%>",
20
- userId: "<%=userId%>",
21
- tenantId: "<%=tenantId%>",
22
- authToken: "<%=authToken%>",
23
- id: "<%=id%>",
24
- pageId: "<%=id%>",
25
- messageOnly: true,
26
- hiddenDeploy: true
27
- };
28
-
29
- let comp = document.querySelector("builder-fiddle");
30
-
31
- const loadPage = async () => {
32
- const { assetUrls, rootUrl, userId, tenantId, authToken, id } = settings;
33
-
34
- // 如果传入 steedos rooturl
35
- if (rootUrl && !authToken) return;
36
-
37
- const initialContent = {
38
- type: "nav"
39
- };
40
-
41
- if (id) {
42
- const result = await axios.post(
43
- `${rootUrl}/graphql`,
44
- {
45
- query: `
46
- {
47
- record:apps__findOne(id: "${id}"){
48
- _id,
49
- code,
50
- name,
51
- nav_schema
52
- }
53
- }
54
- `
55
- },
56
- {
57
- withCredentials: true,
58
- headers: { Authorization: `Bearer ${tenantId},${authToken}` },
59
- }
60
- );
61
- if (result?.data?.data) {
62
- const record = result.data.data.record;
63
- let schema = record?.nav_schema ;
64
- if(!schema){
65
- schema = initialContent;
66
- }
67
-
68
- let objectName = result.data.object;
69
- if (typeof schema === "string") {
70
- schema = JSON.parse(schema);
71
- }
72
-
73
- if (!schema.data) {
74
- schema.data = {};
75
- }
76
-
77
- if (!schema.data.context) {
78
- schema.data.context = {};
79
- }
80
-
81
- schema.data.app_id = '';
82
- schema.data.tab_id = '';
83
- schema.data.dataComponentId = '';
84
- schema.data.record_id = '';
85
- schema.data.record = {};
86
- schema.data.permissions = {};
87
-
88
- schema.data.context.rootUrl = rootUrl;
89
- schema.data.context.tenantId = tenantId;
90
- schema.data.context.userId = userId;
91
- schema.data.context.authToken = authToken;
92
-
93
- return schema || initialContent
94
- }
95
- } else {
96
- return initialContent
97
- }
98
- };
99
-
100
- const savePage = async (data) => {
101
- const { rootUrl, userId, tenantId, authToken, id } = settings;
102
-
103
- if (!id) {
104
- return;
105
- }
106
-
107
- // 保存schema时,清理context下的认证信息
108
- const schema = JSON.parse(
109
- JSON.stringify(data.data.AmisSchema, null, 4)
110
- );
111
- if (schema.data && typeof schema.data.context === 'object' ) {
112
- delete schema.data.context.userId;
113
- delete schema.data.context.tenantId;
114
- delete schema.data.context.authToken;
115
- delete schema.data.context.user;
116
- delete schema.data.context.rootUrl;
117
- }
118
- return await axios.post(
119
- `${rootUrl}/graphql`,
120
- {
121
- query: `
122
- mutation{
123
- apps__update(id: "${id}", doc: {nav_schema: ${JSON.stringify(JSON.stringify(schema, null, 4))}}){_id}
124
- }
125
- `,
126
- },
127
- {
128
- withCredentials: true,
129
- headers: { Authorization: `Bearer ${tenantId},${authToken}` },
130
- }
131
- )
132
- .catch(function (error) {
133
- // handle error
134
- console.log(error);
135
- });
136
- };
137
-
138
- const deployPageVersion = async () => {
139
-
140
- };
141
- window.addEventListener('message', function (event) {
142
- const { data } = event;
143
- if (data) {
144
- if (data.type === 'builder.loadContent') {
145
- loadPage().then((content)=>{
146
- comp.messageFrame('builder.contentChanged', { AmisSchema : content } )
147
- })
148
- }
149
- if (data.type === 'builder.saveContent') {
150
- savePage(data.data).then(()=>{
151
- comp.messageFrame('builder.contentSaved')
152
- })
153
- }
154
- if(data.type === "builder.deployContent"){
155
- deployPageVersion().then(()=>{
156
- comp.messageFrame('builder.contentDeployed')
157
- })
158
- }
159
- }
160
- })
161
-
162
- comp.settings = settings;
163
- </script>
164
- </body>
165
- </html>
@@ -1,53 +0,0 @@
1
- /*
2
- * @Author: baozhoutao@steedos.com
3
- * @Date: 2022-04-04 16:34:28
4
- * @Description:
5
- */
6
- const express = require("express");
7
- const router = express.Router();
8
- const core = require('@steedos/core');
9
- const ejs = require('ejs');
10
- const fs = require('fs');
11
- const _ = require('lodash');
12
- const path = require('path');
13
- const objectql = require('@steedos/objectql');
14
-
15
- router.get('/api/amisAppNavSchemaDesign', core.requireAuthentication, async function (req, res) {
16
- try {
17
- res.set('Content-Type', 'text/html');
18
- const userSession = req.user;
19
- let assetUrls = req.query.assetUrls;
20
- const assetUrl = `assetUrl=${assetUrls.split(',').join("&assetUrl=")}&`;
21
- // const dataContext = {
22
- // rootUrl: __meteor_runtime_config__.ROOT_URL,
23
- // tenantId: userSession.spaceId,
24
- // userId: userSession.userId,
25
- // authToken: userSession.authToken
26
- // }
27
-
28
- const retUrl = __meteor_runtime_config__.ROOT_URL + `/app/admin/apps/view/${req.query.id}`
29
- const steedosBuilderUrl = process.env.STEEDOS_BUILDER_URL || 'https://builder.steedos.cn';
30
- const builderHost = `${steedosBuilderUrl}/amis?${assetUrl}retUrl=${retUrl}`;
31
-
32
- const filename = __dirname+'/amis_app_nav_schema_design.ejs'
33
- const data = {
34
- builderHost,
35
- assetUrls,
36
- rootUrl: __meteor_runtime_config__.ROOT_URL,
37
- tenantId: userSession.spaceId,
38
- userId: userSession.userId,
39
- authToken: userSession.authToken,
40
- id: req.query.id
41
- }
42
- const options = {}
43
- ejs.renderFile(filename, data, options, function(err, str){
44
- // str => Rendered HTML string
45
- res.send(str);
46
- });
47
-
48
- } catch (error) {
49
- res.status(500).send({ message: error.message });
50
- }
51
-
52
- });
53
- exports.default = router;