@steedos/standard-object-database 2.3.2-beta.8 → 2.3.2

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.
@@ -24,8 +24,8 @@ fields:
24
24
  options:
25
25
  - label: Mine
26
26
  value: mine
27
- - label: space
28
- value: Space
27
+ - label: Space
28
+ value: space
29
29
  shared:
30
30
  label: Shared to All Users
31
31
  help:
@@ -141,12 +141,28 @@ fields:
141
141
  label: Field
142
142
  help:
143
143
  description:
144
+ searchable_fields:
145
+ label: Searchable Fields
146
+ help:
147
+ description:
148
+ searchable_fields.$:
149
+ label: Column
150
+ help:
151
+ description:
152
+ searchable_fields.$.field:
153
+ label: Field
154
+ help:
155
+ description:
156
+ groups:
157
+ advanced: Advanced
144
158
  listviews:
145
159
  all:
146
160
  label: All List View
147
161
  actions:
148
162
  customize:
149
163
  label: Customize
164
+ copy:
165
+ label: Copy
150
166
  CustomLabels:
151
167
  object_listviews_field_filters.$:
152
168
  object_listviews_field_sort.$:
@@ -132,8 +132,26 @@ fields:
132
132
  label: 字段
133
133
  help:
134
134
  description:
135
+ searchable_fields:
136
+ label: 默认可搜索字段
137
+ help:
138
+ description:
139
+ searchable_fields.$:
140
+ label: 默认可搜索字段
141
+ help:
142
+ description:
143
+ searchable_fields.$.field:
144
+ label: 字段
145
+ help:
146
+ description:
135
147
  sort_no:
136
148
  label: 排序号
149
+ enable_amis_schema:
150
+ label: 使用 amis自定义列表
151
+ amis_schema:
152
+ label: Amis Schema
153
+ groups:
154
+ advanced: 高级
137
155
  listviews:
138
156
  all:
139
157
  label: 全部
@@ -206,6 +206,8 @@ listviews:
206
206
  deleted:
207
207
  label: Deleted
208
208
  actions:
209
+ schemaBuilder:
210
+ label: Schema Builder
209
211
  show_object:
210
212
  label: Preview
211
213
  copy_odata:
