@steedos/standard-ui 3.0.0-beta.2 → 3.0.0-beta.8

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.
Files changed (25) hide show
  1. package/main/default/applications/admin.app.yml +43 -42
  2. package/main/default/objects/apps.action.js +3 -3
  3. package/main/default/objects/apps.object.yml +6 -9
  4. package/main/default/objects/tabs/buttons/generate_object_tabs.button.yml +1 -1
  5. package/main/default/objects/tabs.object.yml +2 -1
  6. package/main/default/routers/amis_app_nav_schema_design.router.js +5 -5
  7. package/main/default/routers/main_head.router.js +3 -3
  8. package/main/default/triggers/tabs_api_name.trigger.js +2 -3
  9. package/package.json +2 -2
  10. package/package.service.js +3 -3
  11. package/main/default/client/apps.client.js +0 -37
  12. package/main/default/client/favicon.client.js +0 -11
  13. package/main/default/client/history_paths.client.js +0 -251
  14. package/main/default/client/setLocalstorageSteedostoken.client.js +0 -8
  15. package/main/default/client/tabs.client.js +0 -55
  16. package/main/default/objects/apps/buttons/amis_edit.button.yml +0 -39
  17. package/main/default/objects/apps/buttons/amis_nav_schema_design.button.js +0 -31
  18. package/main/default/objects/apps/buttons/amis_nav_schema_design.button.yml +0 -4
  19. package/main/default/objects/apps/buttons/amis_new.button.yml +0 -43
  20. package/main/default/objects/apps/buttons/disable.button.js +0 -56
  21. package/main/default/objects/apps/buttons/disable.button.yml +0 -4
  22. package/main/default/objects/apps/buttons/enable.button.js +0 -60
  23. package/main/default/objects/apps/buttons/enable.button.yml +0 -4
  24. package/main/default/objects/apps.object.js +0 -94
  25. package/main/default/triggers/apps.trigger.js +0 -90
@@ -4,6 +4,7 @@ description: 管理员设置公司、人员、权限等。
4
4
  icon: ion-ios-people-outline
5
5
  icon_slds: settings
6
6
  is_creator: true
7
+ showSidebar: true
7
8
  mobile: true
8
9
  tab_groups:
9
10
  - group_name: personal_settings
@@ -63,18 +64,18 @@ tab_items:
63
64
  admin_queue_import:
64
65
  group: apps
65
66
  index: 18
66
- admin_datasources:
67
- group: apps
68
- index: 20
67
+ # admin_datasources:
68
+ # group: apps
69
+ # index: 20
69
70
  admin_steedos_packages:
70
71
  group: development
71
72
  index: 18
72
73
  admin_developer:
73
74
  group: development
74
75
  index: 19.50
75
- admin_metadata:
76
- group: development
77
- index: 19.505
76
+ # admin_metadata:
77
+ # group: development
78
+ # index: 19.505
78
79
  admin_developer_triggers:
79
80
  group: development
80
81
  index: 19.51
@@ -99,36 +100,36 @@ tab_items:
99
100
  admin_workflow_outbound_messages:
100
101
  group: process_automation
101
102
  index: 25
102
- admin_flows:
103
- group: approval_workflow
104
- index: 20
105
- admin_roles:
106
- group: approval_workflow
107
- index: 25
108
- admin_flow_roles:
109
- group: approval_workflow
110
- index: 26
111
- admin_flow_positions:
112
- group: approval_workflow
113
- index: 26.5
114
- admin_categories:
115
- group: approval_workflow
116
- index: 28
117
- admin_instance_number_rules:
118
- group: approval_workflow
119
- index: 29
120
- admin_space_user_signs:
121
- group: approval_workflow
122
- index: 30
123
- admin_instances_statistic:
124
- group: approval_workflow
125
- index: 31
126
- admin_webhooks:
127
- group: approval_workflow
128
- index: 32
129
- admin_object_workflows:
130
- group: approval_workflow
131
- index: 33
103
+ # admin_flows:
104
+ # group: approval_workflow
105
+ # index: 20
106
+ # admin_roles:
107
+ # group: approval_workflow
108
+ # index: 25
109
+ # admin_flow_roles:
110
+ # group: approval_workflow
111
+ # index: 26
112
+ # admin_flow_positions:
113
+ # group: approval_workflow
114
+ # index: 26.5
115
+ # admin_categories:
116
+ # group: approval_workflow
117
+ # index: 28
118
+ # admin_instance_number_rules:
119
+ # group: approval_workflow
120
+ # index: 29
121
+ # admin_space_user_signs:
122
+ # group: approval_workflow
123
+ # index: 30
124
+ # admin_instances_statistic:
125
+ # group: approval_workflow
126
+ # index: 31
127
+ # admin_webhooks:
128
+ # group: approval_workflow
129
+ # index: 32
130
+ # admin_object_workflows:
131
+ # group: approval_workflow
132
+ # index: 33
132
133
  admin_sessions:
133
134
  group: advanced_settings
134
135
  index: 34
@@ -141,12 +142,12 @@ tab_items:
141
142
  # admin_web_forms:
