@steedos/service-pages 2.2.25 → 2.2.28

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.
@@ -1,219 +1,181 @@
1
1
  /*
2
- * @Author: steedos
3
- * @Date: 2022-03-22 19:13:57
4
- * @Description: 提供自定义page渲染能力, 供内部使用, 内容会迭代调整, 不对用户开放.
5
- */
6
-
7
- Steedos.Page = {
8
- App: {},
9
- Record: {},
10
- Listview: {},
11
- RelatedListview: {},
12
- Form: {
13
- StandardNew: {},
14
- StandardEdit: {}
15
- },
16
- reload: function(){
17
- FlowRouter.reload();
18
- }
19
- };
20
-
21
- function upperFirst(str) {
22
- return str.toLowerCase().replace(/( |^)[a-z]/g, (L) => L.toUpperCase());
23
- };
24
-
25
- function getModalElement(name){
26
- let modalRoot = document.getElementById(`steedos-page-modal-root-${name}`);
27
- if (!modalRoot) {
28
- modalRoot = document.createElement('div');
29
- modalRoot.setAttribute('id', `steedos-page-modal-root-${name}`);
30
- document.body.appendChild(modalRoot)
31
- }
32
- return modalRoot;
33
- }
2
+ * @Author: steedos
3
+ * @Date: 2022-03-22 19:13:57
4
+ * @Description: 提供自定义page渲染能力, 供内部使用, 内容会迭代调整, 不对用户开放.
5
+ */
6
+ ;(function(){
7
+ Steedos.Page = {
8
+ App: {},
9
+ Record: {},
10
+ Listview: {},
11
+ RelatedListview: {},
12
+ Form: {
13
+ StandardNew: {},
14
+ StandardEdit: {}
15
+ },
16
+ Data: {},
17
+ reload: function(){
18
+ FlowRouter.reload();
19
+ }
20
+ };
34
21
 
22
+ function upperFirst(str) {
23
+ return str.toLowerCase().replace(/( |^)[a-z]/g, (L) => L.toUpperCase());
24
+ };
35
25
 
36
- Steedos.Page.getPage = function (type, appId, objectApiName, recordId, pageId) {
37
- if (type != 'list' && objectApiName) {
38
- const objectInfo = Creator.getObject(objectApiName);
39
- if (objectInfo && objectInfo.version < 2) {
40
- return;
26
+ function getModalElement(name){
27
+ let modalRoot = document.getElementById(`steedos-page-modal-root-${name}`);
28
+ if (!modalRoot) {
29
+ modalRoot = document.createElement('div');
30
+ modalRoot.setAttribute('id', `steedos-page-modal-root-${name}`);
31
+ document.body.appendChild(modalRoot)
41
32
  }
33
+ return modalRoot;
42
34
  }
43
- if(!objectApiName){
44
- objectApiName = ''
45
- }
46
- if(!recordId){
47
- recordId = ''
48
- }
49
- if(!pageId){
50
- pageId = ''
51
- }
52
- const formFactor = Steedos.isMobile() ? "SMALL" : "LARGE";
53
- const page = Steedos.authRequest(`/api/pageSchema/${type}?app=${appId}&objectApiName=${objectApiName}&recordId=${recordId}&pageId=${pageId}&formFactor=${formFactor}`, { async: false });
54
- if (page && page.schema) {
55
- return page;
56
- }
57
- }
58
-
59
- Steedos.Page.render = function (root, page, data) {
60
-
61
- const loadingContentData = {
62
- "inputs": [],
63
- // "title": "loading",
64
- "blocks": [
65
- {
66
- "@type": "@builder.io/sdk:Element",
67
- "@version": 2,
68
- "layerName": "Box",
69
- "id": "builder-8070f86b1aed4e78a5878fa5c0d79e49",
70
- "children": [
71
- {
72
- "@type": "@builder.io/sdk:Element",
73
- "@version": 2,
74
- "layerName": "Loading...\n...",
75
- "id": "builder-4b16375a68dc4e49b4844843091bf91d",
76
- "component": {
77
- "name": "Text",
78
- "options": {
79
- "text": "<p>Loading...</p>\n"
80
- }
81
- },
82
- "responsiveStyles": {
83
- "large": {
84
- "display": "flex",
85
- "flexDirection": "column",
86
- "position": "relative",
87
- "flexShrink": "0",
88
- "boxSizing": "border-box",
89
- "marginTop": "20px",
90
- "lineHeight": "normal",
91
- "height": "auto",
92
- "textAlign": "center"
93
- }
94
- }
95
- }
96
- ],
97
- "responsiveStyles": {
98
- "large": {
99
- "display": "flex",
100
- "flexDirection": "column",
101
- "position": "relative",
102
- "flexShrink": "0",
103
- "boxSizing": "border-box"
104
- }
105
- }
106
- }
107
- ]
108
- };
109
35
 
110
- if (page.render_engine && page.render_engine != 'redash') {
111
36
 
112
- let schema = typeof page.schema === 'string' ? JSON.parse(page.schema) : page.schema;
113
- const defData = Object.assign({}, data, {
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
- }
37
+ Steedos.Page.getPage = function (type, appId, objectApiName, recordId, pageId) {
38
+ if (type != 'list' && objectApiName) {
39
+ const objectInfo = Creator.getObject(objectApiName);
40
+ if (objectInfo && objectInfo.version < 2) {
41
+ return;
121
42
  }
122
- })
43
+ }
44
+ if(!objectApiName){
45
+ objectApiName = ''
46
+ }
47
+ if(!recordId){
48
+ recordId = ''
49
+ }
50
+ if(!pageId){
51
+ pageId = ''
52
+ }
53
+ const formFactor = Steedos.isMobile() ? "SMALL" : "LARGE";
54
+ const page = Steedos.authRequest(`/api/pageSchema/${type}?app=${appId}&objectApiName=${objectApiName}&recordId=${recordId}&pageId=${pageId}&formFactor=${formFactor}`, { async: false });
55
+ if (page && page.schema) {
56
+ return page;
57
+ }
58
+ }
123
59
 
124
- schema = lodash.defaultsDeep(defData , schema);
60
+ Steedos.Page.render = function (root, page, data) {
125
61
 
126
- const pageContentData = {
62
+ const loadingContentData = {
63
+ "inputs": [],
64
+ // "title": "loading",
127
65
  "blocks": [
128
66
  {
129
67
  "@type": "@builder.io/sdk:Element",
130
68
  "@version": 2,
131
- "id": `builder-${page._id}`,
132
- "component": {
133
- "name": upperFirst(page.render_engine),
134
- "options": {
135
- "schema": schema,
136
- "data": data,
137
- "name": page.name
69
+ "layerName": "Box",
70
+ "id": "builder-8070f86b1aed4e78a5878fa5c0d79e49",
71
+ "children": [
72
+ {
73
+ "@type": "@builder.io/sdk:Element",
74
+ "@version": 2,
75
+ "layerName": "Loading...\n...",
76
+ "id": "builder-4b16375a68dc4e49b4844843091bf91d",
77
+ "component": {
78
+ "name": "Text",
79
+ "options": {
80
+ "text": "<p>Loading...</p>\n"
81
+ }
82
+ },
83
+ "responsiveStyles": {
84
+ "large": {
85
+ "display": "flex",
86
+ "flexDirection": "column",
87
+ "position": "relative",
88
+ "flexShrink": "0",
89
+ "boxSizing": "border-box",
90
+ "marginTop": "20px",
91
+ "lineHeight": "normal",
92
+ "height": "auto",
93
+ "textAlign": "center"
94
+ }
95
+ }
138
96
  }
139
- },
97
+ ],
98
+ "responsiveStyles": {
99
+ "large": {
100
+ "display": "flex",
101
+ "flexDirection": "column",
102
+ "position": "relative",
103
+ "flexShrink": "0",
104
+ "boxSizing": "border-box"
105
+ }
106
+ }
140
107
  }
141
- ],
142
- "inputs": [
143
108
  ]
144
- }
109
+ };
145
110
 
146
- const findComponent = (obj, componentName)=>{
147
- return lodash.find(obj, {name : componentName})
148
- }
111
+ if (page.render_engine && page.render_engine != 'redash') {
112
+
113
+ let schema = typeof page.schema === 'string' ? JSON.parse(page.schema) : page.schema;
114
+ const defData = Object.assign({}, data, {
115
+ data: {
116
+ context: {
117
+ rootUrl: __meteor_runtime_config__.ROOT_URL,
118
+ tenantId: Creator.USER_CONTEXT.spaceId,
119
+ userId: Creator.USER_CONTEXT.userId,
120
+ authToken: Creator.USER_CONTEXT.user.authToken
121
+ }
122
+ }
123
+ })
124
+
125
+ schema = lodash.defaultsDeep(defData , schema);
149
126
 
150
- //渲染loading
151
- SteedosUI.render(BuilderComponent, {
152
- model: "page", content: {
153
- "data": loadingContentData
127
+ const pageContentData = {
128
+ "blocks": [
129
+ {
130
+ "@type": "@builder.io/sdk:Element",
131
+ "@version": 2,
132
+ "id": `builder-${page._id}`,
133
+ "component": {
134
+ "name": upperFirst(page.render_engine),
135
+ "options": {
136
+ "schema": schema,
137
+ "data": data,
138
+ "name": page.name
139
+ }
140
+ },
141
+ }
142
+ ],
143
+ "inputs": [
144
+ ]
145
+ }
146
+
147
+ const findComponent = (obj, componentName)=>{
148
+ return lodash.find(obj, {name : componentName})
154
149
  }
155
- }, root)
156
150
 
157
- Promise.all([
158
- waitForThing(window, 'BuilderComponent'),
159
- waitForThing(Builder.components, upperFirst(page.render_engine), findComponent)
160
- ]).then(()=>{
161
- //渲染page
151
+ //渲染loading
162
152
  SteedosUI.render(BuilderComponent, {
163
153
  model: "page", content: {
164
- "data": pageContentData
154
+ "data": loadingContentData
165
155
  }
166
156
  }, root)
167
- });
168
- }
169
-
170
- return root;
171
- };
172
-
173
- Steedos.Page.App.render = function (template, pageName, app_id, options) {
174
- if (!pageName) {
175
- return;
176
- }
177
- var rootId = "steedosPageRoot";
178
- var modalRoot = document.getElementById(rootId);
179
- // if(modalRoot){
180
- // modalRoot.remove();
181
- // }
182
- if (!modalRoot) {
183
- modalRoot = document.createElement('div');
184
- modalRoot.setAttribute('id', rootId);
185
- $(".page-template-root")[0].appendChild(modalRoot);
186
- }
187
-
188
- const container = $("#" + rootId)[0];
189
157
 
190
- const page = Steedos.Page.getPage('app', app_id, null, null, pageName);
191
- if (page) {
192
- if (page.render_engine && page.render_engine != 'redash') {
193
- return Steedos.Page.render(container, page, Object.assign({}, options, {
194
- appId: app_id
195
- }));
158
+ Promise.all([
159
+ waitForThing(window, 'BuilderComponent'),
160
+ waitForThing(Builder.components, upperFirst(page.render_engine), findComponent)
161
+ ]).then(()=>{
162
+ //渲染page
163
+ SteedosUI.render(BuilderComponent, {
164
+ model: "page", content: {
165
+ "data": pageContentData
166
+ }
167
+ }, root)
168
+ });
196
169
  }
197
- }
198
-
199
- SteedosUI.render(stores.ComponentRegistry.components.PublicPage, {
200
- token: pageName
201
- }, container);
202
- return container
203
- };
204
170
 
205
- Steedos.Page.Listview.getDefaultName = function (objectApiName, listViewName) {
206
- return `listview_${objectApiName}_${listViewName}`;
207
- };
171
+ return root;
172
+ };
208
173
 
209
- Steedos.Page.Listview.render = function (template, objectApiName, options) {
210
- try {
211
- if (!template.data.regions || !objectApiName) {
174
+ Steedos.Page.App.render = function (template, pageName, app_id, options) {
175
+ if (!pageName) {
212
176
  return;
213
177
  }
214
- const { page, ...data } = template.data.regions();
215
-
216
- var rootId = "steedosPageRecordRoot";
178
+ var rootId = "steedosPageRoot";
217
179
  var modalRoot = document.getElementById(rootId);
218
180
  // if(modalRoot){
219
181
  // modalRoot.remove();
@@ -221,132 +183,223 @@ Steedos.Page.Listview.render = function (template, objectApiName, options) {
221
183
  if (!modalRoot) {
222
184
  modalRoot = document.createElement('div');
223
185
  modalRoot.setAttribute('id', rootId);
224
- $(".page-list-view-root")[0].appendChild(modalRoot);
186
+ $(".page-template-root")[0].appendChild(modalRoot);
225
187
  }
226
188
 
227
- if (page.render_engine && page.render_engine != 'redash') {
228
- return Steedos.Page.render($("#" + rootId)[0], page, Object.assign({}, options, data));
189
+ const container = $("#" + rootId)[0];
190
+
191
+ const page = Steedos.Page.getPage('app', app_id, null, null, pageName);
192
+ if (page) {
193
+ if (page.render_engine && page.render_engine != 'redash') {
194
+ return Steedos.Page.render(container, page, Object.assign({}, options, {
195
+ appId: app_id
196
+ }));
197
+ }
229
198
  }
230
- } catch (error) {
231
199
 
232
- }
233
- };
200
+ SteedosUI.render(stores.ComponentRegistry.components.PublicPage, {
201
+ token: pageName
202
+ }, container);
203
+ return container
204
+ };
234
205
 
235
- Steedos.Page.Record.render = function (template, objectApiName, recordId, options) {
236
- try {
237
- if (!template.data.regions || !objectApiName || !recordId) {
238
- return;
239
- }
240
- const { page, ...data } = template.data.regions();
241
- var rootId = "steedosPageRecordRoot";
242
- var modalRoot = document.getElementById(rootId);
243
- // if(modalRoot){
244
- // modalRoot.remove();
245
- // }
246
- if (!modalRoot) {
247
- modalRoot = document.createElement('div');
248
- modalRoot.setAttribute('id', rootId);
249
- $(".page-record-view-root")[0].appendChild(modalRoot);
250
- }
206
+ Steedos.Page.Listview.getDefaultName = function (objectApiName, listViewName) {
207
+ return `listview_${objectApiName}_${listViewName}`;
208
+ };
209
+
210
+ Steedos.Page.Listview.render = function (template, objectApiName, options) {
211
+ try {
212
+ if (!template.data.regions || !objectApiName) {
213
+ return;
214
+ }
215
+ const { page, ...data } = template.data.regions();
216
+
217
+ var rootId = "steedosPageRecordRoot";
218
+ var modalRoot = document.getElementById(rootId);
219
+ // if(modalRoot){
220
+ // modalRoot.remove();
221
+ // }
222
+ if (!modalRoot) {
223
+ modalRoot = document.createElement('div');
224
+ modalRoot.setAttribute('id', rootId);
225
+ $(".page-list-view-root")[0].appendChild(modalRoot);
226
+ }
227
+
228
+ if (page.render_engine && page.render_engine != 'redash') {
229
+ return Steedos.Page.render($("#" + rootId)[0], page, Object.assign({}, options, data));
230
+ }
231
+ } catch (error) {
251
232
 
252
- if (page.render_engine && page.render_engine != 'redash') {
253
- return Steedos.Page.render($("#" + rootId)[0], page, Object.assign({}, options, data));
254
233
  }
255
- } catch (error) {
234
+ };
256
235
 
257
- }
258
- };
236
+ Steedos.Page.Record.render = function (template, objectApiName, recordId, options) {
237
+ try {
238
+ if (!template.data.regions || !objectApiName || !recordId) {
239
+ return;
240
+ }
241
+ const { page, ...data } = template.data.regions();
242
+ var rootId = "steedosPageRecordRoot";
243
+ var modalRoot = document.getElementById(rootId);
244
+ // if(modalRoot){
245
+ // modalRoot.remove();
246
+ // }
247
+ if (!modalRoot) {
248
+ modalRoot = document.createElement('div');
249
+ modalRoot.setAttribute('id', rootId);
250
+ $(".page-record-view-root")[0].appendChild(modalRoot);
251
+ }
252
+
253
+ if (page.render_engine && page.render_engine != 'redash') {
254
+ return Steedos.Page.render($("#" + rootId)[0], page, Object.assign({}, options, data));
255
+ }
256
+ } catch (error) {
259
257
 
260
- Steedos.Page.RelatedListview.render = function (template, objectApiName, options) {
261
- try {
262
- if (!template.data.regions || !objectApiName) {
263
- return;
264
258
  }
265
- const { page, ...data } = template.data.regions();
259
+ };
260
+
261
+ Steedos.Page.RelatedListview.render = function (template, objectApiName, options) {
262
+ try {
263
+ if (!template.data.regions || !objectApiName) {
264
+ return;
265
+ }
266
+ const { page, ...data } = template.data.regions();
267
+
268
+ var rootId = "steedosPageRecordRoot";
269
+ var modalRoot = document.getElementById(rootId);
270
+ // if(modalRoot){
271
+ // modalRoot.remove();
272
+ // }
273
+ if (!modalRoot) {
274
+ modalRoot = document.createElement('div');
275
+ modalRoot.setAttribute('id', rootId);
276
+ $(".page-related-list-view-root")[0].appendChild(modalRoot);
277
+ }
278
+
279
+ if (page.render_engine && page.render_engine != 'redash') {
280
+ return Steedos.Page.render($("#" + rootId)[0], page, Object.assign({}, options, data));
281
+ }
282
+ } catch (error) {
266
283
 
267
- var rootId = "steedosPageRecordRoot";
268
- var modalRoot = document.getElementById(rootId);
269
- // if(modalRoot){
270
- // modalRoot.remove();
271
- // }
272
- if (!modalRoot) {
273
- modalRoot = document.createElement('div');
274
- modalRoot.setAttribute('id', rootId);
275
- $(".page-related-list-view-root")[0].appendChild(modalRoot);
276
284
  }
285
+ };
277
286
 
278
- if (page.render_engine && page.render_engine != 'redash') {
279
- return Steedos.Page.render($("#" + rootId)[0], page, Object.assign({}, options, data));
287
+ Steedos.Page.Form.StandardNew.render = function (appId, objectApiName, title, initialValues, options) {
288
+ const page = Steedos.Page.getPage('form', appId, objectApiName);
289
+ if (page && page.schema) {
290
+ const elementId = getModalElement(`${objectApiName}-standard_new`);
291
+ return Steedos.Page.render(elementId, page, Object.assign({}, options, {
292
+ appId: appId,
293
+ objectName: objectApiName,
294
+ title: title,
295
+ initialValues: initialValues,
296
+ }));
280
297
  }
281
- } catch (error) {
282
298
 
283
- }
284
- };
285
-
286
- Steedos.Page.Form.StandardNew.render = function (appId, objectApiName, title, initialValues, options) {
287
- const page = Steedos.Page.getPage('form', appId, objectApiName);
288
- if (page && page.schema) {
289
- const elementId = getModalElement(`${objectApiName}-standard_new`);
290
- return Steedos.Page.render(elementId, page, Object.assign({}, options, {
291
- appId: appId,
292
- objectName: objectApiName,
299
+ SteedosUI.showModal(stores.ComponentRegistry.components.ObjectForm, {
300
+ name: `${objectApiName}_standard_new_form`,
301
+ objectApiName: objectApiName,
293
302
  title: title,
294
303
  initialValues: initialValues,
295
- }));
296
- }
304
+ afterInsert: function (result) {
305
+ if (result.length > 0) {
306
+ var record = result[0];
307
+ setTimeout(function () {
308
+ var url = `/app/${appId}/${objectApiName}/view/${record._id}`
309
+ FlowRouter.go(url)
310
+ }
311
+ , 1);
312
+ return true;
313
+ }
314
+ }
315
+ }, null, { iconPath: '/assets/icons' });
316
+ };
297
317
 
298
- SteedosUI.showModal(stores.ComponentRegistry.components.ObjectForm, {
299
- name: `${objectApiName}_standard_new_form`,
300
- objectApiName: objectApiName,
301
- title: title,
302
- initialValues: initialValues,
303
- afterInsert: function (result) {
304
- if (result.length > 0) {
305
- var record = result[0];
318
+ Steedos.Page.Form.StandardEdit.render = function (appId, objectApiName, title, recordId, options) {
319
+ const page = Steedos.Page.getPage('form', appId, objectApiName, recordId);
320
+ if (page && page.schema) {
321
+ const elementId = getModalElement(`${objectApiName}-standard_edit`);
322
+ return Steedos.Page.render(elementId, page, Object.assign({}, options, {
323
+ appId: appId,
324
+ objectName: objectApiName,
325
+ title: title,
326
+ recordId: recordId
327
+ }));
328
+ }
329
+
330
+ return SteedosUI.showModal(stores.ComponentRegistry.components.ObjectForm, {
331
+ name: `${objectApiName}_standard_edit_form`,
332
+ objectApiName: objectApiName,
333
+ recordId: recordId,
334
+ title: title,
335
+ afterUpdate: function () {
306
336
  setTimeout(function () {
307
- var url = `/app/${appId}/${objectApiName}/view/${record._id}`
308
- FlowRouter.go(url)
309
- }
310
- , 1);
337
+ if (FlowRouter.current().route.path.endsWith("/:record_id")) {
338
+ FlowRouter.reload()
339
+ // ObjectForm有缓存,修改子表记录可能会有主表记录的汇总字段变更,需要刷新表单数据
340
+ SteedosUI.reloadRecord(objectApiName, recordId)
341
+ } else {
342
+ window.refreshDxSchedulerInstance()
343
+ window.refreshGrid(options.gridName);
344
+ }
345
+ }, 1);
311
346
  return true;
312
347
  }
348
+ }, null, { iconPath: '/assets/icons' })
349
+ };
350
+
351
+ // Steedos.Page.Form.StandardDelete.render = function(){
352
+
353
+ // };
354
+
355
+
356
+ // creator odata 转 graphql 防腐层
357
+
358
+ function getGraphqlFieldsQuery(objectApiName, selectFields, expandFields){
359
+ const objectConfig = Creator.getObject(objectApiName)
360
+ const objectFields = objectConfig.fields
361
+ if(_.isString(selectFields)){
362
+ selectFields = selectFields.split(',');
313
363
  }
314
- }, null, { iconPath: '/assets/icons' });
315
- };
316
-
317
- Steedos.Page.Form.StandardEdit.render = function (appId, objectApiName, title, recordId, options) {
318
- const page = Steedos.Page.getPage('form', appId, objectApiName, recordId);
319
- if (page && page.schema) {
320
- const elementId = getModalElement(`${objectApiName}-standard_edit`);
321
- return Steedos.Page.render(elementId, page, Object.assign({}, options, {
322
- appId: appId,
323
- objectName: objectApiName,
324
- title: title,
325
- recordId: recordId
326
- }));
327
- }
328
364
 
329
- return SteedosUI.showModal(stores.ComponentRegistry.components.ObjectForm, {
330
- name: `${objectApiName}_standard_edit_form`,
331
- objectApiName: objectApiName,
332
- recordId: recordId,
333
- title: title,
334
- afterUpdate: function () {
335
- setTimeout(function () {
336
- if (FlowRouter.current().route.path.endsWith("/:record_id")) {
337
- FlowRouter.reload()
338
- // ObjectForm有缓存,修改子表记录可能会有主表记录的汇总字段变更,需要刷新表单数据
339
- SteedosUI.reloadRecord(objectApiName, recordId)
340
- } else {
341
- window.refreshDxSchedulerInstance()
342
- window.refreshGrid(options.gridName);
343
- }
344
- }, 1);
345
- return true;
365
+ if(_.isString(expandFields)){
366
+ expandFields = expandFields.split(',');
346
367
  }
347
- }, null, { iconPath: '/assets/icons' })
348
- };
349
368
 
350
- // Steedos.Page.Form.StandardDelete.render = function(){
369
+ const fieldsName = ['_id'];
370
+
371
+ if(objectConfig.database_name ==='default' || !objectConfig.database_name){
372
+ fieldsName.push('record_permissions')
373
+ }
374
+
375
+ _.each(selectFields, function(fieldName){
376
+ fieldsName.push(`${fieldName}`)
377
+ });
378
+
379
+ _.each(expandFields, function(fieldName){
380
+ if(fieldName.indexOf("\\") > -1){
381
+ fieldName = fieldName.split('\\')[0];
382
+ }
383
+ if(fieldName && objectFields[fieldName] && _.isString(objectFields[fieldName].reference_to)){
384
+ let spaceUsersCompanyIdsExpand = '';
385
+ if(objectApiName === 'space_users' && fieldName === 'company_ids'){
386
+ spaceUsersCompanyIdsExpand = ',name,admins'
387
+ }
388
+ const refObject = Creator.getObject(objectFields[fieldName].reference_to)
389
+ if(_.includes(fieldsName, fieldName)){
390
+ fieldsName[_.indexOf(fieldsName, fieldName)] = `${fieldName}:${fieldName}__expand{_id, _NAME_FIELD_VALUE:${refObject.NAME_FIELD_KEY}${spaceUsersCompanyIdsExpand}}`
391
+ }else{
392
+ fieldsName.push(`${fieldName}:${fieldName}__expand{_id, _NAME_FIELD_VALUE:${refObject.NAME_FIELD_KEY}${spaceUsersCompanyIdsExpand}}`)
393
+ }
394
+ }
395
+ })
351
396
 
352
- // };
397
+ return fieldsName;
398
+ }
399
+
400
+ Steedos.Page.Data.getRecord = function(objectApiName, recordId, selectFields, expandFields){
401
+ return stores.API.client.sobject(objectApiName).record(recordId, null, {
402
+ graphqlFieldsQuery: getGraphqlFieldsQuery(objectApiName, selectFields, expandFields)
403
+ })
404
+ }
405
+ })();
@@ -3,7 +3,7 @@ columns:
3
3
  - field: type
4
4
  - field: app
5
5
  - field: profile
6
- - field: record_type
6
+ # - field: record_type
7
7
  - field: mobile
8
8
  - field: desktop
9
9
  - field: is_system
@@ -3,7 +3,7 @@ columns:
3
3
  - field: type
4
4
  - field: app
5
5
  - field: profile
6
- - field: record_type
6
+ # - field: record_type
7
7
  - field: mobile
8
8
  - field: desktop
9
9
  - field: is_system
@@ -0,0 +1,7 @@
1
+ name: is_system
2
+ type: boolean
3
+ label: 系统
4
+ visible_on: "{{global.mode ==='read' ? true : false}}"
5
+ readonly: true
6
+ disabled: true
7
+ sort_no: 999
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/service-pages",
3
- "version": "2.2.25",
3
+ "version": "2.2.28",
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": "e81092f007bce951b627a5c28e286032afbba1fb"
14
+ "gitHead": "1e8d08ae4d525950194e35984cd5851016a03219"
15
15
  }