@steedos/standard-ui 2.5.0-beta.9 → 2.5.1

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,6 +12,7 @@ tab_groups:
12
12
  - group_name: 对象设置
13
13
  - group_name: 用户界面
14
14
  - group_name: 统计分析
15
+ - group_name: 开发
15
16
  - group_name: 流程自动化
16
17
  - group_name: 审批王
17
18
  - group_name: 高级设置
@@ -53,8 +54,8 @@ tab_items:
53
54
  group: 对象设置
54
55
  index: 13
55
56
  admin_queue_import:
56
- group: 对象设置
57
- index: 14
57
+ group: 高级设置
58
+ index: 38
58
59
  admin_pages:
59
60
  group: 用户界面
60
61
  index: 15
@@ -70,6 +71,15 @@ tab_items:
70
71
  admin_stimulsoft_reports:
71
72
  group: 统计分析
72
73
  index: 19
74
+ admin_developer:
75
+ group: 开发
76
+ index: 19.50
77
+ admin_developer_triggers:
78
+ group: 开发
79
+ index: 19.51
80
+ admin_developer_graphql:
81
+ group: 开发
82
+ index: 19.52
73
83
  admin_process_definition:
74
84
  group: 流程自动化
75
85
  index: 20
@@ -118,29 +128,29 @@ tab_items:
118
128
  admin_sessions:
119
129
  group: 高级设置
120
130
  index: 34
121
- admin_dashboard:
122
- group: 高级设置
123
- index: 35
131
+ # admin_dashboard:
132
+ # group: 高级设置
133
+ # index: 35
124
134
  admin_audit_records:
125
135
  group: 高级设置
126
136
  index: 36
127
137
  admin_autonumber:
128
138
  group: 高级设置
129
139
  index: 37
130
- admin_web_forms:
131
- group: 高级设置
132
- index: 38
140
+ # admin_web_forms:
141
+ # group: 高级设置
142
+ # index: 38
133
143
  admin_holidays:
134
144
  group: 高级设置
135
145
  index: 39
136
146
  admin_business_hours:
137
147
  group: 高级设置
138
148
  index: 40
139
- admin_object_webhooks:
140
- group: 高级设置
141
- index: 41
149
+ # admin_object_webhooks:
150
+ # group: 高级设置
151
+ # index: 41
142
152
  admin_api_keys:
143
- group: 高级设置
153
+ group: 开发
144
154
  index: 42
145
155
  objects: []
146
156
  sort: 9100
