@steedos/service-pages 2.2.22 → 2.2.25

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,9 @@ Steedos.Page = {
12
12
  Form: {
13
13
  StandardNew: {},
14
14
  StandardEdit: {}
15
+ },
16
+ reload: function(){
17
+ FlowRouter.reload();
15
18
  }
16
19
  };
17
20
 
@@ -108,11 +111,13 @@ Steedos.Page.render = function (root, page, data) {
108
111
 
109
112
  let schema = typeof page.schema === 'string' ? JSON.parse(page.schema) : page.schema;
110
113
  const defData = Object.assign({}, data, {
111
- context: {
112
- rootUrl: __meteor_runtime_config__.ROOT_URL,
113
- tenantId: Creator.USER_CONTEXT.spaceId,
114
- userId: Creator.USER_CONTEXT.userId,
115
- authToken: Creator.USER_CONTEXT.user.authToken
114
+ data: {
115
+ context: {
116
+ rootUrl: __meteor_runtime_config__.ROOT_URL,
117
+ tenantId: Creator.USER_CONTEXT.spaceId,
118
+ userId: Creator.USER_CONTEXT.userId,
119
+ authToken: Creator.USER_CONTEXT.user.authToken
120
+ }
116
121
  }
117
122
  })
118
123
 
@@ -128,7 +133,8 @@ Steedos.Page.render = function (root, page, data) {
128
133
  "name": upperFirst(page.render_engine),
129
134
  "options": {
130
135
  "schema": schema,
131
- "data": data
136
+ "data": data,
137
+ "name": page.name
132
138
  }
133
139
  },
134
140
  }
@@ -164,7 +170,7 @@ Steedos.Page.render = function (root, page, data) {
164
170
  return root;
165
171
  };
166
172
 
167
- Steedos.Page.App.render = function (template, pageName, app_id) {
173
+ Steedos.Page.App.render = function (template, pageName, app_id, options) {
168
174
  if (!pageName) {
169
175
  return;
170
176
  }
@@ -184,9 +190,9 @@ Steedos.Page.App.render = function (template, pageName, app_id) {
184
190
  const page = Steedos.Page.getPage('app', app_id, null, null, pageName);
185
191
  if (page) {
186
192
  if (page.render_engine && page.render_engine != 'redash') {
187
- return Steedos.Page.render(container, page, {
193
+ return Steedos.Page.render(container, page, Object.assign({}, options, {
188
194
  appId: app_id
189
- });
195
+ }));
190
196
  }
191
197
  }
192
198
 
@@ -196,7 +202,11 @@ Steedos.Page.App.render = function (template, pageName, app_id) {
196
202
  return container
197
203
  };
198
204
 
199
- Steedos.Page.Listview.render = function (template, objectApiName) {
205
+ Steedos.Page.Listview.getDefaultName = function (objectApiName, listViewName) {
206
+ return `listview_${objectApiName}_${listViewName}`;
207
+ };
208
+
209
+ Steedos.Page.Listview.render = function (template, objectApiName, options) {
200
210
  try {
201
211
  if (!template.data.regions || !objectApiName) {
202
212
  return;
@@ -215,14 +225,14 @@ Steedos.Page.Listview.render = function (template, objectApiName) {
215
225
  }
216
226
 
217
227
  if (page.render_engine && page.render_engine != 'redash') {
218
- return Steedos.Page.render($("#" + rootId)[0], page, data);
228
+ return Steedos.Page.render($("#" + rootId)[0], page, Object.assign({}, options, data));
219
229
  }
220
230
  } catch (error) {
221
231
 
222
232
  }
223
233
  };
224
234
 
225
- Steedos.Page.Record.render = function (template, objectApiName, recordId) {
235
+ Steedos.Page.Record.render = function (template, objectApiName, recordId, options) {
226
236
  try {
227
237
  if (!template.data.regions || !objectApiName || !recordId) {
228
238
  return;
@@ -240,14 +250,14 @@ Steedos.Page.Record.render = function (template, objectApiName, recordId) {
240
250
  }
241
251
 
242
252
  if (page.render_engine && page.render_engine != 'redash') {
243
- return Steedos.Page.render($("#" + rootId)[0], page, data);
253
+ return Steedos.Page.render($("#" + rootId)[0], page, Object.assign({}, options, data));
244
254
  }
245
255
  } catch (error) {
246
256
 
247
257
  }
248
258
  };
249
259
 
250
- Steedos.Page.RelatedListview.render = function (template, objectApiName) {
260
+ Steedos.Page.RelatedListview.render = function (template, objectApiName, options) {
251
261
  try {
252
262
  if (!template.data.regions || !objectApiName) {
253
263
  return;
@@ -266,23 +276,23 @@ Steedos.Page.RelatedListview.render = function (template, objectApiName) {
266
276
  }
267
277
 
268
278
  if (page.render_engine && page.render_engine != 'redash') {
269
- return Steedos.Page.render($("#" + rootId)[0], page, data);
279
+ return Steedos.Page.render($("#" + rootId)[0], page, Object.assign({}, options, data));
270
280
  }
271
281
  } catch (error) {
272
282
 
273
283
  }
274
284
  };
275
285
 
276
- Steedos.Page.Form.StandardNew.render = function (appId, objectApiName, title, initialValues) {
286
+ Steedos.Page.Form.StandardNew.render = function (appId, objectApiName, title, initialValues, options) {
277
287
  const page = Steedos.Page.getPage('form', appId, objectApiName);
278
288
  if (page && page.schema) {
279
289
  const elementId = getModalElement(`${objectApiName}-standard_new`);
280
- return Steedos.Page.render(elementId, page, {
290
+ return Steedos.Page.render(elementId, page, Object.assign({}, options, {
281
291
  appId: appId,
282
292
  objectName: objectApiName,
283
293
  title: title,
284
- initialValues: initialValues
285
- });
294
+ initialValues: initialValues,
295
+ }));
286
296
  }
287
297
 
288
298
  SteedosUI.showModal(stores.ComponentRegistry.components.ObjectForm, {
@@ -304,17 +314,16 @@ Steedos.Page.Form.StandardNew.render = function (appId, objectApiName, title, in
304
314
  }, null, { iconPath: '/assets/icons' });
305
315
  };
306
316
 
307
- Steedos.Page.Form.StandardEdit.render = function (appId, objectApiName, title, recordId) {
308
-
317
+ Steedos.Page.Form.StandardEdit.render = function (appId, objectApiName, title, recordId, options) {
309
318
  const page = Steedos.Page.getPage('form', appId, objectApiName, recordId);
310
319
  if (page && page.schema) {
311
320
  const elementId = getModalElement(`${objectApiName}-standard_edit`);
312
- return Steedos.Page.render(elementId, page, {
321
+ return Steedos.Page.render(elementId, page, Object.assign({}, options, {
313
322
  appId: appId,
314
323
  objectName: objectApiName,
315
324
  title: title,
316
325
  recordId: recordId
317
- });
326
+ }));
318
327
  }
319
328
 
320
329
  return SteedosUI.showModal(stores.ComponentRegistry.components.ObjectForm, {
@@ -330,7 +339,7 @@ Steedos.Page.Form.StandardEdit.render = function (appId, objectApiName, title, r
330
339
  SteedosUI.reloadRecord(objectApiName, recordId)
331
340
  } else {
332
341
  window.refreshDxSchedulerInstance()
333
- window.refreshGrid();
342
+ window.refreshGrid(options.gridName);
334
343
  }
335
344
  }, 1);
336
345
  return true;
@@ -5,4 +5,6 @@ reference_to: apps
5
5
  reference_to_field: code
6
6
  filters:
7
7
  - ['code','!=','admin']
8
- sort_no: 120
8
+ sort_no: 120
9
+ required: "{{(formData.type == 'appDefault' || formData.type == 'appRecordProfile') ? true : false}}"
10
+ visible_on: "{{(formData.type == 'appDefault' || formData.type == 'appRecordProfile') ? true : false}}"
@@ -1,6 +1,7 @@
1
1
  name: is_system
2
2
  type: boolean
3
- label: System
4
- omit: true
3
+ label: 系统
4
+ visible_on: "{{global.mode ==='read' ? true : false}}"
5
5
  readonly: true
6
- disabled: true
6
+ disabled: true
7
+ sort_no: 999
@@ -2,4 +2,5 @@ name: page
2
2
  label: 页面
3
3
  type: master_detail
4
4
  reference_to: pages
5
- sort_no: 110
5
+ sort_no: 110
6
+ required: true
@@ -4,5 +4,6 @@ label: 简档
4
4
  reference_to: permission_set
5
5
  filters:
6
6
  - ["type","=","profile"]
7
- visible_on: "{{formData.app ? true: false}}"
8
- sort_no: 125
7
+ sort_no: 125
8
+ required: "{{formData.type == 'appRecordProfile' ? true : false}}"
9
+ visible_on: "{{formData.type == 'appRecordProfile' ? true : false}}"
@@ -0,0 +1,12 @@
1
+ name: type
2
+ label: 授权类型
3
+ type: select
4
+ required: true
5
+ defaultValue: orgDefault
6
+ options:
7
+ - label: 组织默认设置
8
+ value: orgDefault
9
+ - label: 应用程序默认设置
10
+ value: appDefault
11
+ - label: 应用程序和简档
12
+ value: appRecordProfile
@@ -1,5 +1,6 @@
1
1
  name: all
2
2
  columns:
3
+ - field: type
3
4
  - field: app
4
5
  - field: profile
5
6
  - field: record_type
@@ -1,5 +1,6 @@
1
1
  name: recent
2
2
  columns:
3
+ - field: type
3
4
  - field: app
4
5
  - field: profile
5
6
  - field: record_type
@@ -7,7 +7,7 @@ enable_chatter: false
7
7
  enable_enhanced_lookup: false
8
8
  enable_events: false
9
9
  enable_files: false
10
- enable_inline_edit: true
10
+ enable_inline_edit: false
11
11
  enable_instances: false
12
12
  enable_notes: false
13
13
  enable_search: false
@@ -2,5 +2,4 @@ name: is_active
2
2
  label: 已发布
3
3
  sort_no: 130
4
4
  readonly: true
5
- omit: true
6
5
  type: boolean
@@ -2,5 +2,4 @@ name: version
2
2
  type: number
3
3
  label: 版本号
4
4
  scale: 0
5
- omit: true
6
5
  readonly: true
@@ -1,6 +1,7 @@
1
1
  name: is_system
2
2
  type: boolean
3
3
  label: 系统
4
- omit: true
4
+ visible_on: "{{global.mode ==='read' ? true : false}}"
5
5
  readonly: true
6
- disabled: true
6
+ disabled: true
7
+ sort_no: 999
@@ -10,6 +10,37 @@ module.exports = {
10
10
  throw new Error('禁止给应用程序页面分配权限');
11
11
  }
12
12
  }
13
+
14
+ if(doc.type === 'orgDefault'){
15
+ delete doc.app;
16
+ delete doc.profile;
17
+ }
18
+
19
+ if(doc.type === 'appDefault'){
20
+ delete doc.profile;
21
+ }
22
+
23
+ if(doc.type === 'orgDefault'){
24
+ const count = await objectql.getObject('page_assignments').count({filters: [['page', '=', doc.page], ['type', '=', doc.type]]})
25
+ if(count > 0){
26
+ throw new Error("已存在「组织默认设置」授权")
27
+ }
28
+ }
29
+
30
+ if(doc.type === 'appDefault'){
31
+ const count = await objectql.getObject('page_assignments').count({filters: [['page', '=', doc.page], ['type', '=', doc.type], ['app', '=', doc.app]]})
32
+ if(count > 0){
33
+ throw new Error("已存在「应用程序默认设置」授权")
34
+ }
35
+ }
36
+
37
+ if(doc.type === 'appRecordProfile'){
38
+ const count = await objectql.getObject('page_assignments').count({filters: [['page', '=', doc.page], ['type', '=', doc.type], ['app', '=', doc.app], ['profile', '=', doc.profile]]})
39
+ if(count > 0){
40
+ throw new Error("已存在「应用程序和简档」授权")
41
+ }
42
+ }
43
+
13
44
  },
14
45
  beforeUpdate: async function(){
15
46
  const {object_name, doc, spaceId, id} = this;
@@ -19,5 +50,35 @@ module.exports = {
19
50
  throw new Error('禁止给应用程序页面分配权限');
20
51
  }
21
52
  }
53
+
54
+ if(doc.type === 'orgDefault'){
55
+ doc.app = null;
56
+ doc.profile = null;
57
+ }
58
+
59
+ if(doc.type === 'appDefault'){
60
+ doc.profile = null;
61
+ }
62
+
63
+ if(doc.type === 'orgDefault'){
64
+ const count = await objectql.getObject('page_assignments').count({filters: [['_id', '!=', id], ['page', '=', doc.page], ['type', '=', doc.type]]})
65
+ if(count > 0){
66
+ throw new Error("已存在「组织默认设置」授权")
67
+ }
68
+ }
69
+
70
+ if(doc.type === 'appDefault'){
71
+ const count = await objectql.getObject('page_assignments').count({filters: [['_id', '!=', id], ['page', '=', doc.page], ['type', '=', doc.type], ['app', '=', doc.app]]})
72
+ if(count > 0){
73
+ throw new Error("已存在「应用程序默认设置」授权")
74
+ }
75
+ }
76
+
77
+ if(doc.type === 'appRecordProfile'){
78
+ const count = await objectql.getObject('page_assignments').count({filters: [['_id', '!=', id], ['page', '=', doc.page], ['type', '=', doc.type], ['app', '=', doc.app], ['profile', '=', doc.profile]]})
79
+ if(count > 0){
80
+ throw new Error("已存在「应用程序和简档」授权")
81
+ }
82
+ }
22
83
  }
23
84
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/service-pages",
3
- "version": "2.2.22",
3
+ "version": "2.2.25",
4
4
  "main": "package.service.js",
5
5
  "scripts": {},
6
6
  "license": "MIT",
@@ -11,5 +11,5 @@
11
11
  "dependencies": {
12
12
  "@builder.io/react": "^1.1.50"
13
13
  },
14
- "gitHead": "af4ea8ed034854c8de1ff8b9d5db241183524417"
14
+ "gitHead": "e81092f007bce951b627a5c28e286032afbba1fb"
15
15
  }