@steedos/service-plugin-amis 2.5.20-beta.24 → 2.5.20-beta.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.
@@ -1,175 +1,178 @@
1
1
  {
2
2
  "type": "page",
3
3
  "body": [
4
- {
5
- "type": "steedos-object-form",
6
- "label": "对象表单",
7
- "objectApiName": "object_listviews",
8
- "recordId": "${recordId}",
9
- "className": "sm:border sm:rounded sm:border-gray-300 bg-white p-4",
10
- "id": "u:f0b602f267d1",
11
- "mode": "edit",
12
- "enableTabs": true,
13
- "tabsMode": "line",
14
- "fieldsExtend": {
15
- "sort": {
16
- "amis": {
17
- "type": "tabs-transfer",
18
- "options": [
19
- ],
20
- "id": "u:32f3e4e73115",
21
- "strictMode": true,
22
- "source": {
23
- "method": "get",
24
- "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/sortFields/options",
25
- "headers": {
26
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
27
- },
28
- "data": null,
29
- "requestAdaptor": "",
30
- "adaptor": "",
31
- "sendOn": "!!this.object_name"
32
- },
33
- "visibleOn": "!!this.object_name",
34
- "sortable": true,
35
- "className": "col-span-2 m-0",
36
- "searchable": true,
37
- "checkAll": false,
38
- "clearValueOnHidden": false,
39
- "joinValues": false,
40
- "extractValue": true,
41
- "en-US": {
42
- "label": "Default Sort Order"
43
- },
44
- "multiple": true
45
- }
4
+ {
5
+ "type": "steedos-object-form",
6
+ "label": "对象表单",
7
+ "objectApiName": "object_listviews",
8
+ "recordId": "${recordId}",
9
+ "className": "sm:rounded sm:border-gray-300 bg-white",
10
+ "id": "u:f0b602f267d1",
11
+ "mode": "edit",
12
+ "enableTabs": true,
13
+ "tabsMode": "line",
14
+ "fieldsExtend": {
15
+ "sort": {
16
+ "label": "",
17
+ "amis": {
18
+ "type": "tabs-transfer",
19
+ "options": [
20
+ ],
21
+ "id": "u:32f3e4e73115",
22
+ "strictMode": true,
23
+ "source": {
24
+ "method": "get",
25
+ "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/sortFields/options",
26
+ "headers": {
27
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
28
+ },
29
+ "data": null,
30
+ "requestAdaptor": "",
31
+ "adaptor": "",
32
+ "sendOn": "!!this.object_name"
46
33
  },
47
- "filters": {
48
- "amis": {
49
- "type": "group",
50
- "body": [
51
- {
52
- "type": "radios",
53
- "label": "过滤器配置方式",
54
- "name": "_filters_type_controller",
55
- "options": [
56
- {
57
- "label": "条件组合",
58
- "value": "conditions"
59
- },
60
- {
61
- "label": "js脚本",
62
- "value": "function"
63
- }
64
- ],
65
- "id": "u:318671bc196c",
66
- "joinValues": true,
67
- "className": "col-span-2 m-0",
68
- "language": "javascript",
69
- "visibleOn": "false",
70
- "en-US": {
71
- "label": "Controller"
72
- }
73
- },
34
+ "visibleOn": "!!this.object_name",
35
+ "sortable": true,
36
+ "className": "col-span-2 m-0",
37
+ "searchable": true,
38
+ "checkAll": false,
39
+ "clearValueOnHidden": false,
40
+ "joinValues": false,
41
+ "extractValue": true,
42
+ "en-US": {
43
+ "label": "Default Sort Order"
44
+ },
45
+ "multiple": true
46
+ }
47
+ },
48
+ "filters": {
49
+ "label": "",
50
+ "amis": {
51
+ "type": "group",
52
+ "body": [
53
+ {
54
+ "type": "radios",
55
+ "label": "过滤器配置方式",
56
+ "name": "_filters_type_controller",
57
+ "options": [
74
58
  {
75
- "type": "condition-builder",
76
- "label": "",
77
- "name": "_filters_conditions",
78
- "description": "",
79
- "id": "u:a9f2232e30d7",
80
- "source": {
81
- "method": "get",
82
- "url": "${context.rootUrl}/service/api/amis-metadata-listviews/getFilterFields?objectName=${object_name}",
83
- "dataType": "json",
84
- "headers": {
85
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
86
- }
87
- },
88
- "disabled": false,
89
- "className": "col-span-2 m-0",
90
- "visibleOn": "!!this.object_name",
91
- "labelClassName": "",
92
- "en-US": {
93
- "label": "Filters Conditions"
94
- }
59
+ "label": "条件组合",
60
+ "value": "conditions"
95
61
  },
96
62
  {
97
- "type": "editor",
98
63
  "label": "js脚本",
99
- "name": "_filters_function",
100
- "id": "u:84714ec9abba",
101
- "visibleOn": "!!this.object_name && !!this._filters_type_controller && _filters_type_controller== 'function'",
102
- "className": "col-span-2 m-0",
103
- "labelClassName": "hidden"
64
+ "value": "function"
104
65
  }
105
- ]
106
- }
107
- },
108
- "mobile_columns": {
109
- "amis": {
110
- "type": "transfer",
111
- "id": "u:e80d9f58dfd0",
112
- "selectMode": "list",
113
- "searchable": true,
114
- "searchApi": "",
115
- "sortable": true,
116
- "mode": "normal",
117
- "searchResultMode": "list",
118
- "joinValues": false,
119
- "extractValue": true,
120
- "source": {
121
- "method": "get",
122
- "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
123
- "headers": {
124
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
125
- },
126
- "data": null,
127
- "requestAdaptor": "",
128
- "adaptor": "",
129
- "sendOn": "!!this.object_name"
130
- },
131
- "visibleOn": "!!this.object_name",
66
+ ],
67
+ "id": "u:318671bc196c",
68
+ "joinValues": true,
132
69
  "className": "col-span-2 m-0",
70
+ "language": "javascript",
71
+ "visibleOn": "false",
133
72
  "en-US": {
134
- "label": "Mobile Columns"
135
- },
136
- "multiple": true
137
- }
138
- },
139
- "searchable_fields": {
140
- "amis": {
141
- "type": "transfer",
142
- "options": [
143
- ],
144
- "selectMode": "list",
145
- "searchable": true,
146
- "searchApi": "",
147
- "sortable": true,
148
- "mode": "normal",
149
- "searchResultMode": "list",
150
- "joinValues": false,
151
- "extractValue": true,
73
+ "label": "Controller"
74
+ }
75
+ },
76
+ {
77
+ "type": "condition-builder",
78
+ "label": "",
79
+ "name": "_filters_conditions",
80
+ "description": "",
81
+ "id": "u:a9f2232e30d7",
152
82
  "source": {
153
83
  "method": "get",
154
- "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
84
+ "url": "${context.rootUrl}/service/api/amis-metadata-listviews/getFilterFields?objectName=${object_name}",
85
+ "dataType": "json",
155
86
  "headers": {
156
87
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
157
- },
158
- "data": null,
159
- "requestAdaptor": "",
160
- "adaptor": "",
161
- "sendOn": "!!this.object_name"
88
+ }
162
89
  },
90
+ "disabled": false,
91
+ "className": "col-span-2 m-0",
163
92
  "visibleOn": "!!this.object_name",
93
+ "labelClassName": "",
94
+ "en-US": {
95
+ "label": "Filters Conditions"
96
+ }
97
+ },
98
+ {
99
+ "type": "editor",
100
+ "label": "js脚本",
101
+ "name": "_filters_function",
102
+ "id": "u:84714ec9abba",
103
+ "visibleOn": "!!this.object_name && !!this._filters_type_controller && _filters_type_controller== 'function'",
164
104
  "className": "col-span-2 m-0",
165
- "multiple": true,
166
- "id": "u:adb91066539e"
105
+ "labelClassName": "hidden"
167
106
  }
168
- }
169
- },
170
- "initApiAdaptor": "\nvar data;\nif (recordId) {\n data = payload.data || { _filters_type_controller: 'conditions' };\n //数据格式转换\n if (data) {\n data.sort = lodash.map(data.sort, (item) => {\n return `:asc`\n });\n data.mobile_columns = lodash.map(data.mobile_columns, 'field');\n data.searchable_fields = lodash.map(data.searchable_fields, 'field');\n\n if (data.filters && lodash.isString(data.filters)) {\n try {\n data.filters = JSON.parse(data.filters);\n } catch (e) { }\n }\n\n if (data.filters && lodash.isString(data.filters)) {\n data._filters_type_controller = 'function';\n } else {\n data._filters_type_controller = 'conditions'\n }\n\n if (data._filters_type_controller === 'conditions') {\n data._filters_conditions = window.amisConvert.filtersToConditions(data.filters || []);\n } else {\n data._filters_function = data.filters;\n }\n }\n} else {\n const defaultData = api.body.defaultData;\n let defaultValues = {};\n // TODO:字段默认值后期添加\n if (defaultData && _.isObject(defaultData) && !_.isArray(defaultData)) {\n data = Object.assign({}, defaultValues, defaultData)\n }\n}\nfor (key in data) {\n if (data[key] === null) {\n delete data[key];\n }\n}\npayload.data = data;\ndelete payload.extensions; if (data.is_enable != false) { data.is_enable = true; };\nreturn payload;",
171
- "apiRequestAdaptor": "delete formData.created;\ndelete formData.created_by;\ndelete formData.modified;\ndelete formData.modified_by;\ndelete formData._display;\n\n//数据格式转换\n\nformData.sort = lodash.map(formData.sort, (item) => {\n const arr = item.split(':');\n return { field_name: arr[0], order: arr[1] };\n});\n\nformData.mobile_columns = lodash.map(formData.mobile_columns, (item) => {\n return { field: item };\n});\n\nformData.searchable_fields = lodash.map(formData.searchable_fields, (item) => {\n return { field: item };\n});\n\nif (!formData._filters_type_controller) {\n formData._filters_type_controller = 'conditions';\n}\n\nif (formData._filters_type_controller === 'conditions' && formData._filters_conditions) {\n formData.filters = window.amisConvert.conditionsToFilters(formData._filters_conditions);\n // formData.filters = JSON.stringify(window.amisConvert.conditionsToFilters(formData._filters_conditions), null, 4);\n} else {\n formData.filters = formData._filters_function || null;\n}\n\ndelete formData._filters_type_controller;\ndelete formData._filters_conditions;\ndelete formData._filters_function;\n\nquery = `mutation{record: object_listviews__insert(doc: {__saveData}){_id}}`;\nif (formData.recordId) {\n query = `mutation{record: object_listviews__update(id: \"` + formData._id + `\", doc: {__saveData}){_id}}`;\n};\n__saveData = JSON.stringify(JSON.stringify(formData));\n\napi.data = { query: query.replace('{__saveData}', __saveData) };\nreturn api;"
172
- }
107
+ ]
108
+ }
109
+ },
110
+ "mobile_columns": {
111
+ "amis": {
112
+ "type": "transfer",
113
+ "id": "u:e80d9f58dfd0",
114
+ "selectMode": "list",
115
+ "searchable": true,
116
+ "searchApi": "",
117
+ "sortable": true,
118
+ "mode": "normal",
119
+ "searchResultMode": "list",
120
+ "joinValues": false,
121
+ "extractValue": true,
122
+ "source": {
123
+ "method": "get",
124
+ "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
125
+ "headers": {
126
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
127
+ },
128
+ "data": null,
129
+ "requestAdaptor": "",
130
+ "adaptor": "",
131
+ "sendOn": "!!this.object_name"
132
+ },
133
+ "visibleOn": "!!this.object_name",
134
+ "className": "col-span-2 m-0",
135
+ "en-US": {
136
+ "label": "Mobile Columns"
137
+ },
138
+ "multiple": true
139
+ }
140
+ },
141
+ "searchable_fields": {
142
+ "label":"",
143
+ "amis": {
144
+ "type": "transfer",
145
+ "options": [
146
+ ],
147
+ "selectMode": "list",
148
+ "searchable": true,
149
+ "searchApi": "",
150
+ "sortable": true,
151
+ "mode": "normal",
152
+ "searchResultMode": "list",
153
+ "joinValues": false,
154
+ "extractValue": true,
155
+ "source": {
156
+ "method": "get",
157
+ "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
158
+ "headers": {
159
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
160
+ },
161
+ "data": null,
162
+ "requestAdaptor": "",
163
+ "adaptor": "",
164
+ "sendOn": "!!this.object_name"
165
+ },
166
+ "visibleOn": "!!this.object_name",
167
+ "className": "col-span-2 m-0",
168
+ "multiple": true,
169
+ "id": "u:adb91066539e"
170
+ }
171
+ }
172
+ },
173
+ "initApiAdaptor": "\nvar data;\nif (recordId) {\n data = payload.data || { _filters_type_controller: 'conditions' };\n //数据格式转换\n if (data) {\n data.sort = lodash.map(data.sort, (item) => {\n return item.field_name + \":\" + item.order;\n });\n data.mobile_columns = lodash.map(data.mobile_columns, 'field');\n data.searchable_fields = lodash.map(data.searchable_fields, 'field');\n\n if (data.filters && lodash.isString(data.filters)) {\n try {\n data.filters = JSON.parse(data.filters);\n } catch (e) { }\n }\n\n if (data.filters && lodash.isString(data.filters)) {\n data._filters_type_controller = 'function';\n } else {\n data._filters_type_controller = 'conditions'\n }\n\n if (data._filters_type_controller === 'conditions') {\n data._filters_conditions = window.amisConvert.filtersToConditions(data.filters || []);\n } else {\n data._filters_function = data.filters;\n }\n }\n} else {\n const uiSchema = api.body.uiSchema;\n const defaultData = api.body.defaultData;\n let defaultValues = {};\n _.each(uiSchema && uiSchema.fields, function (field) {\n var value = SteedosUI.getFieldDefaultValue(field, api.body.global);\n if (!_.isNil(value)) {\n defaultValues[field.name] = value;\n }\n });\n if (defaultData && _.isObject(defaultData) && !_.isArray(defaultData)) {\n data = Object.assign({}, defaultValues, defaultData)\n }\n}\nfor (key in data) {\n if (data[key] === null) {\n delete data[key];\n }\n}\npayload.data = data;\ndelete payload.extensions; if (data.is_enable != false) { data.is_enable = true; };\nreturn payload;",
174
+ "apiRequestAdaptor": "delete formData.created;\ndelete formData.created_by;\ndelete formData.modified;\ndelete formData.modified_by;\ndelete formData._display;\n\n//数据格式转换\nformData.sort = lodash.map(formData.sort, (item) => {\n const arr = item.split(':');\n return { field_name: arr[0], order: arr[1] };\n});\n\nformData.mobile_columns = lodash.map(formData.mobile_columns, (item) => {\n return { field: item };\n});\n\nformData.searchable_fields = lodash.map(formData.searchable_fields, (item) => {\n return { field: item };\n});\n\nif (!formData._filters_type_controller) {\n formData._filters_type_controller = 'conditions';\n}\n\nif (formData._filters_type_controller === 'conditions' && formData._filters_conditions) {\n formData.filters = window.amisConvert.conditionsToFilters(formData._filters_conditions);\n // formData.filters = JSON.stringify(window.amisConvert.conditionsToFilters(formData._filters_conditions), null, 4);\n} else {\n formData.filters = formData._filters_function || null;\n}\n\ndelete formData._filters_type_controller;\ndelete formData._filters_conditions;\ndelete formData._filters_function;\n\nquery = `mutation{record: object_listviews__insert(doc: {__saveData}){_id}}`;\nif (formData.recordId) {\n query = `mutation{record: object_listviews__update(id: \"` + formData._id + `\", doc: {__saveData}){_id}}`;\n};\n__saveData = JSON.stringify(JSON.stringify(formData));\n\napi.data = { query: query.replace('{__saveData}', __saveData) };\nreturn api;"
175
+ }
173
176
  ],
174
177
  "regions": [
175
178
  "body"
@@ -181,5 +184,17 @@
181
184
  "name": "page_edit_${recordId}",
182
185
  "initApi": null,
183
186
  "initFetch": null,
184
- "id": "u:6ada123f9d4a"
187
+ "id": "u:6ada123f9d4a",
188
+ "onEvent": {
189
+ "init": {
190
+ "weight": 0,
191
+ "actions": [
192
+ {
193
+ "actionType": "custom",
194
+ "script": "//初始化时给外层dialog加上类名,使过滤组件popover正常显示\n$('.steedos-object-listview-form-page').closest('.amis-dialog-widget.antd-Modal').addClass('steedos-overflow-visible-dialog');"
195
+ }
196
+ ]
197
+ }
198
+ },
199
+ "className": "steedos-object-listview-form-page"
185
200
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/service-plugin-amis",
3
- "version": "2.5.20-beta.24",
3
+ "version": "2.5.20-beta.25",
4
4
  "main": "package.service.js",
5
5
  "scripts": {
6
6
  "build": "yarn build:tailwind-base && yarn build:tailwind",
@@ -13,7 +13,7 @@
13
13
  "publishConfig": {
14
14
  "access": "public"
15
15
  },
16
- "gitHead": "44680c1db4247e1b39852740401fcb52c71f1333",
16
+ "gitHead": "1acd0a722eac9e2269118d78f435ead59e5bb952",
17
17
  "devDependencies": {
18
18
  "tailwindcss": "3.2.4"
19
19
  }