@@ -0,0 +1,199 @@
1
+ /*
2
+ * @Author: 殷亮辉 yinlianghui@hotoa.com
3
+ * @Date: 2023-05-16 17:00:38
4
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
5
+ * @LastEditTime: 2023-05-28 10:13:45
6
+ */
7
+ var buttonTriggerHistoryPathsChange;
8
+ ; (function () {
9
+ try {
10
+ var rootId = "steedosHistoryPathsRoot";
11
+ var modalRoot = document.getElementById(rootId);
12
+ if (!modalRoot) {
13
+ modalRoot = document.createElement('div');
14
+ modalRoot.setAttribute('id', rootId);
15
+ $("body")[0].appendChild(modalRoot);
16
+ }
17
+ const page = {
18
+ name: "pageSteedosHistoryPaths",
19
+ render_engine: "amis",
20
+ schema: {
21
+ name: "serviceSteedosHistoryPaths",
22
+ id: "serviceSteedosHistoryPaths",
23
+ type: "service",
24
+ className: "service-steedos-history-paths",
25
+ body: [{
26
+ "type": "button",
27
+ "label": "触发@history_paths.changed",
28
+ "name": "buttonTriggerHistoryPathsChange",
29
+ "className": "button-trigger-history-paths-change hidden",
30
+ "onEvent": {
31
+ "click": {
32
+ "actions": [
33
+ {
34
+ "actionType": "broadcast",
35
+ "args": {
36
+ "eventName": "@history_paths.changed"
37
+ }
38
+ }
39
+ ]
40
+ }
41
+ }
42
+ }]
43
+ }
44
+ };
45
+ Meteor.startup(function () {
46
+ const root = $("#" + rootId)[0];
47
+ Tracker.autorun(function (c) {
48
+ if (Creator.steedosInit.get() && Creator.validated.get()) {
49
+ Steedos.Page.render(root, page, {});
50
+ const findVars = (obj, vars) => {
51
+ try {
52
+ return vars.length === vars.filter(function (item) {
53
+ return item.split(".").reduce(function (sum, n) {
54
+ return sum[n];
55
+ }, obj) !== undefined;
56
+ }).length;
57
+ }
58
+ catch (ex) {
59
+ return false;
60
+ }
61
+ }
62
+ const waittingVars = ["SteedosUI.refs.serviceSteedosHistoryPaths.getComponentByName"];
63
+ Promise.all([
64
+ waitForThing(window, waittingVars, findVars)
65
+ ]).then(() => {
66
+ var scope = SteedosUI.refs["serviceSteedosHistoryPaths"];
67
+ buttonTriggerHistoryPathsChange = scope.getComponentByName("serviceSteedosHistoryPaths.buttonTriggerHistoryPathsChange");
68
+ Object.assign(Steedos, {
69
+ goBack
70
+ });
71
+ });
72
+ }
73
+ });
74
+ });
75
+
76
+ } catch (error) {
77
+ console.error(error)
78
+ };
79
+ })();
80
+
81
+ let historyPathsStoreKey = "history_paths";
82
+
83
+ // 使用debounce防抖动函数,连续多次自动触发enter事件时,只需要捕获最后一次
84
+ FlowRouter.triggers.enter(debounce(function (context, redirect, stop) {
85
+ if(!!window.opener){
86
+ // 记录详细页面点击右上角查看审批单等打开新窗口情况下,新窗口的history path继承了opener页面的history path,所以需要区别出来,否则会报错
87
+ historyPathsStoreKey = "history_paths_opener_level" + getOpenerLevel(window,0);
88
+ }
89
+ const path = context.path;
90
+ const params = context.params || {};
91
+ // const pathDef = context.route.pathDef;
92
+ const recordId = params.record_id;
93
+ if (recordId) {
94
+ // 触发广播事件,把当前path和params累加存入amis变量historyPaths中
95
+ pushHistoryPath(path, params);
96
+ }
97
+ else {
98
+ // 触发广播事件重围amis变量historyPaths值为空数组,并把当前path和params存入amis变量historyPaths中
99
+ resetHistoryPath(path, params);
100
+ }
101
+ triggerBroadcastHistoryPathsChanged(buttonTriggerHistoryPathsChange);
102
+ }, 200));
103
+
104
+ function goBack(){
105
+ let prevPath = popHistoryPath();
106
+ if(prevPath && prevPath.path){
107
+ FlowRouter.go(prevPath.path);
108
+ }
109
+ }
110
+
111
+ /**
112
+ * 移除最后一个path,并且返回要返回的上一个path
113
+ * 如果是从推送通知中点开进入记录详细页面,则返回当前记录所属对象的列表页面
114
+ */
115
+ function popHistoryPath() {
116
+ var paths = getHistoryPaths() || [];
117
+ let lastPath = paths && paths[paths.length - 1];
118
+ paths.pop();
119
+ setHistoryPaths(paths);
120
+ let prevPath = paths && paths[paths.length - 1];
121
+ if(!prevPath && lastPath){
122
+ // 如果是从推送通知中点开进入记录详细页面,在paths.pop()前的paths肯定只有当前记录详细页面的path
123
+ // 此时lastPath肯定是记录详细页面,值如以下格式:
124
+ /**{
125
+ "path": "/app/projects/project_program/view/6465c790f85da77bbccefbe6",
126
+ "params": {
127
+ "app_id": "projects",
128
+ "object_name": "project_program",
129
+ "record_id": "6465c790f85da77bbccefbe6"
130
+ }
131
+ }**/
132
+ prevPath = {
133
+ path: `/app/${lastPath.params.app_id || "-"}/${lastPath.params.object_name}`,
134
+ params: {
135
+ app_id: lastPath.params.app_id,
136
+ object_name: lastPath.params.object_name
137
+ }
138
+ }
139
+ }
140
+ return prevPath;
141
+ }
142
+
143
+ function pushHistoryPath(path, params) {
144
+ let paths = getHistoryPaths() || [];
145
+ let lastPath = paths && paths[paths.length - 1];
146
+ if(lastPath && lastPath.path === path){
147
+ // 点返回按钮执行goBack函数触发FlowRouter.triggers.enter从而进入该函数,此时lastPath肯定跟传入的path值一样,正好排除掉不重复加入paths
148
+ return;
149
+ }
150
+ paths.push({ path, params });
151
+ setHistoryPaths(paths);
152
+ }
153
+
154
+ function resetHistoryPath(path, params) {
155
+ setHistoryPaths([{ path, params }]);
156
+ }
157
+
158
+ function getHistoryPaths() {
159
+ if (!window.historyPaths) {
160
+ var paths = sessionStorage.getItem(historyPathsStoreKey);
161
+ if (paths) {
162
+ window.historyPaths = JSON.parse(paths);
163
+ }else{
164
+ window.historyPaths = [];
165
+ }
166
+ }
167
+ return window.historyPaths;
168
+ }
169
+
170
+ function setHistoryPaths(paths) {
171
+ window.historyPaths = paths;
172
+ sessionStorage.setItem(historyPathsStoreKey, JSON.stringify(paths));
173
+ }
174
+
175
+ function triggerBroadcastHistoryPathsChanged(button) {
176
+ if (button) {
177
+ button.props.dispatchEvent('click', {});
178
+ }
179
+ }
180
+
181
+ function debounce(fn, delay) {
182
+ let time = null;
183
+ return function (...args) {
184
+ if (time) {
185
+ clearTimeout(time);
186
+ }
187
+ time = setTimeout(() => {
188
+ fn.apply(this, args);
189
+ }, delay)
190
+ }
191
+ }
192
+
193
+ function getOpenerLevel(opener,level){
194
+ if (!!opener['opener']) {
195
+ return getOpenerLevel(opener['opener'], level + 1);
196
+ }else{
197
+ return level;
198
+ }
199
+ }
@@ -63,6 +63,8 @@ fields:
63
63
  hidden: true