@@ -0,0 +1,62 @@
1
+ name: amis_buttons
2
+ amis_schema: |-
3
+ {
4
+ "type": "service",
5
+ "body": [
6
+ {
7
+ "type": "button",
8
+ "label": "重置",
9
+ "id": "u:76144dacd93c",
10
+ "onEvent": {
11
+ "click": {
12
+ "actions": [
13
+ {
14
+ "args": {
15
+ "api": {
16
+ "url": "${context.rootUrl}/api/listview/${record_id}/amis-schema/reset",
17
+ "method": "post",
18
+ "headers": {
19
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
20
+ }
21
+ },
22
+ "messages": {
23
+ "success": "Amis Schema重置成功!",
24
+ "failed": "Amis Schema重置失败!"
25
+ }
26
+ },
27
+ "actionType": "ajax"
28
+ }
29
+ ]
30
+ }
31
+ },
32
+ "tooltip": "重置列表视图Amis Schema",
33
+ "tooltipPlacement": "top",
34
+ "className": "slds-button slds-button--neutral p-0"
35
+ }
36
+ ],
37
+ "regions": [
38
+ "body"
39
+ ],
40
+ "data": {
41
+ "context": {
42
+ "rootUrl": "https://5000-steedos-steedosplatform-uwiv6wkdp2o.ws-us77.gitpod.io"
43
+ },
44
+ "app_id": "",
45
+ "tab_id": "",
46
+ "object_name": "",
47
+ "dataComponentId": "",
48
+ "record_id": "",
49
+ "record": {},
50
+ "permissions": {}
51
+ },
52
+ "id": "u:9a37e91e4b8d",
53
+ "bodyClassName": "p-0"
54
+ }
55
+ is_enable: true
56
+ label: AmisSchema
57
+ 'on': record_only
58
+ type: amis_button
59
+ visible: !!js/function |
60
+ function (object_name, record_id, record_permissions, record) {
61
+ return Creator.baseObject.actions.standard_edit.visible() && !record.is_system && record.enable_amis_schema;
62
+ }
@@ -96,6 +96,12 @@ module.exports = {
96
96
  showDesignVisible: function (object_name, record_id, record_permissions) {
97
97
  var perms= {};
98
98
  var record = Creator.getObjectRecord(object_name, record_id);
99
+ if(!record){
100
+ return false;
101
+ }
102
+ if(!record.enable_amis_schema){
103
+ return false;
104
+ }
99
105
  if (record_permissions) {
100
106
  perms = record_permissions;
101
107
  } else {
@@ -268,6 +268,33 @@ fields:
268
268
 
269
269
  return Creator.getObjectFieldOptions(values != null ? values.object_name : void 0, true);
270
270
  }
271
+ searchable_fields:
272
+ label: Searchable Fields
273
+ type: grid
274
+ is_wide: true
275
+ depend_on:
276
+ - object_name
277
+ searchable_fields.$:
278
+ label: Column
279
+ blackbox: true
280
+ type: object
281
+ searchable_fields.$.field:
282
+ label: Field
283
+ type: lookup
284
+ multiple: false
285
+ is_wide: false
286
+ optionsFunction: !<tag:yaml.org,2002:js/function> |-
287
+ function (values) {
288
+ if (!(values != null ? values.object_name : void 0)) {
289
+ values.object_name = Session.get("object_name");
290
+ }
291
+
292
+ if(values.object_name && !_.isString(values.object_name)){
293
+ values.object_name = values.object_name.name
294
+ }
295
+
296
+ return Creator.getObjectFieldOptions(values != null ? values.object_name : void 0, true);
297
+ }
271
298
  sort_no:
272
299
  label: Sort no
273
300
  type: number
@@ -280,13 +307,19 @@ fields:
280
307
  readonly: true
281
308
  visible_on: "{{global.mode ==='read' ? true : false}}"
282
309
  disabled: true
310
+ enable_amis_schema:
311
+ label: Enable amis_schema
312
+ type: boolean
313
+ group: advanced
314
+ required: false
283
315
  amis_schema:
284
316
  label: Amis Schema
285
317
  type: code
318
+ group: advanced
286
319
  language: json
287
320
  required: false
288
321
  is_wide: true
289
- # visible_on: "{{formData.type == 'amis_button' ? true: false}}"
322
+ # visible_on: "{{formData.enable_amis_schema}}"
290
323
  paging:
291
324
  enabled: false
292
325
  list_views:
@@ -72,6 +72,7 @@ fields:
72
72
  type: boolean
73
73
  label: Enable Search
74
74
  group: Switch
75
+ hidden: true
75
76
  enable_files:
76
77
  type: boolean
77
78
  label: Enable Files
@@ -99,6 +100,7 @@ fields:
99
100
  defaultValue: false
100
101
  label: Enable Share
101
102
  group: Switch
103
+ hidden: true
102
104
  enable_workflow:
103
105
  type: boolean
104
106
  label: Enable Workflow
@@ -111,6 +113,7 @@ fields:
111
113
  type: boolean
112
114
  label: Enable Chatter
113
115
  group: Switch
116
+ hidden: true
114
117
  enable_inline_edit:
115
118
  type: boolean
116
119
  defaultValue: true
@@ -460,9 +463,9 @@ actions:
460
463
  show_object:
461
464
  label: Preview
462
465
  on: record
463
- copy_odata:
464
- label: Copy OData URL
465
- on: record
466
+ # copy_odata:
467
+ # label: Copy OData URL
468
+ # on: record
466
469
  createDefaultRecordView:
467
470
  on: record_only_more
468
471
  label: 创建默认页面布局
@@ -4,7 +4,7 @@
4
4
  * @Description:
5
5
  */
6
6
  const express = require("express");
7
- const router =require('@steedos/router').staticRouter()
7
+ const router = express.Router();
8
8
  const core = require('@steedos/core');
9
9
  const ejs = require('ejs');
10
10
  const fs = require('fs');
@@ -4,7 +4,7 @@
4
4
  * @Description:
5
5
  */
6
6
  const express = require("express");
7
- const router =require('@steedos/router').staticRouter()
7
+ const router = express.Router();
8
8
  const core = require('@steedos/core');
9
9
  const ejs = require('ejs');
10
10
  const fs = require('fs');
@@ -2,17 +2,59 @@
2
2
  * @Author: baozhoutao@steedos.com
3
3
  * @Date: 2022-08-05 14:20:24
4
4
  * @LastEditors: baozhoutao@steedos.com
5
- * @LastEditTime: 2022-08-05 15:41:30
5
+ * @LastEditTime: 2022-11-29 11:59:40
6
6
  * @Description:
7
7
  */
8
- const express = require("express");
9
- const router =require('@steedos/router').staticRouter()
8
+ const express = require('express');
9
+ const router = express.Router();
10
10
  const core = require('@steedos/core');
11
11
  const objectql = require('@steedos/objectql');
12
12
 
13
+ const callObjectServiceAction = async function(actionName, userSession, data){
14
+ const broker = objectql.getSteedosSchema().broker;
15
+ return broker.call(actionName, data || {}, { meta: { user: userSession}})
16
+ }
17
+
18
+ const getUISchema = async function(objectName, userSession){
19
+ return await callObjectServiceAction(`@${objectName}.getRecordView`, userSession);
20
+ }
21
+
13
22
  router.post('/api/listview/filters', core.requireAuthentication, async function (req, res) {
14
23
  const {id, filters} = req.body;
15
24
  const record = await objectql.getObject('object_listviews').directUpdate(id, {filters: filters})
16
25
  res.status(200).send(record);
17
26
  });
27
+
28
+ router.post('/api/listview/:id/amis-schema/clear', core.requireAuthentication, async function (req, res) {
29
+ const { id } = req.params;
30
+ const record = await objectql.getObject('object_listviews').directUpdate(id, { amis_schema: "" });
31
+ res.status(200).send(record);
32
+ });
33
+
34
+ router.post('/api/listview/:id/amis-schema/reset', core.requireAuthentication, async function (req, res) {
35
+ try {
36
+ const userSession = req.user;
37
+ const { id } = req.params;
38
+ const listviews = await objectql.getObject('object_listviews').directFind({filters: [['_id', '=', id]],fields: ["object_name", "name"]});
39
+ let listview;
40
+ if(listviews && listviews.length > 0){
41
+ listview = listviews[0];
42
+ }
43
+ else{
44
+ res.status(500).send(`The listview for id "${id}" Not found`);
45
+ }
46
+ const AmisLib = require('@steedos-widgets/amis-lib');
47
+ AmisLib.setUISchemaFunction(async function(objectName, force){
48
+ return await getUISchema(objectName, userSession);
49
+ });
50
+ let schema = await AmisLib.getListviewInitSchema(listview.object_name, listview.name);
51
+ const record = await objectql.getObject('object_listviews').directUpdate(id, { amis_schema: JSON.stringify(schema, null, 4) });
52
+ res.status(200).send(record);
53
+
54
+ } catch (error) {
55
+ res.status(500).send(error.message);
56
+ console.error(error);
57
+ }
58
+ });
59
+
18
60
  exports.default = router;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/standard-object-database",
3
- "version": "2.3.2-beta.8",
3
+ "version": "2.3.2",
4
4
  "main": "package.service.js",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -10,7 +10,10 @@
10
10
  "steedos"
11
11
  ],
12
12
  "description": "steedos package",
13
+ "dependencies": {
14
+ "@steedos-widgets/amis-lib": "^0.0.15"
15
+ },
13
16
  "repository": {},
14
17
  "license": "MIT",
15
- "gitHead": "3842d837373ece532af6b8399db8998be29018a0"
18
+ "gitHead": "3aefe890a87dcdf231a132d180744ee37653dd7c"
16
19
  }