142
143
  # group: 高级设置
143
144
  # index: 38
144
- admin_holidays:
145
- group: advanced_settings
146
- index: 39
147
- admin_business_hours:
148
- group: advanced_settings
149
- index: 40
145
+ # admin_holidays:
146
+ # group: advanced_settings
147
+ # index: 39
148
+ # admin_business_hours:
149
+ # group: advanced_settings
150
+ # index: 40
150
151
  # admin_object_webhooks:
151
152
  # group: 高级设置
152
153
  # index: 41
@@ -23,7 +23,7 @@ module.exports = {
23
23
  customizeVisible: function(object_name, record_id, record_permissions, data){
24
24
  var record = data && data.record;
25
25
  if(record._id === 'admin'){return false;}
26
- return Creator.baseObject.actions.standard_new.visible() && record.is_system && !record.from_code_id;
26
+ return Steedos.Object.base.actions.standard_new.visible() && record.is_system && !record.from_code_id;
27
27
  },
28
28
  reset: function(object_name, record_id, fields){
29
29
  var record = Creator.odata.get(object_name, record_id);
@@ -38,7 +38,7 @@ module.exports = {
38
38
  },
39
39
  resetVisible: function(object_name, record_id, record_permissions, data){
40
40
  const record = data && data.record;
41
- if(Creator.baseObject.actions.standard_edit.visible(object_name, record_id, record_permissions)){
41
+ if(Steedos.Object.base.actions.standard_edit.visible(object_name, record_id, record_permissions)){
42
42
  return record.from_code_id;
43
43
  }
44
44
  },
@@ -76,7 +76,7 @@ module.exports = {
76
76
  // }, null, { iconPath: '/assets/icons' })
77
77
  },
78
78
  createOAuth2AppVisible: function () {
79
- return false && Creator.baseObject.actions.standard_new.visible();
79
+ return false && Steedos.Object.base.actions.standard_new.visible();
80
80
  },
81
81
  standard_editVisible: function(object_name, record_id, record_permissions, record){
82
82
  return false
@@ -30,7 +30,7 @@ fields:
30
30
  var options;
31
31
  options = [];
32
32
 
33
- _.forEach(Creator.resources.sldsIcons.standard, function (svg) {
33
+ _.forEach(Steedos.resources.sldsIcons.standard, function (svg) {
34
34
  return options.push({
35
35
  value: svg,
36
36
  label: svg,
@@ -185,20 +185,17 @@ fields:
185
185
  type: lookup
186
186
  multiple: true
187
187
  group: other
188
- optionsFunction: !!js/function |
189
- function () {
190
- return Steedos.getObjectsOptions()
191
- }
188
+ reference_to: objects
189
+ reference_to_field: name
192
190
  # filterable: true
193
191
  mobile_objects:
194
192
  label: Mobile Menus(Invalid)
195
193
  type: lookup
196
194
  multiple: true
195
+ reference_to: objects
196
+ reference_to_field: name
197
+ # filterable: true
197
198
  group: other
198
- optionsFunction: !!js/function |
199
- function () {
200
- return Steedos.getObjectsOptions()
201
- }
202
199
  visible_on:
203
200
  name: visible_on
204
201
  is_wide: true
@@ -36,5 +36,5 @@ label: 对象选项卡
36
36
  type: amis_button
37
37
  visible: !!js/function |
38
38
  function (object_name, record_id, record_permissions, record) {
39
- return Creator.baseObject.actions.standard_new.visible()
39
+ return Steedos.Object.base.actions.standard_new.visible()
40
40
  }
@@ -4,6 +4,7 @@ icon: timeslot
4
4
  hidden: true
5
5
  version: 2.0
6
6
  enable_dataloader: false
7
+ isMetadata: true
7
8
  paging:
8
9
  enabled: false
9
10
  fields:
@@ -29,7 +30,7 @@ fields:
29
30
  var options;
30
31
  options = [];
31
32
 
32
- _.forEach(Creator.resources.sldsIcons.standard, function (svg) {
33
+ _.forEach(Steedos.resources.sldsIcons.standard, function (svg) {
33
34
  return options.push({
34
35
  value: svg,
35
36
  label: svg,
@@ -5,7 +5,7 @@
5
5
  */
6
6
  const express = require("express");
7
7
  const router = express.Router();
8
- const core = require('@steedos/core');
8
+ const auth = require('@steedos/auth');
9
9
  const ejs = require('ejs');
10
10
  const fs = require('fs');
11
11
  const _ = require('lodash');
@@ -21,14 +21,14 @@ const getPublicAssetUrls = function(assetUrls){
21
21
  })
22
22
  return _.join(values, ',')
23
23
  }
24
- router.get('/api/amisAppNavSchemaDesign', core.requireAuthentication, async function (req, res) {
24
+ router.get('/api/amisAppNavSchemaDesign', auth.requireAuthentication, async function (req, res) {
25
25
  try {
26
26
  res.set('Content-Type', 'text/html');
27
27
  const userSession = req.user;
28
28
  let assetUrls = getPublicAssetUrls(req.query.assetUrls);
29
29
  const assetUrl = `assetUrl=${assetUrls.split(',').join("&assetUrl=")}&`;
30
30
  // const dataContext = {
31
- // rootUrl: __meteor_runtime_config__.ROOT_URL,
31
+ // rootUrl: process.env.ROOT_URL,
32
32
  // tenantId: userSession.spaceId,
33
33
  // userId: userSession.userId,
34
34
  // authToken: userSession.authToken
@@ -40,7 +40,7 @@ router.get('/api/amisAppNavSchemaDesign', core.requireAuthentication, async func
40
40
  } else if (req.query.locale == "zh-cn") {
41
41
  locale = "zh-CN";
42
42
  }
43
- const retUrl = __meteor_runtime_config__.ROOT_URL + `/app/admin/apps/view/${req.query.id}`
43
+ const retUrl = process.env.ROOT_URL + `/app/admin/apps/view/${req.query.id}`
44
44
  const steedosBuilderUrl = process.env.STEEDOS_BUILDER_URL || 'https://builder.steedos.cn';
45
45
  const builderHost = `${steedosBuilderUrl}/amis?${assetUrl}locale=${locale}&retUrl=${retUrl}`;
46
46
 
@@ -48,7 +48,7 @@ router.get('/api/amisAppNavSchemaDesign', core.requireAuthentication, async func
48
48
  const data = {
49
49
  builderHost,
50
50
  assetUrls,
51
- rootUrl: __meteor_runtime_config__.ROOT_URL,
51
+ rootUrl: process.env.ROOT_URL,
52
52
  tenantId: userSession.spaceId,
53
53
  userId: userSession.userId,
54
54
  authToken: userSession.authToken,
@@ -5,7 +5,7 @@
5
5
  */
6
6
  const express = require("express");
7
7
  const router = express.Router();
8
- const core = require('@steedos/core');
8
+ const auth = require('@steedos/auth');
9
9
  const ejs = require('ejs');
10
10
  const fs = require('fs');
11
11
  const _ = require('lodash');
@@ -44,7 +44,7 @@ router.get('/main_head.js', async function (req, res) {
44
44
  res.set('Content-Type', 'application/javascript; charset=UTF-8');
45
45
  const filename = path.join(__dirname, 'main_head.ejs');
46
46
  const data = {
47
- ROOT_URL: platform === 'cordova' ? __meteor_runtime_config__.ROOT_URL : '',
47
+ ROOT_URL: platform === 'cordova' ? process.env.ROOT_URL : '',
48
48
  STEEDOS_SENTRY_ENABLED: process.env.STEEDOS_SENTRY_ENABLED,
49
49
  NODE_ENV: process.env.NODE_ENV,
50
50
  STEEDOS_SENTRY_DSN: process.env.STEEDOS_SENTRY_DSN,
@@ -85,7 +85,7 @@ router.get('/main_head.css', async function(req, res){
85
85
 
86
86
  const STEEDOS_UNPKG_URL = getConfig('STEEDOS_UNPKG_URL', platform);
87
87
  const STEEDOS_AMIS_URL = getConfig('STEEDOS_AMIS_URL', platform);
88
- const ROOT_URL = platform === 'cordova' ? __meteor_runtime_config__.ROOT_URL : '';
88
+ const ROOT_URL = platform === 'cordova' ? process.env.ROOT_URL : '';
89
89
 
90
90
  res.send(`
91
91
  @import url("${STEEDOS_UNPKG_URL}/@salesforce-ux/design-system@2.22.2/assets/styles/salesforce-lightning-design-system.min.css");
@@ -5,7 +5,6 @@
5
5
  * @LastEditTime: 2023-04-21 11:09:05
6
6
  * @Description:
7
7
  */
8
- const util = require('@steedos/standard-objects').util;
9
8
  const _ = require('lodash');
10
9
  const objectql = require('@steedos/objectql')
11
10
  module.exports = {
@@ -13,7 +12,7 @@ module.exports = {
13
12
 
14
13
  beforeInsert: async function(){
15
14
  const { object_name, doc } = this;
16
- await util.checkAPIName(object_name, 'name', doc.name, undefined);
15
+ await objectql.checkAPIName(object_name, 'name', doc.name, undefined);
17
16
  if(doc.type === 'object'){
18
17
  const records = await objectql.getObject('tabs').count({filters: [['type', '=', 'object'], ['object', '=', doc.object]]});
19
18
  if(records > 0){
@@ -25,7 +24,7 @@ module.exports = {
25
24
  beforeUpdate: async function(){
26
25
  const {object_name, doc, spaceId, id} = this;
27
26
  if(_.has(doc, 'name')){
28
- await util.checkAPIName(object_name, 'name', doc.name, id);
27
+ await objectql.checkAPIName(object_name, 'name', doc.name, id);
29
28
  }
30
29
  }
31
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/standard-ui",
3
- "version": "3.0.0-beta.2",
3
+ "version": "3.0.0-beta.8",
4
4
  "main": "package.service.js",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -12,7 +12,7 @@
12
12
  "description": "steedos package",
13
13
  "repository": {},
14
14
  "license": "MIT",
15
- "gitHead": "72fa51bda8ff714d5fdb933bf0a45ea4cb82df74",
15
+ "gitHead": "723d92765db5342a374c7aacb5b835e69f77ca4b",
16
16
  "dependencies": {
17
17
  "clone": "^2.1.2"
18
18
  }
@@ -1,14 +1,14 @@
1
1
  /*
2
2
  * @Author: sunhaolin@hotoa.com
3
3
  * @Date: 2022-07-29 09:40:31
4
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
5
- * @LastEditTime: 2023-09-11 15:45:29
4
+ * @LastEditors: baozhoutao@steedos.com
5
+ * @LastEditTime: 2025-02-15 13:49:38
6
6
  * @Description:
7
7
  */
8
8
  "use strict";
9
9
  const project = require('./package.json');
10
10
  const packageName = project.name;
11
- const packageLoader = require('@steedos/service-meteor-package-loader');
11
+ const packageLoader = require('@steedos/service-package-loader');
12
12
  /**
13
13
  * @typedef {import('moleculer').Context} Context Moleculer's Context
14
14
  */
@@ -1,37 +0,0 @@
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
-
@@ -1,11 +0,0 @@
1
-
2
- Meteor.startup(function(){
3
- Tracker.autorun(function(){
4
- const space = db.spaces.findOne(Steedos.getSpaceId());
5
- if(space && space.favicon){
6
- const faviconLink = document.querySelector('link[rel="shortcut icon"]');
7
- faviconLink.href = Steedos.absoluteUrl("/api/files/avatars/"+space.favicon);
8
- console.log('update faviconLink.href', faviconLink.href)
9
- }
10
- })
11
- })
@@ -1,251 +0,0 @@
1
- /*
2
- * @Author: 殷亮辉 yinlianghui@hotoa.com
3
- * @Date: 2023-05-16 17:00:38
4
- * @LastEditors: 涂佳俊 tujiajun@steedos.com
5
- * @LastEditTime: 2023-11-23 17:22:22
6
- */
7
- var buttonTriggerHistoryPathsChange;
8
-
9
- let historyPathsStoreKey = "history_paths";
10
-
11
- // 切换应用、对象、列表视图时清除本地存储中的过滤条件
12
- function clearHistoryFilters(context, lastPath, paths) {
13
- const path = context.path;
14
- const params = context.params || {};
15
- if (!lastPath || lastPath.params.app_id != params.app_id || lastPath.params.object_name != params.object_name || lastPath.params.list_view_id != params.list_view_id) {
16
- let listViewPropsStoreKey;
17
- if (lastPath) {
18
- if(lastPath.params.record_id){
19
- // 是从记录详细界面直接切换到其他对象列表或其他应用时,进一步往上找,找到对象列表的path作为lastPath来清除对应的本地存储
20
- for(let i = paths.length - 1;i >= 0;i--){
21
- let tempPath = paths[i];
22
- // if(!tempPath.params.record_id && tempPath.params.list_view_id){
23
- // 不可以判断list_view_id表示对象列表,因为有可以从应用程序微页面进入记录详细页面,需要清除应用程序微页面中的对象表格或对象列表组件中本地存储中保存的过滤条件
24
- if(!tempPath.params.record_id){
25
- // record_id不存在,list_view_id存在表示对象列表页面
26
- lastPath = tempPath;
27
- break;
28
- }
29
- }
30
- }
31
- listViewPropsStoreKey = lastPath.path.split('?')[0] + "/crud";
32
- }
33
- else {
34
- listViewPropsStoreKey = path.split('?')[0] + "/crud";
35
- }
36
- sessionStorage.removeItem(listViewPropsStoreKey);
37
- sessionStorage.removeItem(listViewPropsStoreKey + "/query");
38
- }
39
- }
40
-
41
- /**
42
- * 移除最后一个path,并且返回要返回的上一个path
43
- * 如果是从推送通知中点开进入记录详细页面,则返回当前记录所属对象的列表页面
44
- */
45
- function popHistoryPath() {
46
- var paths = getHistoryPaths() || [];
47
- let lastPath = paths && paths[paths.length - 1];
48
- paths.pop();
49
- setHistoryPaths(paths);
50
- let prevPath = paths && paths[paths.length - 1];
51
- if(!prevPath && lastPath){
52
- // 如果是从推送通知中点开进入记录详细页面,在paths.pop()前的paths肯定只有当前记录详细页面的path
53
- // 此时lastPath肯定是记录详细页面,值如以下格式:
54
- /**{
55
- "path": "/app/projects/project_program/view/6465c790f85da77bbccefbe6",
56
- "params": {
57
- "app_id": "projects",
58
- "object_name": "project_program",
59
- "record_id": "6465c790f85da77bbccefbe6"
60
- }
61
- }**/
62
- prevPath = {
63
- path: `/app/${lastPath.params.app_id || "-"}/${lastPath.params.object_name}`,
64
- params: {
65
- app_id: lastPath.params.app_id,
66
- object_name: lastPath.params.object_name
67
- }
68
- }
69
- }
70
- return prevPath;
71
- }
72
-
73
- function pushHistoryPath(path, params) {
74
- let paths = getHistoryPaths() || [];
75
- let lastPath = paths && paths[paths.length - 1];
76
- if(lastPath && lastPath.path === path){
77
- // 点返回按钮执行goBack函数触发FlowRouter.triggers.enter从而进入该函数,此时lastPath肯定跟传入的path值一样,正好排除掉不重复加入paths
78
- return;
79
- }
80
- paths.push({ path, params });
81
- setHistoryPaths(paths);
82
- }
83
-
84
- function resetHistoryPath(path, params) {
85
- setHistoryPaths([{ path, params }]);
86
- }
87
-
88
- function getHistoryPaths() {
89
- if (!window.historyPaths) {
90
- var paths = sessionStorage.getItem(historyPathsStoreKey);
91
- if (paths) {
92
- window.historyPaths = JSON.parse(paths);
93
- }else{
94
- window.historyPaths = [];
95
- }
96
- }
97
- return window.historyPaths;
98
- }
99
-
100
- function setHistoryPaths(paths) {
101
- window.historyPaths = paths;
102
- sessionStorage.setItem(historyPathsStoreKey, JSON.stringify(paths));
103
- }
104
-
105
- function triggerBroadcastHistoryPathsChanged(button) {
106
- if (button) {
107
- button.props.dispatchEvent('click', {});
108
- }
109
- }
110
-
111
- function debounce(fn, delay) {
112
- let time = null;
113
- return function (...args) {
114
- if (time) {
115
- clearTimeout(time);
116
- }
117
- time = setTimeout(() => {
118
- fn.apply(this, args);
119
- }, delay)
120
- }
121
- }
122
-
123
- function getOpenerLevel(opener, level) {
124
- if (level > 3) {
125
- return level + 1;
126
- }
127
- if (!!opener['opener']) {
128
- return getOpenerLevel(opener['opener'], level + 1);
129
- } else {
130
- return level;
131
- }
132
- }
133
-
134
-
135
- function goBack(){
136
- let prevPath = popHistoryPath();
137
- if(prevPath && prevPath.path){
138
- FlowRouter.go(prevPath.path);
139
- }
140
- }
141
-
142
- window.goBack = goBack;
143
-
144
- ; (function () {
145
- try {
146
- Meteor.startup(function () {
147
- Object.assign(Steedos, {
148
- goBack
149
- });
150
- var rootId = "steedosHistoryPathsRoot";
151
- var modalRoot = document.getElementById(rootId);
152
- if (!modalRoot) {
153
- modalRoot = document.createElement('div');
154
- modalRoot.setAttribute('id', rootId);
155
- $("body")[0].appendChild(modalRoot);
156
- }
157
- const page = {
158
- name: "pageSteedosHistoryPaths",
159
- render_engine: "amis",
160
- schema: {
161
- name: "serviceSteedosHistoryPaths",
162
- id: "serviceSteedosHistoryPaths",
163
- type: "service",
164
- className: "service-steedos-history-paths",
165
- body: [{
166
- "type": "button",
167
- "label": "触发@history_paths.changed",
168
- "name": "buttonTriggerHistoryPathsChange",
169
- "className": "button-trigger-history-paths-change hidden",
170
- "onEvent": {
171
- "click": {
172
- "actions": [
173
- {
174
- "actionType": "broadcast",
175
- "args": {
176
- "eventName": "@history_paths.changed"
177
- }
178
- }
179
- ]
180
- }
181
- }
182
- }]
183
- }
184
- };
185
- const root = $("#" + rootId)[0];
186
- Tracker.autorun(function (c) {
187
- if (Creator.steedosInit.get() && Creator.validated.get()) {
188
- Steedos.Page.render(root, page, {});
189
- const findVars = (obj, vars) => {
190
- try {
191
- return vars.length === vars.filter(function (item) {
192
- return item.split(".").reduce(function (sum, n) {
193
- return sum[n];
194
- }, obj) !== undefined;
195
- }).length;
196
- }
197
- catch (ex) {
198
- return false;
199
- }
200
- }
201
- Promise.all([
202
- waitForThing(window, 'SteedosUI'),
203
- ]).then(() => {
204
- const waittingVars = ["SteedosUI.refs.serviceSteedosHistoryPaths.getComponentByName"];
205
- Promise.all([
206
- waitForThing(window, waittingVars, findVars)
207
- ]).then(() => {
208
- var scope = SteedosUI.refs["serviceSteedosHistoryPaths"];
209
- buttonTriggerHistoryPathsChange = scope.getComponentByName("serviceSteedosHistoryPaths.buttonTriggerHistoryPathsChange");
210
- });
211
- });
212
- }
213
- });
214
- });
215
-
216
- } catch (error) {
217
- console.error(error)
218
- };
219
- })();
220
-
221
-
222
- // 使用debounce防抖动函数,连续多次自动触发enter事件时,只需要捕获最后一次
223
- FlowRouter.triggers.enter(debounce(function (context, redirect, stop) {
224
- if(!!window.opener){
225
- // 记录详细页面点击右上角查看审批单等打开新窗口情况下,新窗口的history path继承了opener页面的history path,所以需要区别出来,否则会报错
226
- historyPathsStoreKey = "history_paths_opener_level" + getOpenerLevel(window,0);
227
- }
228
- const path = context.path;
229
- const params = context.params || {};
230
- // const pathDef = context.route.pathDef;
231
- const recordId = params.record_id;
232
- var paths = getHistoryPaths() || [];
233
- let lastPath = paths && paths[paths.length - 1];
234
- if (recordId) {
235
- //判断当前路由与记录的路由是否相同,为解决从设计器微页面返回重复记录的问题#4978
236
- var top0 = null;
237
- if(lastPath && lastPath.path && lastPath.path.split){
238
- top0 = lastPath.path.split('?')[0]
239
- }
240
- if(path.split('?')[0] != top0){
241
- // 触发广播事件前,把当前path和params累加存入amis变量historyPaths中
242
- pushHistoryPath(path, params);
243
- }
244
- }
245
- else {
246
- clearHistoryFilters(context, lastPath, paths);
247
- // 触发广播事件前重置amis变量historyPaths值为空数组,并把当前path和params存入amis变量historyPaths中
248
- resetHistoryPath(path, params);
249
- }
250
- triggerBroadcastHistoryPathsChanged(buttonTriggerHistoryPathsChange);
251
- }, 200));
@@ -1,8 +0,0 @@
1
- Tracker.autorun(function(e) {
2
- if (Creator.validated.get()){
3
- const token = Creator.USER_CONTEXT.user.authToken;
4
- if (token) {
5
- localStorage.setItem("steedos:token", token);
6
- }
7
- }
8
- })
@@ -1,55 +0,0 @@
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
- // }
@@ -1,39 +0,0 @@
1
- name: amis_edit
2
- amis_schema: |-
3
- {
4
- "type": "service",
5
- "body": [
6
- {
7
- "type": "button",
8
- "label": "${'apps.amis_edit.edit' | t}",
9
- "id": "u:standard_edit",
10
- "onEvent": {
11
- "click": {
12
- "actions": [
13
- {
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 = t('apps.amis_edit.edit_apps');\n doAction({\n \"actionType\": \"dialog\",\n \"dialog\": {\n \"type\": \"dialog\",\n \"title\": title,\n \"body\": [formSchema],\n \"size\": \"lg\"\n }\n });\n}"
16
- }
17
- ],
18
- "weight": 0
19
- }
20
- },
21
- "className": ""
22
- }
23
- ],
24
- "regions": [
25
- "body"
26
- ],
27
- "data": {
28
- },
29
- "bodyClassName": "p-0",
30
- "id": "u:15c4ad9486da"
31
- }
32
- is_enable: true
33
- label: 编辑
34
- 'on': record_only
35
- type: amis_button
36
- visible: !!js/function |
37
- function (object_name, record_id, record_permissions, record) {
38
- return Creator.baseObject.actions.standard_edit.visible(object_name, record_id, record_permissions) && !record.is_system;
39
- }
@@ -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-10-09 15:44:47
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}&locale=${Builder.settings.locale}`);
11
- },
12
- amis_nav_schema_designVisible: function (object_name, record_id, record_permissions, data) {
13
- var perms = {};
14
- var record = data.record;
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,43 +0,0 @@
1
- name: amis_new
2
- amis_schema: |-
3
- {
4
- "type": "service",
5
- "body": [
6
- {
7
- "type": "button",
8
- "label": "${'apps.amis_new.new' | t}",
9
- "id": "u:standard_new",
10
- "onEvent": {
11
- "click": {
12
- "actions": [
13
- {
14
- "actionType": "custom",
15
- "componentId": "",
16
- "args": {},
17
- "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 = t('apps.amis_new.new_apps');\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}"
18
- }
19
- ],
20
- "weight": 0
21
- }
22
- },
23
- "className": "",
24
- "level": "default"
25
- }
26
- ],
27
- "regions": [
28
- "body"
29
- ],
30
- "data": {
31
- },
32
- "bodyClassName": "p-0",
33
- "id": "u:15c4ad9486da"
34
- }
35
- is_enable: true
36
- label: 新建
37
- 'on': list
38
- type: amis_button
39
- visible: !!js/function |
40
- function (object_name) {
41
- return Creator.baseObject.actions.standard_new.visible();
42
- }
43
-
@@ -1,56 +0,0 @@
1
- /*
2
- * @Author: baozhoutao@steedos.com
3
- * @Date: 2024-03-30 11:37:53
4
- * @LastEditors: baozhoutao@steedos.com
5
- * @LastEditTime: 2024-04-15 10:43:38
6
- * @Description:
7
- */
8
- module.exports = {
9
- disable: function (object_name, record_id) {
10
- const record = Creator.odata.get(object_name, record_id);
11
- const nodesSelect = Steedos.PackageRegistry.getNodesSelect();
12
- swal({
13
- title: '停用',
14
- text: `确定要停用${record.name}?${nodesSelect}`,
15
- html: true,
16
- showCancelButton: true,
17
- confirmButtonText: '停用',
18
- cancelButtonText: TAPi18n.__('Cancel')
19
- }, function (option) {
20
- if (option) {
21
- toastr.info(t('停用中,请稍后...'), null, {timeOut: false});
22
- Steedos.authRequest(Steedos.absoluteUrl(`/api/v1/apps/${record_id}`), {
23
- type: 'put', async: false, data: JSON.stringify({
24
- doc: {
25
- visible: false
26
- }
27
- }),
28
- success: function(){
29
- setTimeout(function(){
30
- if (record_id) {
31
- SteedosUI.reloadRecord(object_name, record_id)
32
- }
33
- toastr.clear();
34
- toastr.success(t('steedos_packages.disable.toastr_success'));
35
- FlowRouter.reload()
36
- }, 100)
37
- },
38
- error: function(XMLHttpRequest){
39
- toastr.clear();
40
- toastr.error(XMLHttpRequest.responseJSON.error);
41
- }
42
- })
43
- }
44
- })
45
- },
46
- disableVisible: function (object_name, record_id) {
47
- const record = Creator.odata.get(object_name, record_id);
48
- if(record._id == record.code){
49
- return false
50
- }
51
- if(record.visible){
52
- return true;
53
- }
54
- return false;
55
- }
56
- }
@@ -1,4 +0,0 @@
1
- name: disable
2
- is_enable: true
3
- label: 停用
4
- 'on': record
@@ -1,60 +0,0 @@
1
- /*
2
- * @Author: baozhoutao@steedos.com
3
- * @Date: 2024-03-30 11:37:53
4
- * @LastEditors: baozhoutao@steedos.com
5
- * @LastEditTime: 2024-04-15 10:43:45
6
- * @Description:
7
- */
8
- module.exports = {
9
- enable: function (object_name, record_id) {
10
- const record = Creator.odata.get(object_name,record_id);
11
- const nodesSelect = Steedos.PackageRegistry.getNodesSelect();
12
- swal({
13
- title: `启用`,
14
- text: `确定要启用${record.name}?${nodesSelect}`,
15
- html: true,
16
- showCancelButton: true,
17
- confirmButtonText: '启用',
18
- cancelButtonText: TAPi18n.__('Cancel')
19
- }, function (option) {
20
- if (option) {
21
- toastr.info('启用中,请稍后...', null, {timeOut: false});
22
- Steedos.authRequest(Steedos.absoluteUrl(`/api/v1/apps/${record_id}`), {type: 'put', async: false, data: JSON.stringify({
23
- doc: {
24
- visible: true
25
- }
26
- }),
27
- success: function(data){
28
- if(data.status == 1){
29
- toastr.clear();
30
- toastr.error(data.msg);
31
- return;
32
- }
33
- setTimeout(function(){
34
- if (FlowRouter.current().params.record_id) {
35
- SteedosUI.reloadRecord(object_name, record_id)
36
- }
37
- toastr.clear();
38
- toastr.success('已启用');
39
- FlowRouter.reload()
40
- }, 100)
41
- },
42
- error: function(XMLHttpRequest){
43
- toastr.clear();
44
- toastr.error(XMLHttpRequest.responseJSON.error);
45
- }
46
- })
47
- }
48
- })
49
- },
50
- enableVisible: function (object_name,record_id) {
51
- const record = Creator.odata.get(object_name,record_id);
52
- if(record._id == record.code){
53
- return false
54
- }
55
- if(record.visible){
56
- return false;
57
- }
58
- return true
59
- }
60
- }
@@ -1,4 +0,0 @@
1
- name: enable
2
- is_enable: true
3
- label: 启用
4
- 'on': record
@@ -1,94 +0,0 @@
1
- const core = require('@steedos/core');
2
- db.apps = Creator.Collections.apps ? Creator.Collections.apps : core.newCollection('apps')
3
-
4
- db.apps.isInternalApp = function (url) {
5
- var app_url, i, len, ref;
6
- if (url && db.apps.INTERNAL_APPS) {
7
- ref = db.apps.INTERNAL_APPS;
8
- for (i = 0, len = ref.length; i < len; i++) {
9
- app_url = ref[i];
10
- if (url.startsWith(app_url)) {
11
- return true;
12
- }
13
- }
14
- }
15
- return false;
16
- };
17
-
18
- if (Meteor.isServer) {
19
- db.apps.allow({
20
- insert: function (userId, doc) {
21
- if (!Steedos.isSpaceAdmin(doc.space, userId)) {
22
- return false;
23
- } else {
24
- return true;
25
- }
26
- },
27
- update: function (userId, doc) {
28
- if (!Steedos.isSpaceAdmin(doc.space, userId)) {
29
- return false;
30
- } else {
31
- return true;
32
- }
33
- },
34
- remove: function (userId, doc) {
35
- if (!Steedos.isSpaceAdmin(doc.space, userId)) {
36
- return false;
37
- } else {
38
- return true;
39
- }
40
- }
41
- });
42
- }
43
-
44
- if (Meteor.isServer) {
45
- // db.apps.before.insert (userId, doc) ->
46
- // doc.internal = db.apps.isInternalApp(doc.url)
47
- // return
48
- db.apps.before.update(function (userId, doc, fieldNames, modifier, options) {
49
- return modifier.$set = modifier.$set || {};
50
- });
51
- }
52
-
53
- Fiber = require('fibers')
54
-
55
- var getUserOrganizations = function(userId, spaceId){
56
- var space_user = db.space_users.findOne({user:userId,space:spaceId}, {fields:{organizations:1}})
57
- if(!space_user){
58
- return []
59
- }
60
- var organizations = space_user.organizations
61
- if(!organizations){
62
- return []
63
- }
64
- var userOrgs = db.organizations.find({_id:{$in:organizations}}).fetch()
65
- var parents = _.flatten(_.pluck(userOrgs, 'parents'))
66
- return _.union(organizations,parents)
67
- }
68
-
69
- var getUserApps = function (userId, spaceId) {
70
- var userOrgs = getUserOrganizations(userId, spaceId);
71
- var selector = {
72
- $or: [
73
- {$or: [{space: {$exists: false}}, {space: spaceId}]},
74
- { 'members.organizations': {$in: userOrgs} },
75
- { 'members.users': {$in: [ userId ]} }
76
- ]
77
- }
78
- return db.apps.find(selector, {sort: {sort: 1}}).fetch();
79
- };
80
-
81
- // Creator.Objects['apps'].methods = {
82
- // safe_apps: function (req, res) {
83
- // return Fiber(function () {
84
- // var userSession = req.user
85
- // var userId = userSession.userId
86
- // var spaceId = userSession.spaceId
87
- // var apps = getUserApps(userId, spaceId);
88
- // return res.send({
89
- // "@odata.count": apps.length,
90
- // value: apps
91
- // });
92
- // }).run();
93
- // }
94
- // }
@@ -1,90 +0,0 @@
1
- /*
2
- * @Author: baozhoutao@steedos.com
3
- * @Date: 2022-08-05 14:17:44
4
- * @LastEditors: baozhoutao@steedos.com
5
- * @LastEditTime: 2023-10-09 15:46:06
6
- * @Description:
7
- */
8
- const _ = require('underscore');
9
- const clone = require("clone");
10
- const objectql = require("@steedos/objectql");
11
- const i18n = require("@steedos/i18n");
12
- const auth = require("@steedos/auth");
13
- const InternalData = require('@steedos/standard-objects').internalData;
14
- const SERVICE_NAME = `~database-apps`;
15
- const permissions = {
16
- allowEdit: false,
17
- allowDelete: false,
18
- allowRead: true,
19
- }
20
-
21
- const baseRecord = {
22
- is_system:true,
23
- visible: true,
24
- record_permissions:permissions
25
- }
26
-
27
- const getLng = async function(userId){
28
- const userSession = await auth.getSessionByUserId(userId);
29
- return userSession ? userSession.language : null;
30
- }
31
-
32
- module.exports = {
33
-
34
- beforeFind: async function () {
35
- delete this.query.fields;
36
- },
37
-
38
- afterFind: async function () {
39
- const { spaceId } = this;
40
- let query = InternalData.parserFilters(this.query.filters);
41
- let isSystem = query.is_system;
42
- if(!_.isEmpty(isSystem) || _.isBoolean(isSystem)){
43
- if(_.isObject(isSystem) && isSystem["$ne"]){
44
- return;
45
- }
46
- }
47
- if(_.isArray(this.data.values)){
48
- let lng = await getLng(this.userId);
49
- let self = this;
50
- let allApps = clone(await objectql.getAppConfigs(this.spaceId));
51
- let apps = {}
52
- _.each(allApps, function(app){
53
- if(app.is_creator || app.mobile){
54
- apps[app._id] = app
55
- apps[app._id] = app
56
- }
57
- })
58
- i18n.translationApps(lng, apps)
59
- _.each(apps, function(app){
60
- app.name = app.label
61
- if(!_.find(self.data.values, function(item){return item.code === app._id || item._id === app._id})){
62
- self.data.values.push(Object.assign({code: app._id}, clone(app), baseRecord));
63
- }
64
- })
65
- self.data.values = objectql.getSteedosSchema().metadataDriver.find(self.data.values, self.query, spaceId);
66
- }
67
- },
68
-
69
- afterCount: async function () {
70
- try {
71
- this.query.fields.push('name');
72
- this.query.fields.push('code');
73
- } catch (error) {
74
-
75
- }
76
- let result = await objectql.getObject('apps').find(this.query, await auth.getSessionByUserId(this.userId, this.spaceId))
77
- this.data.values = result.length
78
- },
79
- afterFindOne: async function () {
80
- let id = this.id;
81
- if(id && _.isEmpty(this.data.values)){
82
- let lng = await getLng(this.userId);
83
- let app = await objectql.getAppConfig(id);
84
- if(app){
85
- i18n.translationApp(lng, app._id, app)
86
- Object.assign(this.data.values, Object.assign({code: app._id}, clone(app), baseRecord))
87
- }
88
- }
89
- }
90
- }