64
64
  tab_groups.$.group_name:
65
65
  type: text
66
+ tab_groups.$.default_open:
67
+ type: boolean
66
68
  tab_items:
67
69
  label: Tabs
68
70
  type: object
@@ -167,6 +169,7 @@ fields:
167
169
  label: Open with iframe
168
170
  defaultValue: false
169
171
  group: External Application
172
+ visible_on: "{{false}}"
170
173
  is_new_window:
171
174
  type: boolean
172
175
  label: Open in New Window
@@ -29,7 +29,6 @@ fields:
29
29
  icon: svg
30
30
  });
31
31
  });
32
-
33
32
  return options;
34
33
  }
35
34
  parent:
@@ -1,8 +1,8 @@
1
- name: admin_stimulsoft_reports
1
+ name: admin_developer_graphql
2
2
  desktop: true
3
3
  icon: entity
4
- is_new_window: false
5
- label: 报表
4
+ is_new_window: true
5
+ label: Graphql IDE
6
6
  mobile: true
7
7
  permissions:
8
8
  - permission: 'on'
@@ -18,4 +18,4 @@ permissions:
18
18
  - permission: 'off'
19
19
  permission_set: workflow_admin
20
20
  type: url
21
- url: /app/admin/stimulsoft_reports/grid/all
21
+ url: /graphql
@@ -1,8 +1,8 @@
1
- name: admin_license
1
+ name: admin_developer_triggers
2
2
  desktop: true
3
- icon: webcart
3
+ icon: choice
4
4
  is_new_window: false
5
- label: 许可证
5
+ label: 触发器
6
6
  mobile: true
7
7
  permissions:
8
8
  - permission: 'on'
@@ -18,4 +18,4 @@ permissions:
18
18
  - permission: 'off'
19
19
  permission_set: workflow_admin
20
20
  type: url
21
- url: /app/admin/license/grid/all
21
+ url: /app/admin/object_triggers/grid/all
@@ -1,3 +1,10 @@
1
+ /*
2
+ * @Author: baozhoutao@steedos.com
3
+ * @Date: 2022-08-05 14:17:44
4
+ * @LastEditors: baozhoutao@steedos.com
5
+ * @LastEditTime: 2023-05-06 11:52:46
6
+ * @Description:
7
+ */
1
8
  const _ = require('underscore');
2
9
  const clone = require("clone");
3
10
  const objectql = require("@steedos/objectql");
@@ -38,37 +45,8 @@ module.exports = {
38
45
  let allApps = clone(await objectql.getAppConfigs(this.spaceId));
39
46
  let apps = {}
40
47
  _.each(allApps, function(app){
41
- if(app.is_creator){
48
+ if(app.is_creator || app.mobile){
42
49
  apps[app._id] = app
43
- }
44
- })
45
- i18n.translationApps(lng, apps)
46
- _.each(apps, function(app){
47
- app.name = app.label
48
- if(!_.find(self.data.values, function(item){return item.code === app._id || item._id === app._id})){
49
- self.data.values.push(Object.assign({code: app._id}, clone(app), baseRecord));
50
- }
51
- })
52
- // console.log(`find this.query`, self.query, objectql.getSteedosSchema().metadataDriver.find(self.data.values, this.query, spaceId))
53
- self.data.values = objectql.getSteedosSchema().metadataDriver.find(self.data.values, self.query, spaceId);
54
- }
55
- },
56
- afterAggregate: async function () {
57
- const { spaceId } = this;
58
- let query = InternalData.parserFilters(this.query.filters);
59
- let isSystem = query.is_system;
60
- if(!_.isEmpty(isSystem) || _.isBoolean(isSystem)){
61
- if(_.isObject(isSystem) && isSystem["$ne"]){
62
- return;
63
- }
64
- }
65
- if(_.isArray(this.data.values)){
66
- let lng = await getLng(this.userId);
67
- let self = this;
68
- let allApps = clone(await objectql.getAppConfigs(this.spaceId));
69
- let apps = {}
70
- _.each(allApps, function(app){
71
- if(app.is_creator){
72
50
  apps[app._id] = app
73
51
  }
74
52
  })
@@ -79,16 +57,10 @@ module.exports = {
79
57
  self.data.values.push(Object.assign({code: app._id}, clone(app), baseRecord));
80
58
  }
81
59
  })
