@steedos/standard-object-database 2.7.0-beta.15 → 2.7.0-beta.17

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.
@@ -32,62 +32,80 @@
32
32
  "type": "dialog",
33
33
  "title": "设置分组",
34
34
  "size": "lg",
35
+ "data": {
36
+ "&": "$$",
37
+ "groups": "${groups|filter:is_default:isFalse|filter:is_hidden:isFalse}",
38
+ "designObjectName": "${designObjectName}"
39
+ },
35
40
  "body": [
36
41
  {
37
42
  "type": "form",
38
43
  "mode": "normal",
39
44
  "body": [
40
45
  {
41
- "type": "steedos-input-table",
42
- "enableDialog": false,
43
- "fields": [
46
+ "type": "service",
47
+ "body": [
44
48
  {
45
- "name": "group_name",
46
- "label": "名称",
47
- "type": "text",
48
- "amis": {
49
- "disabledOn": "${is_default || is_hidden}"
50
- },
51
- "id": "u:31952daa443c"
52
- },
53
- {
54
- "name": "visible_on",
55
- "label": "显示条件",
56
- "type": "text",
57
- "amis": {
58
- "disabledOn": "${is_default || is_hidden}"
59
- },
60
- "id": "u:8d7551abcd28",
61
- "value": null
62
- },
63
- {
64
- "name": "collapsed",
65
- "label": "默认折叠",
66
- "amis": {
67
- "disabledOn": "${is_default || is_hidden}"
68
- },
69
- "type": "boolean"
49
+ "type": "steedos-input-table",
50
+ "enableDialog": false,
51
+ "fields": [
52
+ {
53
+ "name": "group_name",
54
+ "label": "名称",
55
+ "type": "text",
56
+ "id": "u:31952daa443c"
57
+ },
58
+ {
59
+ "name": "visible_on",
60
+ "label": "显示条件",
61
+ "type": "text",
62
+ "amis": {
63
+ "type": "input-formula",
64
+ "name": "formula",
65
+ "evalMode": false,
66
+ "variableMode": "tabs",
67
+ "variables": "${variables}"
68
+ },
69
+ "id": "u:8d7551abcd28",
70
+ "value": null
71
+ },
72
+ {
73
+ "name": "collapsed",
74
+ "label": "默认折叠",
75
+ "type": "boolean"
76
+ }
77
+ ],
78
+ "columns": [
79
+ {
80
+ "name": "group_name"
81
+ },
82
+ {
83
+ "name": "visible_on"
84
+ },
85
+ {
86
+ "name": "collapsed",
87
+ "width": 50
88
+ }
89
+ ],
90
+ "name": "groups",
91
+ "addable": true,
92
+ "editable": true,
93
+ "removable": true,
94
+ "draggable": false,
95
+ "id": "u:776ec89804c0",
96
+ "label": "",
97
+ "visibleOn": "${variables}"
70
98
  }
71
99
  ],
72
- "columns": [
73
- {
74
- "name": "group_name"
75
- },
76
- {
77
- "name": "visible_on"
78
- },
79
- {
80
- "name": "collapsed",
81
- "width": 50
100
+ "api": {
101
+ "method": "get",
102
+ "url": "${context.rootUrl}/service/api/@${designObjectName}/uiSchema",
103
+ "adaptor": "payload = {data: {variables: SteedosUI.getFormulaVariables(payload.fields)}};return payload;",
104
+ "cache": 30000,
105
+ "headers": {
106
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
82
107
  }
83
- ],
84
- "name": "groups",
85
- "addable": true,
86
- "editable": true,
87
- "removable": true,
88
- "draggable": false,
89
- "id": "u:776ec89804c0",
90
- "label": ""
108
+ }
91
109
  }
92
110
  ]
93
111
  }
@@ -97,7 +115,7 @@
97
115
  "actions": [
98
116
  {
99
117
  "actionType": "custom",
100
- "script": "///整理分组数据\nconst defaultGroupName = \"未分组\";\nconst hiddenGroupName = \"隐藏\";\nlet setting_groups = _.cloneDeep(event.data.groups);\nif (!_.find(setting_groups, { is_default: true })) {\n setting_groups.unshift({\n \"id\": defaultGroupName,\n \"group_name\": defaultGroupName,\n \"visible_on\": \"\",\n \"is_default\": true\n })\n}\nif (!_.find(setting_groups, { is_hidden: true })) {\n setting_groups.push({\n id: hiddenGroupName,\n group_name: hiddenGroupName,\n visible_on: \"\",\n is_hidden: true\n });\n}\nsetting_groups.forEach(function (group) {\n if (group.is_hidden) {\n group.group_name = hiddenGroupName;\n group.visible_on = \"\";\n }\n if (group.is_default) {\n group.group_name = defaultGroupName;\n group.visible_on = \"\";\n }\n if (!group.id) {\n group.id = group.group_name;\n }\n if (!group.visible_on) {\n group.visible_on = \"\"\n }\n})\n\n//整理字段与分组关系的数据\nlet fieldForGroup = {};\nlet oldGroup = _.cloneDeep(event.data.fieldForGroup);\nsetting_groups.forEach(function (group) {\n if (_.has(oldGroup, group.id)) {\n fieldForGroup[group.id] = oldGroup[group.id];\n oldGroup = _.omit(oldGroup, group.id);\n } else {\n fieldForGroup[group.id] = [];\n }\n})\nif (oldGroup && !_.isEmpty(oldGroup)) {\n _.forEach(oldGroup, function (value, key) {\n fieldForGroup[defaultGroupName] = _.unionBy(fieldForGroup[defaultGroupName], value);\n });\n}\n\n//未分组 放在所有分组开头,隐藏 放在所有分组最后\nconst defaultGroup = fieldForGroup[defaultGroupName];\nconst hiddenGroup = fieldForGroup[hiddenGroupName];\ndelete fieldForGroup[defaultGroupName];\ndelete fieldForGroup[hiddenGroupName];\nfieldForGroup = _.merge({ [defaultGroupName]: defaultGroup }, fieldForGroup, { [hiddenGroupName]: hiddenGroup });\n\n//根据fieldForGroup调整groups顺序,设置分组与保存时需要groups按照顺序\nconst keys = _.keys(fieldForGroup);\nsetting_groups = _.sortBy(setting_groups, function (group) { return _.findIndex(keys, function (key) { return key == group.group_name }) });\n\ndoAction({\n actionType: 'setValue',\n componentId: 'service_field_design',\n args: {\n value: {\n groups: setting_groups\n }\n }\n});\n\ndoAction({\n actionType: 'setValue',\n componentId: \"form_field_design\",\n args: {\n value: { design_field: fieldForGroup }\n }\n});"
118
+ "script": "///整理分组数据\nconst defaultGroupName = \"未分组\";\nconst hiddenGroupName = \"隐藏\";\nlet setting_groups = _.cloneDeep(event.data.groups);\nif (!_.find(setting_groups, { is_default: true })) {\n setting_groups.unshift({\n \"id\": defaultGroupName,\n \"group_name\": defaultGroupName,\n \"visible_on\": \"\",\n \"is_default\": true\n })\n}\nif (!_.find(setting_groups, { is_hidden: true })) {\n setting_groups.push({\n id: hiddenGroupName,\n group_name: hiddenGroupName,\n visible_on: \"\",\n is_hidden: true\n });\n}\nsetting_groups.forEach(function (group) {\n if (!group.id || group.id != group.group_name) {\n group.id = group.group_name;\n }\n if (/\\$\\{.+\\}/.test(group.visible_on)) {\n group.visible_on = group.visible_on.replaceAll('${', '\\\\${');\n }\n})\n\n//整理字段与分组关系的数据\nlet fieldForGroup = {};\nlet oldGroup = _.cloneDeep(event.data.fieldForGroup);\nsetting_groups.forEach(function (group) {\n if (_.has(oldGroup, group.id)) {\n fieldForGroup[group.id] = oldGroup[group.id];\n oldGroup = _.omit(oldGroup, group.id);\n } else {\n fieldForGroup[group.id] = [];\n }\n})\nif (oldGroup && !_.isEmpty(oldGroup)) {\n _.forEach(oldGroup, function (value, key) {\n fieldForGroup[defaultGroupName] = _.unionBy(fieldForGroup[defaultGroupName], value);\n });\n}\n\n//未分组 放在所有分组开头,隐藏 放在所有分组最后\nconst defaultGroup = fieldForGroup[defaultGroupName];\nconst hiddenGroup = fieldForGroup[hiddenGroupName];\ndelete fieldForGroup[defaultGroupName];\ndelete fieldForGroup[hiddenGroupName];\nfieldForGroup = _.merge({ [defaultGroupName]: defaultGroup }, fieldForGroup, { [hiddenGroupName]: hiddenGroup });\n\n//根据fieldForGroup调整groups顺序,设置分组与保存时需要groups按照顺序\nconst keys = _.keys(fieldForGroup);\nsetting_groups = _.sortBy(setting_groups, function (group) { return _.findIndex(keys, function (key) { return key == group.group_name }) });\n\ndoAction({\n actionType: 'setValue',\n componentId: 'service_field_design',\n args: {\n value: {\n groups: setting_groups\n }\n }\n});\n\ndoAction({\n actionType: 'setValue',\n componentId: \"form_field_design\",\n args: {\n value: { design_field: fieldForGroup }\n }\n});"
101
119
  }
102
120
  ]
103
121
  }
@@ -165,6 +165,16 @@
165
165
  },
166
166
  "filtersFunction": {
167
167
  "hidden": true
168
+ },
169
+ "visible_on": {
170
+ "amis": {
171
+ "type": "input-formula",
172
+ "name": "formula",
173
+ "evalMode": false,
174
+ "variableMode": "tabs",
175
+ "variables": "${VisibleVariables}",
176
+ "id": "u:618105d5bfad"
177
+ }
168
178
  }
169
179
  },
