@steedos/service-plugin-amis 2.4.0-beta.20 → 2.4.0-beta.23
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.
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
if(comp.componentType === 'amisSchema'){
|
|
95
95
|
let amisReact = amisRequire('react');
|
|
96
96
|
AmisWrapper = function(props){
|
|
97
|
-
const { body, render } = props
|
|
97
|
+
const { $schema, body, render } = props
|
|
98
98
|
const [schema, setSchema] = amisReact.useState(null);
|
|
99
99
|
amisReact.useEffect(()=>{
|
|
100
100
|
const result = Component.class(props);
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
}else{
|
|
106
106
|
setSchema(result)
|
|
107
107
|
}
|
|
108
|
-
}, [])
|
|
108
|
+
}, [JSON.stringify($schema)])
|
|
109
109
|
return amisReact.createElement(amisReact.Fragment, null, amisReact.createElement(amisReact.Fragment, null, schema && render ? render('body', schema) : ''), amisReact.createElement(amisReact.Fragment, null, render ? render('body', body) : ''));
|
|
110
110
|
}
|
|
111
111
|
}
|
|
@@ -248,10 +248,10 @@
|
|
|
248
248
|
const schema = props.schema;
|
|
249
249
|
const data = props.data;
|
|
250
250
|
const name = props.name;
|
|
251
|
-
|
|
252
|
-
if(SteedosUI.refs[
|
|
253
|
-
if(SteedosUI.refs[
|
|
254
|
-
SteedosUI.refs[
|
|
251
|
+
const refName = schema.name || schema.id;
|
|
252
|
+
if(SteedosUI.refs[refName]){
|
|
253
|
+
if(SteedosUI.refs[refName].unmount){
|
|
254
|
+
SteedosUI.refs[refName].unmount()
|
|
255
255
|
}else{
|
|
256
256
|
console.log(`not find amis scope unmount`)
|
|
257
257
|
}
|
|
@@ -284,8 +284,9 @@
|
|
|
284
284
|
|
|
285
285
|
amisReact.useEffect(()=>{
|
|
286
286
|
const amisScope = amisRequire('amis/embed').embed(`.steedos-amis-render-scope-${name}`,schema, {data, name, locale: getAmisLng()}, Object.assign({}, AmisEnv, env))
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
const refName = schema.name || schema.id;
|
|
288
|
+
if(window.SteedosUI && refName){
|
|
289
|
+
SteedosUI.refs[refName] = amisScope;
|
|
289
290
|
}
|
|
290
291
|
}, [])
|
|
291
292
|
return amisReact.createElement("div", {
|
|
@@ -296,10 +297,10 @@
|
|
|
296
297
|
};
|
|
297
298
|
|
|
298
299
|
window.renderAmis = function (root, schema, data, env) {
|
|
299
|
-
|
|
300
|
-
if(SteedosUI.refs[
|
|
301
|
-
if(SteedosUI.refs[
|
|
302
|
-
SteedosUI.refs[
|
|
300
|
+
const refName = schema.name || schema.id;
|
|
301
|
+
if(SteedosUI.refs[refName]){
|
|
302
|
+
if(SteedosUI.refs[refName].unmount){
|
|
303
|
+
SteedosUI.refs[refName].unmount()
|
|
303
304
|
}else{
|
|
304
305
|
console.log(`not find amis scope unmount`)
|
|
305
306
|
}
|
|
@@ -329,8 +330,8 @@
|
|
|
329
330
|
|
|
330
331
|
|
|
331
332
|
const amisScope = amisRequire('amis/embed').embed(root, schema, {data, name, locale: getAmisLng()}, Object.assign({}, AmisEnv, env))
|
|
332
|
-
if(window.SteedosUI &&
|
|
333
|
-
SteedosUI.refs[
|
|
333
|
+
if(window.SteedosUI && refName){
|
|
334
|
+
SteedosUI.refs[refName] = amisScope;
|
|
334
335
|
}
|
|
335
336
|
};
|
|
336
337
|
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"cache": 100,
|
|
34
34
|
"adaptor": "var data = payload.data.data[0] || { _filters_type_controller: 'conditions' };\n//数据格式转换\nif (data) {\n data.columns = lodash.map(data.columns, 'field');\n data.sort = lodash.map(data.sort, (item) => {\n return `${item.field_name}:${item.order || '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}\npayload.data = data;\ndelete payload.extensions;\nreturn payload;",
|
|
35
35
|
"data": {
|
|
36
|
-
"query": "{data:object_listviews(filters:[\"_id\", \"=\", \"${recordId}\"]){_id,label,name,object_name,filter_scope,shared,show_count,columns,filter_fields,sort,filters,filter_logic,mobile_columns,searchable_fields,sort_no,created,created_by:created_by__expand{_id,name},modified,modified_by:modified_by__expand{_id,name},enable_amis_schema,amis_schema,_display{shared,show_count,created,modified}}}"
|
|
36
|
+
"query": "{data:object_listviews(filters:[\"_id\", \"=\", \"${recordId}\"]){_id,label,name,object_name,requestAdaptor,adaptor,filter_scope,shared,show_count,columns,filter_fields,sort,filters,filter_logic,mobile_columns,searchable_fields,sort_no,created,created_by:created_by__expand{_id,name},modified,modified_by:modified_by__expand{_id,name},enable_amis_schema,amis_schema,_display{shared,show_count,created,modified}}}"
|
|
37
37
|
},
|
|
38
38
|
"sendOn": "!!this.recordId",
|
|
39
39
|
"replaceData": false,
|
|
@@ -442,6 +442,39 @@
|
|
|
442
442
|
"title": "searchable"
|
|
443
443
|
}
|
|
444
444
|
},
|
|
445
|
+
{
|
|
446
|
+
"type": "fieldSet",
|
|
447
|
+
"title": "数据接口",
|
|
448
|
+
"description": "获取列表数据的 api",
|
|
449
|
+
"collapsable": true,
|
|
450
|
+
"body": [
|
|
451
|
+
{
|
|
452
|
+
"type": "editor",
|
|
453
|
+
"name": "requestAdaptor",
|
|
454
|
+
"label": "发送适配器",
|
|
455
|
+
"required": false,
|
|
456
|
+
"language": "javascript",
|
|
457
|
+
"description": "函数签名:(api) => api, 数据在 api.data 中,修改后返回 api 对象。",
|
|
458
|
+
"className": "col-span-2 m-1",
|
|
459
|
+
"labelClassName": "text-left"
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
"type": "editor",
|
|
463
|
+
"name": "adaptor",
|
|
464
|
+
"label": "接收适配器",
|
|
465
|
+
"required": false,
|
|
466
|
+
"language": "javascript",
|
|
467
|
+
"description": "函数签名: (payload, response, api) => payload",
|
|
468
|
+
"className": "col-span-2 m-1",
|
|
469
|
+
"labelClassName": "text-left"
|
|
470
|
+
}
|
|
471
|
+
],
|
|
472
|
+
"collapsed": true,
|
|
473
|
+
"visibleOn": "!!this.object_name",
|
|
474
|
+
"en-US": {
|
|
475
|
+
"title": "API"
|
|
476
|
+
}
|
|
477
|
+
},
|
|
445
478
|
{
|
|
446
479
|
"type": "fieldSet",
|
|
447
480
|
"title": "高级",
|
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.23",
|
|
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.20"
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "02fd9ceab1405e0eddbb1752882168f0f4d660f0",
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"tailwindcss": "3.2.4"
|
|
22
22
|
}
|