60
+ self.data.values = objectql.getSteedosSchema().metadataDriver.find(self.data.values, self.query, spaceId);
82
61
  }
83
- // 获取的apps根据保存的值进行过滤
84
- // const allData = this.data.values;
85
- // const firstFilterKey = _.keys(query)[0];
86
- // this.data.values = _.filter(allData, (item)=>{
87
- // return item[firstFilterKey] === query[firstFilterKey];
88
- // })
89
- // console.log(`afterAggregate this.query`, this.query, objectql.getSteedosSchema().metadataDriver.find(this.data.values, this.query, spaceId))
90
- this.data.values = objectql.getSteedosSchema().metadataDriver.find(this.data.values, this.query, spaceId);
91
62
  },
63
+
92
64
  afterCount: async function () {
93
65
  try {
94
66
  this.query.fields.push('name');
@@ -104,32 +76,8 @@ module.exports = {
104
76
  if(id && _.isEmpty(this.data.values)){
105
77
  let lng = await getLng(this.userId);
106
78
  let app = await objectql.getAppConfig(id);
107
- // let allApps = clone(await objectql.getAppConfigs(this.spaceId));
108
- // let apps = {}
109
- // _.each(allApps, function(app){
110
- // if(app._id === id && app.is_creator){
111
- // apps[app._id] = app
112
- // }
113
- // })
114
79
  i18n.translationApp(lng, app._id, app)
115
80
  Object.assign(this.data.values, Object.assign({code: app._id}, clone(app), baseRecord))
116
- // let sefl = this;
117
- // _.each(apps, function(app){
118
- // app.name = app.label
119
- // Object.assign(sefl.data.values, Object.assign({code: app._id}, clone(app), baseRecord))
120
- // })
121
81
  }
122
- },
123
- // afterInsert: async function () {
124
- // const record = await this.getObject('apps').findOne(this.doc._id);
125
- // await objectql.addAppConfig(record, SERVICE_NAME)
126
- // },
127
- // afterUpdate: async function () {
128
- // const record = await this.getObject('apps').findOne(this.id);
129
- // await objectql.addAppConfig(record, SERVICE_NAME)
130
- // },
131
- // afterDelete: async function(){
132
- // let id = this.id;
133
- // objectql.removeApp(id)
134
- // }
82
+ }
135
83
  }
@@ -1,18 +1,25 @@
1
1
  /*
2
2
  * @Author: sunhaolin@hotoa.com
3
3
  * @Date: 2021-09-10 16:44:24
4
- * @LastEditors: sunhaolin@hotoa.com
5
- * @LastEditTime: 2022-07-30 09:56:44
4
+ * @LastEditors: baozhoutao@steedos.com
5
+ * @LastEditTime: 2023-04-21 11:09:05
6
6
  * @Description:
7
7
  */
8
8
  const util = require('@steedos/standard-objects').util;
9
9
  const _ = require('lodash');
10
+ const objectql = require('@steedos/objectql')
10
11
  module.exports = {
11
12
  listenTo: 'tabs',
12
13
 
13
14
  beforeInsert: async function(){
14
15
  const { object_name, doc } = this;
15
16
  await util.checkAPIName(object_name, 'name', doc.name, undefined);
17
+ if(doc.type === 'object'){
18
+ const records = await objectql.getObject('tabs').count({filters: [['type', '=', 'object'], ['object', '=', doc.object]]});
19
+ if(records > 0){
20
+ throw new Error('对象选项卡已存在')
21
+ }
22
+ }
16
23
  },
17
24
 
18
25
  beforeUpdate: async function(){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/standard-ui",
3
- "version": "2.5.0-beta.9",
3
+ "version": "2.5.1",
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": "a2623b433dd42632dc54d23c51b718bd4d1a2fdc"
15
+ "gitHead": "793bcd4718210c693aa52d0280e9b1b2a8d3230e"
16
16
  }