170
180
  "form": {
@@ -172,6 +182,14 @@
172
182
  }
173
183
  }
174
184
  ],
185
+ "api": {
186
+ "method": "get",
187
+ "url": "${context.rootUrl}/service/api/@${_master.record.name}/uiSchema",
188
+ "adaptor": "const VisibleVariables = SteedosUI.getFormulaVariables(payload.fields);\nconst defaultVariables = [VisibleVariables[1]];\npayload = {\n data: {\n VisibleVariables,\n defaultVariables\n }\n};\nreturn payload;",
189
+ "headers": {
190
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
191
+ }
192
+ },
175
193
  "data": {
176
194
  "context": {}
177
195
  },
@@ -230,6 +230,8 @@ module.exports = {
230
230
  "evalMode": false,
231
231
  "type": "input-formula",
232
232
  "placeholder": "公式",
233
+ "variableMode": "tabs",
234
+ "variables": "${defaultVariables}", //公式编辑器内引用的变量,在对象字段表单微页面内定义
233
235
  // "disabledOn": "!!this.defaultValue && !!this.defaultValue.toString()",
234
236
  "className": {
235
237
  "defaultValue_field_formula": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/standard-object-database",
3
- "version": "2.7.0-beta.15",
3
+ "version": "2.7.0-beta.17",
4
4
  "main": "package.service.js",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -12,10 +12,10 @@
12
12
  "description": "steedos package",
13
13
  "dependencies": {
14
14
  "@steedos-widgets/amis-lib": "^1.0.22",
15
- "@steedos/metadata-core": "2.7.0-beta.15",
16
- "@steedos/standard-objects": "2.7.0-beta.15"
15
+ "@steedos/metadata-core": "2.7.0-beta.17",
16
+ "@steedos/standard-objects": "2.7.0-beta.17"
17
17
  },
18
18
  "repository": {},
19
19
  "license": "MIT",
20
- "gitHead": "c1913615a0a0b12e3fd943346d5cf535506577d5"
20
+ "gitHead": "f2bf560c34c9ad19951c39d8fb045fd7b2fe69e6"
21
21
  }