@steedos/standard-ui 2.2.55-beta.16

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.
File without changes
@@ -0,0 +1,37 @@
1
+ Creator.openApp = function(app_id, event){
2
+ var app = Creator.getApp(app_id)
3
+ if(!app){
4
+ /* 执行A标签浏览器默认行为 */
5
+ return true;
6
+ }
7
+ if(app.is_use_iframe){
8
+ /*
9
+ 如果需要实现单点登录,可以定义app.on_click属性写脚本代码,它会在路由"/app/xxx"中执行
10
+ 详情请见源码中Template.creator_app_iframe.onRendered相关代码
11
+ */
12
+ FlowRouter.go("/app/" + app_id);
13
+ event.preventDefault();
14
+ }
15
+ else if(app.on_click){
16
+ /*
17
+ 这里执行的是一个不带参数的闭包函数,用来避免变量污染
18
+ on_click脚本中可以直接调用变量app_id、app、event等上面字义过的变量
19
+ 如果想阻止A标签自动跳转行为,可以在脚本中增加代码event.preventDefault();来实现
20
+ 注意每次变更on_click脚本内容后,目标浏览器或客户端都需要刷新才能生效
21
+ */
22
+ var evalFunString = "(function(){" + app.on_click + "})()";
23
+ try{
24
+ eval(evalFunString);
25
+ }
26
+ catch(e){
27
+ /*just console the error when catch error*/
28
+ console.error("catch some error when eval the on_click script for app link:");
29
+ console.error(e.message + "\r\n" + e.stack);
30
+ }
31
+ }
32
+ else{
33
+ /* 执行A标签浏览器默认行为 */
34
+ return true;
35
+ }
36
+ }
37
+
@@ -0,0 +1,55 @@
1
+ // Steedos.TabsManager = {};
2
+
3
+ // Steedos.TabsManager.__lastDoc = null;
4
+
5
+ // Steedos.TabsManager.changeSchema = function (doc, schema, when) {
6
+ // const baseFieldsName = [
7
+ // { "name": "label", "required": true },
8
+ // { "name": "name", "required": true },
9
+ // { "name": "icon", "required": true },
10
+ // { "name": "parent"},
11
+ // { "name": "mobile"},
12
+ // { "name": "desktop"},
13
+ // { "name": "type"},
14
+ // { "name": "description" }
15
+ // ];
16
+
17
+ // function getFieldsByType(doc, type) {
18
+ // let fields = [];
19
+ // switch (type) {
20
+ // case 'object':{
21
+ // fields.push({ name: 'object', required: true });
22
+ // break;
23
+ // }
24
+ // case 'url':{
25
+ // fields.push({ name: 'url', required: true });
26
+ // fields.push({ name: 'is_new_window'});
27
+ // break;
28
+ // }
29
+ // case 'page':{
30
+ // fields.push({ name: 'page', required: true });
31
+ // break;
32
+ // }
33
+ // default:
34
+ // break;
35
+ // }
36
+ // return fields;
37
+ // }
38
+ // var clone = require('clone');
39
+ // var fields = clone(Creator.getObject("tabs").fields);
40
+ // var showFields = baseFieldsName.concat(getFieldsByType(doc, doc.type));
41
+
42
+ // _.map(fields, function(field, fname){
43
+ // var showField = _.find(showFields, function(item){
44
+ // return item && item.name === fname;
45
+ // })
46
+ // if(showField){
47
+ // Object.assign(field, showField)
48
+ // }else{
49
+ // Object.assign(field, {omit: true, hidden: true})
50
+ // }
51
+ // })
52
+
53
+ // var objectSchema = Creator.getObjectSchema({fields: fields});
54
+ // Object.assign(schema, new SimpleSchema(objectSchema))
55
+ // }
@@ -0,0 +1,171 @@
1
+ name: apps
2
+ label: App
3
+ description:
4
+ fields:
5
+ name:
6
+ label: Name
7
+ help:
8
+ description:
9
+ code:
10
+ label: API Name)
11
+ help:
12
+ description:
13
+ icon_slds:
14
+ label: SLDS Icon
15
+ help:
16
+ description:
17
+ visible:
18
+ label: Visible
19
+ help:
20
+ description:
21
+ description:
22
+ label: Description
23
+ help:
24
+ description:
25
+ tabs:
26
+ label: Tabs
27
+ icon:
28
+ label: Icon
29
+ help:
30
+ description:
31
+ sort:
32
+ label: Sort Number
33
+ help:
34
+ description:
35
+ is_creator:
36
+ label: Item of Menu
37
+ help:
38
+ description:
39
+ mobile:
40
+ label: Mobile App
41
+ help:
42
+ description:
43
+ members:
44
+ label: Members
45
+ help:
46
+ description:
47
+ members.users:
48
+ label: User Members
49
+ help:
50
+ description:
51
+ members.organizations:
52
+ label: Department Members
53
+ help:
54
+ description:
55
+ url:
56
+ label: URL
57
+ help:
58
+ description:
59
+ is_use_ie:
60
+ label: Open in IE (Using Steedos Desktop)
61
+ help:
62
+ description:
63
+ is_use_iframe:
64
+ label: Open with iframe
65
+ help:
66
+ description:
67
+ is_new_window:
68
+ label: Open in New Window
69
+ help:
70
+ description:
71
+ on_click:
72
+ label: onClick
73
+ help:
74
+ description:
75
+ auth_name:
76
+ label: Auth Name
77
+ help:
78
+ description:
79
+ secret:
80
+ label: API Secret Key
81
+ help:
82
+ description:
83
+ oauth2_enabled:
84
+ label: OAuth2 Enabled
85
+ help:
86
+ description:
87
+ oauth2_callback_url:
88
+ label: Callback URL
89
+ help:
90
+ description:
91
+ oauth2_scopes:
92
+ label: Scopes
93
+ help:
94
+ options:
95
+ - label: Access to Your Unique Identifier (openid)
96
+ value: openid
97
+ - label: 'Access Basic Information (id, email, address, phone, locale)'
98
+ value: profile
99
+ - label: Access Fully (full)
100
+ value: full
101
+ description:
102
+ oauth2_logout_enabled:
103
+ label: OAuth2 Logout Enabled
104
+ help:
105
+ description:
106
+ oauth2_logout_url:
107
+ label: OAuth2 Logout URL
108
+ help:
109
+ description:
110
+ saml_enabled:
111
+ label: SAML Enabled
112
+ help:
113
+ description:
114
+ saml_entity_id:
115
+ label: Entity Id
116
+ help:
117
+ description:
118
+ saml_issuer:
119
+ label: Issuer
120
+ help:
121
+ description:
122
+ saml_idp_cert:
123
+ label: IDP Cert
124
+ help:
125
+ description:
126
+ saml_acs_url:
127
+ label: ACS URL
128
+ help:
129
+ description:
130
+ saml_name_id_format:
131
+ label: Name
132
+ help:
133
+ description:
134
+ saml_logout_enabled:
135
+ label: SAML Logout Enabled
136
+ help:
137
+ description:
138
+ saml_logout_url:
139
+ label: SAML Logout URL
140
+ help:
141
+ description:
142
+ saml_logout_block:
143
+ label: SAML Logout Block
144
+ help:
145
+ options:
146
+ - label: HTTP Redirect
147
+ value: redirect
148
+ - label: HTTP Post
149
+ value: post
150
+ description:
151
+ is_system:
152
+ label: System
153
+ help:
154
+ description:
155
+ from_code_id:
156
+ label:
157
+ help:
158
+ description:
159
+ groups:
160
+ business_object: Business object
161
+ external_application: External Application
162
+ oauth2: OAuth2
163
+ saml: SAML
164
+ listviews:
165
+ all:
166
+ label: All Apps
167
+ actions:
168
+ customize:
169
+ label: Customize
170
+ reset:
171
+ label: Reset
@@ -0,0 +1,186 @@
1
+ name: apps
2
+ label: 应用程序
3
+ description:
4
+ fields:
5
+ name:
6
+ label: 名称
7
+ help:
8
+ description:
9
+ code:
10
+ label: API 名称
11
+ help:
12
+ description:
13
+ icon_slds:
14
+ label: 图标
15
+ help:
16
+ description:
17
+ tabs:
18
+ label: 选项卡
19
+ visible:
20
+ label: 启用
21
+ help:
22
+ description:
23
+ description:
24
+ label: 描述
25
+ help:
26
+ description:
27
+ objects:
28
+ label: 桌面主菜单
29
+ help:
30
+ description:
31
+ mobile_objects:
32
+ label: 手机主菜单
33
+ help:
34
+ description:
35
+ icon:
36
+ label: 旧版图标
37
+ help:
38
+ description:
39
+ sort:
40
+ label: 排序
41
+ help:
42
+ description:
43
+ is_creator:
44
+ label: 显示在桌面菜单中
45
+ help:
46
+ description:
47
+ mobile:
48
+ label: 显示在手机菜单中
49
+ help:
50
+ description:
51
+ members:
52
+ label: 授权对象
53
+ help:
54
+ description:
55
+ members.users:
56
+ label: 授权人员
57
+ help:
58
+ description:
59
+ members.organizations:
60
+ label: 授权部门
61
+ help:
62
+ description:
63
+ url:
64
+ label: 外部链接
65
+ help:
66
+ description:
67
+ is_use_ie:
68
+ label: 使用IE打开(需使用Steedos桌面客户端)
69
+ help:
70
+ description:
71
+ is_use_iframe:
72
+ label: 使用iframe打开
73
+ help:
74
+ description:
75
+ is_new_window:
76
+ label: 在新窗口打开
77
+ help:
78
+ description:
79
+ on_click:
80
+ label: 链接脚本
81
+ help:
82
+ description:
83
+ auth_name:
84
+ label: 验证域名
85
+ help:
86
+ description:
87
+ secret:
88
+ label: API 密钥
89
+ help:
90
+ description:
91
+ oauth2_enabled:
92
+ label: 启用 OAuth2
93
+ help:
94
+ description:
95
+ oauth2_callback_url:
96
+ label: 回调 URL
97
+ help:
98
+ description:
99
+ oauth2_home_url:
100
+ label: 应用首页
101
+ oauth2_logo:
102
+ label: 应用 Logo
103
+ oauth2_client_secret:
104
+ label: 应用密钥
105
+ help: 请妥善保管
106
+ oauth2_scopes:
107
+ label: 范围
108
+ help:
109
+ options:
110
+ - label: 允许访问您的唯一标志符 (openid)
111
+ value: openid
112
+ - label: '访问基本信息 (id, email, address, phone, locale)'
113
+ value: profile
114
+ - label: 完全访问权限 (full)
115
+ value: full
116
+ description:
117
+ oauth2_logout_enabled:
118
+ label: 启用单点注销
119
+ help:
120
+ description:
121
+ oauth2_logout_url:
122
+ label: 单点注销 URL
123
+ help:
124
+ description:
125
+ saml_enabled:
126
+ label: 启用 SAML
127
+ help:
128
+ description:
129
+ saml_entity_id:
130
+ label: Entity Id
131
+ help:
132
+ description:
133
+ saml_issuer:
134
+ label: Issuer
135
+ help:
136
+ description:
137
+ saml_idp_cert:
138
+ label: IDP Cert
139
+ help:
140
+ description:
141
+ saml_acs_url:
142
+ label: ACS Url
143
+ help:
144
+ description:
145
+ saml_name_id_format:
146
+ label: 名称
147
+ help:
148
+ description:
149
+ saml_logout_enabled:
150
+ label: 启用单点注销
151
+ help:
152
+ description:
153
+ saml_logout_url:
154
+ label: 单点注销 URL
155
+ help:
156
+ description:
157
+ saml_logout_block:
158
+ label: 单点注销绑定
159
+ help:
160
+ options:
161
+ - label: HTTP Redirect
162
+ value: redirect
163
+ - label: HTTP Post
164
+ value: post
165
+ description:
166
+ is_system:
167
+ label: 系统
168
+ help:
169
+ description:
170
+ from_code_id:
171
+ label:
172
+ help:
173
+ description:
174
+ groups:
175
+ business_object: 业务对象
176
+ external_application: 外接应用
177
+ oauth2: OAuth2
178
+ saml: SAML
179
+ listviews:
180
+ all:
181
+ label: 所有
182
+ actions:
183
+ customize:
184
+ label: 自定义
185
+ reset:
186
+ label: 重置
@@ -0,0 +1,63 @@
1
+ name: tabs
2
+ label: Custom Tabs
3
+ description:
4
+ fields:
5
+ label:
6
+ label: 显示名称
7
+ help: This is the label of the tab, for web tabs only.
8
+ name:
9
+ label: Api Name
10
+ icon:
11
+ label: Icon
12
+ parent:
13
+ label: Parent Tab
14
+ mobile:
15
+ label: Display on the Mobile
16
+ desktop:
17
+ label: Display on the Desktop
18
+ frame_height:
19
+ label: Frame Height
20
+ help: The height, in pixels of the tab frame. Required for frame and page tabs.
21
+ description:
22
+ has_sidebar:
23
+ label: Sidebar
24
+ help: Indicates if the tab displays the sidebar panel.
25
+ description:
26
+ type:
27
+ label: Type
28
+ options:
29
+ - label: Object
30
+ value: object
31
+ - label: Url
32
+ value: url
33
+ - label: Page
34
+ value: page
35
+ object:
36
+ label: Object
37
+ help:
38
+ description:
39
+ url:
40
+ label: Url
41
+ help:
42
+ description:
43
+ page:
44
+ label: Page
45
+ help:
46
+ description:
47
+ action_overrides:
48
+ label: Action Overrides
49
+ help: A list of the action overrides that are assigned to the tab. Only one override is allowed per formFactor for a given tab.
50
+ description:
51
+ is_system:
52
+ label: System
53
+ help:
54
+ description:
55
+ description:
56
+ label: Description
57
+ is_new_window:
58
+ label: Open in New Window
59
+ help:
60
+ description:
61
+ listviews:
62
+ all:
63
+ label: All
@@ -0,0 +1,63 @@
1
+ name: tabs
2
+ label: 选项卡
3
+ description:
4
+ fields:
5
+ label:
6
+ label: 显示名称
7
+ help: 仅适用于Web标签。
8
+ name:
9
+ label: API 名称
10
+ icon:
11
+ label: 图标
12
+ parent:
13
+ label: 上级选项卡
14
+ mobile:
15
+ label: 显示在手机菜单中
16
+ desktop:
17
+ label: 显示在桌面菜单中
18
+ frame_height:
19
+ label: Frame Height
20
+ help: 选项卡框架的高度(以像素为单位)。
21
+ description:
22
+ has_sidebar:
23
+ label: 显示侧边栏面板
24
+ help: 指示选项卡是否显示侧边栏面板。
25
+ description:
26
+ type:
27
+ label: 类型
28
+ options:
29
+ - label: 对象
30
+ value: object
31
+ - label: 外部链接
32
+ value: url
33
+ - label: 页面
34
+ value: page
35
+ object:
36
+ label: 对象
37
+ help:
38
+ description:
39
+ url:
40
+ label: 外部链接
41
+ help:
42
+ description:
43
+ page:
44
+ label: 页面
45
+ help:
46
+ description:
47
+ action_overrides:
48
+ label: Action Overrides
49
+ help: 分配给选项卡的操作替代列表。 对于给定的标签,每个formFactor只允许一个替代。
50
+ description:
51
+ is_system:
52
+ label: 系统
53
+ help:
54
+ description:
55
+ description:
56
+ label: 描述
57
+ is_new_window:
58
+ label: 在新窗口打开
59
+ help:
60
+ description:
61
+ listviews:
62
+ all:
63
+ label: 所有
@@ -0,0 +1,79 @@
1
+ /*
2
+ * @Author: baozhoutao@hotoa.com
3
+ * @Date: 2021-12-27 10:49:33
4
+ * @LastEditors: sunhaolin@hotoa.com
5
+ * @LastEditTime: 2022-05-30 11:53:17
6
+ * @Description:
7
+ */
8
+ module.exports = {
9
+ customize: function (object_name, record_id, fields) {
10
+ var doc = Creator.odata.get(object_name, record_id);
11
+ var newRecord = _.pick(doc, Creator.getObjectFieldsName(object_name));
12
+ delete newRecord.is_system;
13
+ delete newRecord._id;
14
+ delete newRecord.record_permissions;
15
+ newRecord.from_code_id = record_id;
16
+ Creator.odata.insert(object_name, newRecord, function(result, error){
17
+ if(result){
18
+ FlowRouter.go(`/app/-/${object_name}/view/${result._id}`)
19
+ }
20
+ });
21
+
22
+ },
23
+ customizeVisible: function(object_name, record_id, record_permissions, record){
24
+ if(record._id === 'admin'){return false;}
25
+ return Creator.baseObject.actions.standard_new.visible() && record.is_system && !record.from_code_id;
26
+ },
27
+ reset: function(object_name, record_id, fields){
28
+ var record = Creator.odata.get(object_name, record_id);
29
+ var doc = Creator.odata.get(object_name, record.from_code_id);
30
+ var newRecord = _.pick(doc, Creator.getObjectFieldsName(object_name));
31
+ newRecord.from_code_id = newRecord._id;
32
+ delete newRecord.is_system;
33
+ delete newRecord._id;
34
+ delete newRecord.record_permissions;
35
+ Creator.odata.update(object_name, record_id, newRecord);
36
+ FlowRouter.reload();
37
+ },
38
+ resetVisible: function(object_name, record_id, record_permissions, record){
39
+ if(Creator.baseObject.actions.standard_edit.visible()){
40
+ return record.from_code_id;
41
+ }
42
+ },
43
+ createOAuth2App: function (object_name) {
44
+ const fields = Creator.getObject(object_name).fields;
45
+ const oauthAppFields = {};
46
+ _.map(fields, function (v, k) {
47
+ if (k) {
48
+ if (_.include(['name', 'code', 'visible', 'description', 'is_creator', 'mobile', 'sort', 'is_use_iframe', 'is_new_window'], k) || k.startsWith("oauth2")) {
49
+ oauthAppFields[k] = v;
50
+ }
51
+ }
52
+ });
53
+ const onFinish = async (values = {}) => {
54
+ return new Promise((resolve, reject) => {
55
+ try {
56
+ console.log(`values`, values)
57
+ Creator.odata.insert(object_name, values)
58
+ setTimeout(function () { FlowRouter.reload() }, 100)
59
+ resolve(true);
60
+ } catch (error) {
61
+ console.error(`e2`, error);
62
+ reject(false);
63
+ }
64
+ })
65
+ }
66
+ SteedosUI.showModal(stores.ComponentRegistry.components.ObjectForm, {
67
+ name: "createOAuth2App",
68
+ title: '创建 OAuth 应用',
69
+ objectSchema: {
70
+ fields: oauthAppFields
71
+ },
72
+ // initialValues: initialValues,
73
+ onFinish: onFinish //onFinishByFrame
74
+ }, null, { iconPath: '/assets/icons' })
75
+ },
76
+ createOAuth2AppVisible: function () {
77
+ return false && Creator.baseObject.actions.standard_new.visible();
78
+ }
79
+ }