@steedos/service-plugin-amis 2.4.0-beta.30 → 2.4.0-beta.32
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.
- package/main/default/client/amis.render.client.js +0 -17
- package/main/default/pages/action_field_updates.page.amis.json +26 -54
- package/package.json +2 -2
- package/main/default/client/load.assets.client.js +0 -26
- package/main/default/client/style.client.js +0 -24
- package/main/default/client/tailwind.client.js +0 -35
|
@@ -6,23 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
; (function () {
|
|
8
8
|
|
|
9
|
-
const loadCss = (href)=>{
|
|
10
|
-
try {
|
|
11
|
-
// 加载Amis css
|
|
12
|
-
let amisStyle = document.createElement("link");
|
|
13
|
-
amisStyle.setAttribute("rel", "stylesheet");
|
|
14
|
-
amisStyle.setAttribute("type", "text/css");
|
|
15
|
-
amisStyle.setAttribute("href", href);
|
|
16
|
-
document.getElementsByTagName("head")[0].appendChild(amisStyle);
|
|
17
|
-
} catch (error) {
|
|
18
|
-
console.error(error)
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
// loadCss(Steedos.absoluteUrl("/unpkg.com/amis/sdk/sdk.css"))
|
|
22
|
-
// loadCss(Steedos.absoluteUrl("/unpkg.com/amis/sdk/helper.css"))
|
|
23
|
-
// loadCss(Steedos.absoluteUrl("/unpkg.com/amis/sdk/iconfont.css"))
|
|
24
|
-
loadCss(Steedos.absoluteUrl("/amis/amis.css"))
|
|
25
|
-
|
|
26
9
|
try {
|
|
27
10
|
window['attrAccept'] = function (file, acceptedFiles) {
|
|
28
11
|
if (file && acceptedFiles) {
|
|
@@ -59,18 +59,26 @@
|
|
|
59
59
|
"type": "select",
|
|
60
60
|
"joinValues": false,
|
|
61
61
|
"extractValue": true,
|
|
62
|
-
"
|
|
62
|
+
"searchable": true,
|
|
63
|
+
"source": {
|
|
63
64
|
"method": "post",
|
|
64
65
|
"url": "${context.rootUrl}/graphql",
|
|
65
66
|
"data": {
|
|
66
|
-
"
|
|
67
|
-
"
|
|
67
|
+
"orderBy": "${orderBy}",
|
|
68
|
+
"orderDir": "${orderDir}",
|
|
69
|
+
"pageNo": "${page}",
|
|
70
|
+
"pageSize": "${perPage}",
|
|
71
|
+
"query": "{options:objects(filters: {__filters}, top: {__top}, sort: \"{__sort}\"){_id label:label value:name},count:objects__count(filters:{__filters}),defaultValueOptions:objects(filters:{__options_filters}){_id label:label value:name}}",
|
|
68
72
|
"$term": "$term",
|
|
69
|
-
"$value": "$object_name
|
|
73
|
+
"$value": "$object_name",
|
|
74
|
+
"$": "$$",
|
|
70
75
|
"rfield": "${object_name}"
|
|
71
76
|
},
|
|
72
|
-
"
|
|
73
|
-
|
|
77
|
+
"headers": {
|
|
78
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
79
|
+
},
|
|
80
|
+
"adaptor": "\n const data = payload.data;\n var defaultValueOptions = data.defaultValueOptions;\n // 字段值下拉选项合并到options中\n data.options = _.unionWith(defaultValueOptions, data.options, function(a,b){\n return a[\"value\"]=== b[\"value\"];\n });\n delete data.defaultValueOptions;\n payload.data.options = data.options;\n return payload;\n ",
|
|
81
|
+
"requestAdaptor": "\n var filters = [];\n var top = 10;\n if(api.data.$term){\n filters = [[\"label\", \"contains\", api.data.$term]];\n }\n // else if(api.data.$value){\n // filters = [[\"_id\", \"=\", api.data.$value]];\n // }\n\n var fieldFilters = undefined;\n if(fieldFilters && fieldFilters.length){\n filters.push(fieldFilters);\n }\n\n const filtersFunction = undefined;\n\n if(filtersFunction){\n const _filters = filtersFunction(filters, api.data.$);\n if(_filters && _filters.length > 0){\n filters.push(_filters);\n }\n }\n var sort = \"\";\n api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', top).replace('{__sort}', sort.trim());\n\n var defaultValue = api.data.$value;\n var optionsFiltersOp = \"=\";\n var optionsFilters = [[\"name\", optionsFiltersOp, []]];\n if (defaultValue && !api.data.$term) { \n // 字段值单独请求,没值的时候在请求中返回空\n optionsFilters = [[\"name\", optionsFiltersOp, defaultValue]];\n }\n api.data.query = api.data.query.replace(/{__options_filters}/g, JSON.stringify(optionsFilters));\n return api;\n "
|
|
74
82
|
},
|
|
75
83
|
"className": "m-1",
|
|
76
84
|
"labelClassName": "text-left",
|
|
@@ -85,19 +93,10 @@
|
|
|
85
93
|
"type": "select",
|
|
86
94
|
"joinValues": false,
|
|
87
95
|
"extractValue": true,
|
|
88
|
-
"
|
|
89
|
-
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"query": "{objects(filters: [\"_id\", \"=\", \"-1\"]){_id}}",
|
|
93
|
-
"$": "$$",
|
|
94
|
-
"$term": "$term",
|
|
95
|
-
"$value": "$target_object._id",
|
|
96
|
-
"object_name": "$object_name",
|
|
97
|
-
"rfield": "${object_name}"
|
|
98
|
-
},
|
|
99
|
-
"requestAdaptor": "\n var filters = '[]';\n var top = 10;\n if(api.data.$term){\n filters = '[\"name\", \"contains\", \"'+ api.data.$term +'\"]';\n }else if(api.data.$value){\n filters = '[\"_id\", \"=\", \"'+ api.data.$value +'\"]';\n }\n api.data.query = api.data.query.replace(/{__filters}/g, filters).replace('{__top}', top);\n return api;\n ",
|
|
100
|
-
"adaptor": "\n payload.data.options = eval(function anonymous(doc\n) {\n\n var object = Creator.objectsByName[doc.object_name];\n if(object){\n var _options = [{label: object.label, value: object.name}];\n _.forEach(object.fields, function (field, fname) {\n if(field && field.type === 'master_detail' && _.isString(field.reference_to)){\n var referenceToObject = Creator.objectsByName[field.reference_to];\n if(referenceToObject){\n _options.push({\n label: referenceToObject.label,\n value: field.name,\n });\n }\n }\n });\n return _options;\n }\n return [];\n\n})(api.data);\n return payload;\n "
|
|
96
|
+
"searchable": true,
|
|
97
|
+
"source": {
|
|
98
|
+
"method": "get",
|
|
99
|
+
"url": "${context.rootUrl}/service/api/action_field_updates/target_object/options?objectName=${object_name}"
|
|
101
100
|
},
|
|
102
101
|
"className": "m-1",
|
|
103
102
|
"labelClassName": "text-left",
|
|
@@ -112,20 +111,10 @@
|
|
|
112
111
|
"type": "select",
|
|
113
112
|
"joinValues": false,
|
|
114
113
|
"extractValue": true,
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"query": "{objects(filters: [\"_id\", \"=\", \"-1\"]){_id}}",
|
|
120
|
-
"$": "$$",
|
|
121
|
-
"$term": "$term",
|
|
122
|
-
"$value": "$field_name._id",
|
|
123
|
-
"object_name": "$object_name",
|
|
124
|
-
"target_object": "$target_object",
|
|
125
|
-
"rfield": "${object_name}"
|
|
126
|
-
},
|
|
127
|
-
"requestAdaptor": "\n var filters = '[]';\n var top = 10;\n if(api.data.$term){\n filters = '[\"name\", \"contains\", \"'+ api.data.$term +'\"]';\n }else if(api.data.$value){\n filters = '[\"_id\", \"=\", \"'+ api.data.$value +'\"]';\n }\n api.data.query = api.data.query.replace(/{__filters}/g, filters).replace('{__top}', top);\n return api;\n ",
|
|
128
|
-
"adaptor": "\n payload.data.options = eval(function anonymous(doc\n) {\n\n var mainObjectName = null;\n if(doc.target_object && doc.target_object != doc.object_name){\n mainObjectName = Creator.objectsByName[doc.object_name].fields[doc.target_object].reference_to;\n }else{\n mainObjectName = doc.object_name;\n }\n var object = Creator.objectsByName[mainObjectName];\n if(object){\n var _options = [];\n _.forEach(object.fields, function (field, fname) {\n if([\"formula\", \"summary\", \"autonumber\"].indexOf(field.type) < 0){\n /*公式、累计汇总、自动编号三种字段类型是只读的,不允许字段更新来变更其值*/\n _options.push({\n label: field.label,\n value: field.name,\n });\n }\n });\n return _options;\n }\n return [];\n\n})(api.data);\n return payload;\n "
|
|
114
|
+
"searchable": true,
|
|
115
|
+
"source": {
|
|
116
|
+
"method": "get",
|
|
117
|
+
"url": "${context.rootUrl}/service/api/action_field_updates/field_name/options?objectName=${object_name}&targetObject=${target_object}"
|
|
129
118
|
},
|
|
130
119
|
"className": "m-1",
|
|
131
120
|
"labelClassName": "text-left",
|
|
@@ -140,21 +129,9 @@
|
|
|
140
129
|
"type": "select",
|
|
141
130
|
"joinValues": false,
|
|
142
131
|
"extractValue": true,
|
|
143
|
-
"
|
|
144
|
-
"method": "
|
|
145
|
-
"url": "${context.rootUrl}/
|
|
146
|
-
"data": {
|
|
147
|
-
"query": "{objects(filters: [\"_id\", \"=\", \"-1\"]){_id}}",
|
|
148
|
-
"$": "$$",
|
|
149
|
-
"$term": "$term",
|
|
150
|
-
"$value": "$operation._id",
|
|
151
|
-
"field_name": "$field_name",
|
|
152
|
-
"target_object": "$target_object",
|
|
153
|
-
"object_name": "$object_name",
|
|
154
|
-
"rfield": "${object_name}"
|
|
155
|
-
},
|
|
156
|
-
"requestAdaptor": "\n var filters = '[]';\n var top = 10;\n if(api.data.$term){\n filters = '[\"name\", \"contains\", \"'+ api.data.$term +'\"]';\n }else if(api.data.$value){\n filters = '[\"_id\", \"=\", \"'+ api.data.$value +'\"]';\n }\n api.data.query = api.data.query.replace(/{__filters}/g, filters).replace('{__top}', top);\n return api;\n ",
|
|
157
|
-
"adaptor": "\n payload.data.options = eval(function anonymous(doc\n) {\n\n var mainObjectName = null;\n if(doc.target_object && doc.target_object != doc.object_name){\n mainObjectName = Creator.objectsByName[doc.object_name].fields[doc.target_object].reference_to;\n }else{\n mainObjectName = doc.object_name;\n }\n var object = Creator.objectsByName[mainObjectName];\n if(object && doc.field_name){\n var _options = [];\n var field = object.fields[doc.field_name];\n if(field && field.type != 'boolean'){\n _options.push({\n label: TAPi18n.__(\"action_field_updates_field_operation_options_null\"),\n value: 'null',\n }) \n }\n _options.push({\n label: TAPi18n.__(\"action_field_updates_field_operation_options_formula\"),\n value: 'formula',\n });\n _options.push({\n label: TAPi18n.__(\"action_field_updates_field_operation_options_literal\"),\n value: 'literal',\n })\n return _options;\n }\n return [];\n\n})(api.data);\n return payload;\n "
|
|
132
|
+
"source": {
|
|
133
|
+
"method": "get",
|
|
134
|
+
"url": "${context.rootUrl}/service/api/action_field_updates/operation/options?objectName=${object_name}&targetObject=${target_object}&fieldName=${field_name}"
|
|
158
135
|
},
|
|
159
136
|
"className": "m-1",
|
|
160
137
|
"labelClassName": "text-left",
|
|
@@ -183,12 +160,7 @@
|
|
|
183
160
|
"messages": {},
|
|
184
161
|
"schemaApi": {
|
|
185
162
|
"method": "get",
|
|
186
|
-
"url": "${context.rootUrl}/service/api
|
|
187
|
-
"adaptor": "const formData = api.body;\nconst target_field_name = formData.field_name;\nconst target_object_uiSchema = payload;\nconst target_fields = target_object_uiSchema && target_object_uiSchema.fields;\nconst target_field_type = target_fields && target_fields[target_field_name].type;\nlet literal_value_schema = {\n \"type\": \"text\",\n \"name\": \"literal_value\",\n \"label\": \"指定新字段值\",\n \"required\": false,\n \"is_wide\": true,\n \"labelClassName\": \"text-left\"\n}\nif (target_field_type) {\n literal_value_schema = Object.assign({}, target_object_uiSchema.fields[target_field_name], {\n name: \"literal_value\",\n label: \"指定新字段值\",\n disabled: false,\n readonly: false,\n is_wide: true\n });\n}\npayload = {\n \"status\": 0,\n \"msg\": \"\",\n \"data\": {\n \"body\": [\n {\n \"type\": \"steedos-field\",\n \"field\": literal_value_schema,\n \"name\": \"literal_value\",\n \"clearValueOnHidden\": true,\n \"fieldName\": \"literal_value\",\n \"visibleOn\": \"this.operation === 'literal'\"\n }\n ]\n }\n}\nreturn payload;",
|
|
188
|
-
"sendOn": "!!this.object_name && !!this.field_name && this.operation === 'literal'",
|
|
189
|
-
"headers": {
|
|
190
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
191
|
-
},
|
|
163
|
+
"url": "${context.rootUrl}/service/api/action_field_updates/literal_value/options?objectName=${object_name}&targetObject=${target_object}&fieldName=${field_name}&operation=${operation}",
|
|
192
164
|
"data": {
|
|
193
165
|
"&": "$$"
|
|
194
166
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-plugin-amis",
|
|
3
|
-
"version": "2.4.0-beta.
|
|
3
|
+
"version": "2.4.0-beta.32",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "yarn build:tailwind-base && yarn build:tailwind",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@steedos-widgets/amis-lib": "^1.0.22"
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "6ce63579f48afb751446023df8ff93a859e606ae",
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"tailwindcss": "3.2.4"
|
|
22
22
|
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: baozhoutao@steedos.com
|
|
3
|
-
* @Date: 2022-12-09 18:23:36
|
|
4
|
-
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
-
* @LastEditTime: 2022-12-17 14:35:49
|
|
6
|
-
* @Description:
|
|
7
|
-
*/
|
|
8
|
-
// 解决多个react 问题. 注册组件时, 使用 amis 自带的 react , 运行 steedos 相关组件时, 使用 全局 react
|
|
9
|
-
window.addEventListener('message', function (event) {
|
|
10
|
-
const { data } = event;
|
|
11
|
-
if (data.type === 'Builder.loaded') {
|
|
12
|
-
if(Meteor.settings.public.page && Meteor.settings.public.page.assetUrls){
|
|
13
|
-
const defaultAssetsUrls = Meteor.settings.public.page.assetUrls.split(',')
|
|
14
|
-
Promise.all([
|
|
15
|
-
waitForThing(window, 'amis'),
|
|
16
|
-
]).then(()=>{
|
|
17
|
-
// window.__React = window.React;
|
|
18
|
-
// window.__ReactDOM = window.ReactDOM;
|
|
19
|
-
window.React = amisRequire('react');
|
|
20
|
-
window.ReactDOM = amisRequire('react-dom');
|
|
21
|
-
window.ReactDom = window.ReactDOM;
|
|
22
|
-
Builder.registerRemoteAssets(defaultAssetsUrls);
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
})
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
(function () {
|
|
2
|
-
try {
|
|
3
|
-
var styleCss = $(`<style>
|
|
4
|
-
.steedos .creator-content-wrapper .steedos-page .page-header-wrapper{
|
|
5
|
-
display: none;
|
|
6
|
-
}
|
|
7
|
-
.ant-modal.absolute .ant-modal-content{
|
|
8
|
-
/*使用绝对定位显示弹出窗口时,内层content最大高度不用限制*/
|
|
9
|
-
max-height: unset;
|
|
10
|
-
}
|
|
11
|
-
.page-form-object_layouts .steedos-amis-form .antd-Collapse .antd-Table-table .antd-Form--normal{
|
|
12
|
-
/*格式内的单元格空白太多*/
|
|
13
|
-
display: block!important;
|
|
14
|
-
}
|
|
15
|
-
.page-form-object_layouts .antd-Table .antd-Field--quickEditable .antd-PlainField{
|
|
16
|
-
/*快速编辑只读状态时编辑按钮不应该换行显示*/
|
|
17
|
-
display: inline;
|
|
18
|
-
}
|
|
19
|
-
</style>`);
|
|
20
|
-
$("head").append(styleCss);
|
|
21
|
-
} catch (error) {
|
|
22
|
-
console.log(error);
|
|
23
|
-
}
|
|
24
|
-
})();
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
try {
|
|
2
|
-
// 加载 tailwind
|
|
3
|
-
// if(typeof BigInt === 'undefined') {
|
|
4
|
-
// let tailwindStyle = document.createElement("link");
|
|
5
|
-
// tailwindStyle.setAttribute("rel", "stylesheet");
|
|
6
|
-
// tailwindStyle.setAttribute("type", "text/css");
|
|
7
|
-
// tailwindStyle.setAttribute("href", Steedos.absoluteUrl("/tailwind/tailwind.css"));
|
|
8
|
-
// document.getElementsByTagName("head")[0].appendChild(tailwindStyle);
|
|
9
|
-
// }else{
|
|
10
|
-
// let tailwindScript = document.createElement("script");
|
|
11
|
-
// tailwindScript.setAttribute("src", Steedos.absoluteUrl('/tailwind/tailwind.js'));
|
|
12
|
-
// document.getElementsByTagName("head")[0].appendChild(tailwindScript);
|
|
13
|
-
// }
|
|
14
|
-
|
|
15
|
-
const head = document.head || document.getElementsByTagName('head')[0]
|
|
16
|
-
|
|
17
|
-
let tailwindBase = document.createElement("link");
|
|
18
|
-
tailwindBase.setAttribute("rel", "stylesheet");
|
|
19
|
-
tailwindBase.setAttribute("type", "text/css");
|
|
20
|
-
tailwindBase.setAttribute("href", Steedos.absoluteUrl("/tailwind/tailwind-base.css"));
|
|
21
|
-
|
|
22
|
-
if (head.firstChild) {
|
|
23
|
-
head.insertBefore(tailwindBase, head.firstChild)
|
|
24
|
-
} else {
|
|
25
|
-
head.appendChild(tailwindBase)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
let tailwindStyle = document.createElement("link");
|
|
29
|
-
tailwindStyle.setAttribute("rel", "stylesheet");
|
|
30
|
-
tailwindStyle.setAttribute("type", "text/css");
|
|
31
|
-
tailwindStyle.setAttribute("href", Steedos.absoluteUrl("/tailwind/tailwind-steedos.css"));
|
|
32
|
-
head.appendChild(tailwindStyle)
|
|
33
|
-
} catch (error) {
|
|
34
|
-
console.error(error)
|
|
35
|
-
};
|