@steedos-widgets/amis-lib 6.3.0-beta.11 → 6.3.0-beta.12
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/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +108 -87
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +108 -87
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +229 -201
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/graphql.d.ts +1 -1
- package/dist/types/lib/converter/amis/header.d.ts +8 -1
- package/dist/types/lib/objects.d.ts +1 -0
- package/dist/types/schema/standard_edit.amis.d.ts +6 -0
- package/dist/types/standard/button.d.ts +6 -0
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -582,9 +582,9 @@ function getSelectMap(selectOptions){
|
|
|
582
582
|
}
|
|
583
583
|
|
|
584
584
|
function getNameTplUrl(field, ctx){
|
|
585
|
-
if(ctx.objectName === 'cms_files'){
|
|
586
|
-
|
|
587
|
-
}
|
|
585
|
+
// if(ctx.objectName === 'cms_files'){
|
|
586
|
+
// return "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}"
|
|
587
|
+
// }
|
|
588
588
|
const href = Router.getObjectDetailPath({
|
|
589
589
|
...ctx, formFactor: ctx.formFactor, appId: "${appId}", objectName: ctx.objectName || "${objectName}", recordId: `\${${ctx.idFieldName}}`
|
|
590
590
|
});
|
|
@@ -774,12 +774,15 @@ async function getFieldTpl (field, options){
|
|
|
774
774
|
}
|
|
775
775
|
}
|
|
776
776
|
|
|
777
|
-
async function getFieldsTemplate(fields, display){
|
|
777
|
+
async function getFieldsTemplate(object, fields, display){
|
|
778
778
|
let expandFields = [];
|
|
779
779
|
if(display != false){
|
|
780
780
|
display = true;
|
|
781
781
|
}
|
|
782
|
-
let fieldsName = ['_id'
|
|
782
|
+
let fieldsName = ['_id'];
|
|
783
|
+
if(!object.datasource || object.datasource === 'default' || object.datasource === 'meteor'){
|
|
784
|
+
fieldsName.push('space');
|
|
785
|
+
}
|
|
783
786
|
let displayFields = [];
|
|
784
787
|
let fieldsArr = [];
|
|
785
788
|
if(___namespace.isArray(fields)){
|
|
@@ -875,7 +878,7 @@ async function getFindOneQuery$1(object, recordId, fields, options){
|
|
|
875
878
|
}
|
|
876
879
|
}
|
|
877
880
|
return {
|
|
878
|
-
query: `{${alias}:${object.name}${queryOptions}{${await getFieldsTemplate(fields)}, ${getRecordPermissionsTemplate()}}}`
|
|
881
|
+
query: `{${alias}:${object.name}${queryOptions}{${await getFieldsTemplate(object, fields)}, ${getRecordPermissionsTemplate()}}}`
|
|
879
882
|
}
|
|
880
883
|
}
|
|
881
884
|
|
|
@@ -1064,7 +1067,7 @@ async function getFindQuery(object, recordId, fields, options){
|
|
|
1064
1067
|
// return item.replace(/^{/,"").replace(/}$/,"");
|
|
1065
1068
|
// }).join(",")) : "";
|
|
1066
1069
|
|
|
1067
|
-
const fieldsTemplate = `${await getFieldsTemplate(fields, options.expand)}${treeFields}${cfsFields}`;
|
|
1070
|
+
const fieldsTemplate = `${await getFieldsTemplate(object, fields, options.expand)}${treeFields}${cfsFields}`;
|
|
1068
1071
|
|
|
1069
1072
|
return {
|
|
1070
1073
|
orderBy: "${orderBy}",
|
|
@@ -2192,6 +2195,59 @@ function getFieldWidth(width){
|
|
|
2192
2195
|
}
|
|
2193
2196
|
}
|
|
2194
2197
|
|
|
2198
|
+
async function getColumnItemOnClick(field, options){
|
|
2199
|
+
const recordPage = await getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor });
|
|
2200
|
+
const drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
|
|
2201
|
+
"recordId": `\${${options.idFieldName}}`,
|
|
2202
|
+
"data": {
|
|
2203
|
+
...recordPage.schema.data,
|
|
2204
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
2205
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
2206
|
+
}
|
|
2207
|
+
}) : {
|
|
2208
|
+
"type": "steedos-record-detail",
|
|
2209
|
+
"objectApiName": "${objectName}",
|
|
2210
|
+
"recordId": `\${${options.idFieldName}}`,
|
|
2211
|
+
"showBackButton": false,
|
|
2212
|
+
"showButtons": true,
|
|
2213
|
+
"data": {
|
|
2214
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
2215
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
2216
|
+
}
|
|
2217
|
+
};
|
|
2218
|
+
|
|
2219
|
+
if(!(field.is_name || field.name === options.labelFieldName)){
|
|
2220
|
+
drawerRecordDetailSchema.objectApiName = field.reference_to;
|
|
2221
|
+
drawerRecordDetailSchema.recordId = `\${_display.${field.name}.value}`;
|
|
2222
|
+
}
|
|
2223
|
+
return {
|
|
2224
|
+
"click": {
|
|
2225
|
+
"actions": [
|
|
2226
|
+
{
|
|
2227
|
+
"actionType": "drawer",
|
|
2228
|
+
"drawer": {
|
|
2229
|
+
"type": "drawer",
|
|
2230
|
+
"title": " ",
|
|
2231
|
+
"headerClassName": "hidden",
|
|
2232
|
+
"size": "lg",
|
|
2233
|
+
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
2234
|
+
"closeOnEsc": true,
|
|
2235
|
+
"closeOnOutside": true,
|
|
2236
|
+
"resizable": true,
|
|
2237
|
+
"actions": [],
|
|
2238
|
+
"body": [
|
|
2239
|
+
drawerRecordDetailSchema
|
|
2240
|
+
],
|
|
2241
|
+
"className": "steedos-record-detail-drawer app-popover",
|
|
2242
|
+
"id": "u:fc5f055afa8c"
|
|
2243
|
+
},
|
|
2244
|
+
"preventDefault": true
|
|
2245
|
+
}
|
|
2246
|
+
]
|
|
2247
|
+
}
|
|
2248
|
+
};
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2195
2251
|
async function getTableColumns(object, fields, options){
|
|
2196
2252
|
const columns = [];
|
|
2197
2253
|
if(!options.isLookup && !options.isInputTable){
|
|
@@ -2231,7 +2287,10 @@ async function getTableColumns(object, fields, options){
|
|
|
2231
2287
|
delete fieldAmis?.className;
|
|
2232
2288
|
|
|
2233
2289
|
let columnItem;
|
|
2234
|
-
|
|
2290
|
+
|
|
2291
|
+
// PC客户端点击名称字段直接预览
|
|
2292
|
+
let isNode = !!(window && window.nw && window.nw.require);
|
|
2293
|
+
if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files' && isNode){
|
|
2235
2294
|
const previewFileScript = `
|
|
2236
2295
|
var data = event.data;
|
|
2237
2296
|
var file_name = data.versions ? data.name : "${field.label}";
|
|
@@ -2246,20 +2305,20 @@ async function getTableColumns(object, fields, options){
|
|
|
2246
2305
|
"onEvent": {
|
|
2247
2306
|
"click": {
|
|
2248
2307
|
"actions": [
|
|
2249
|
-
{
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
},
|
|
2308
|
+
// {
|
|
2309
|
+
// "args": {
|
|
2310
|
+
// "api": {
|
|
2311
|
+
// "url": "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}",
|
|
2312
|
+
// "method": "get",
|
|
2313
|
+
// "headers": {
|
|
2314
|
+
// "Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
2315
|
+
// }
|
|
2316
|
+
// }
|
|
2317
|
+
// },
|
|
2318
|
+
// "actionType": "download",
|
|
2319
|
+
// // "expression": "!!!window?.nw?.require"//浏览器上直接下载
|
|
2320
|
+
// "expression": "!!!(window && window.nw && window.nw.require)"//浏览器上直接下载
|
|
2321
|
+
// },
|
|
2263
2322
|
{
|
|
2264
2323
|
"args": {},
|
|
2265
2324
|
"actionType": "custom",
|
|
@@ -2357,57 +2416,7 @@ async function getTableColumns(object, fields, options){
|
|
|
2357
2416
|
}
|
|
2358
2417
|
|
|
2359
2418
|
if(window.innerWidth >= 768 && ((field.is_name || field.name === options.labelFieldName) || ((field.type == 'lookup' || field.type == 'master_detail') && ___namespace.isString(field.reference_to) && field.multiple != true)) && options.isRelated){
|
|
2360
|
-
|
|
2361
|
-
const drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
|
|
2362
|
-
"recordId": `\${${options.idFieldName}}`,
|
|
2363
|
-
"data": {
|
|
2364
|
-
...recordPage.schema.data,
|
|
2365
|
-
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
2366
|
-
"recordLoaded": false, // 重置数据加载状态
|
|
2367
|
-
}
|
|
2368
|
-
}) : {
|
|
2369
|
-
"type": "steedos-record-detail",
|
|
2370
|
-
"objectApiName": "${objectName}",
|
|
2371
|
-
"recordId": `\${${options.idFieldName}}`,
|
|
2372
|
-
"showBackButton": false,
|
|
2373
|
-
"showButtons": true,
|
|
2374
|
-
"data": {
|
|
2375
|
-
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
2376
|
-
"recordLoaded": false, // 重置数据加载状态
|
|
2377
|
-
}
|
|
2378
|
-
};
|
|
2379
|
-
|
|
2380
|
-
if(!(field.is_name || field.name === options.labelFieldName)){
|
|
2381
|
-
drawerRecordDetailSchema.objectApiName = field.reference_to;
|
|
2382
|
-
drawerRecordDetailSchema.recordId = `\${_display.${field.name}.value}`;
|
|
2383
|
-
}
|
|
2384
|
-
|
|
2385
|
-
columnItem.onEvent = {
|
|
2386
|
-
"click": {
|
|
2387
|
-
"actions": [
|
|
2388
|
-
{
|
|
2389
|
-
"actionType": "drawer",
|
|
2390
|
-
"drawer": {
|
|
2391
|
-
"type": "drawer",
|
|
2392
|
-
"title": " ",
|
|
2393
|
-
"headerClassName": "hidden",
|
|
2394
|
-
"size": "lg",
|
|
2395
|
-
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
2396
|
-
"closeOnEsc": true,
|
|
2397
|
-
"closeOnOutside": true,
|
|
2398
|
-
"resizable": true,
|
|
2399
|
-
"actions": [],
|
|
2400
|
-
"body": [
|
|
2401
|
-
drawerRecordDetailSchema
|
|
2402
|
-
],
|
|
2403
|
-
"className": "steedos-record-detail-drawer app-popover",
|
|
2404
|
-
"id": "u:fc5f055afa8c"
|
|
2405
|
-
},
|
|
2406
|
-
"preventDefault": true
|
|
2407
|
-
}
|
|
2408
|
-
]
|
|
2409
|
-
}
|
|
2410
|
-
};
|
|
2419
|
+
columnItem.onEvent = await getColumnItemOnClick(field, options);
|
|
2411
2420
|
}
|
|
2412
2421
|
|
|
2413
2422
|
}
|
|
@@ -2620,17 +2629,23 @@ async function getMobileTableColumns(fields, options){
|
|
|
2620
2629
|
onEvent: {
|
|
2621
2630
|
"click": {
|
|
2622
2631
|
"actions": [
|
|
2632
|
+
// {
|
|
2633
|
+
// "args": {
|
|
2634
|
+
// "api": {
|
|
2635
|
+
// "url": url,
|
|
2636
|
+
// "method": "get",
|
|
2637
|
+
// "headers": {
|
|
2638
|
+
// "Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
2639
|
+
// }
|
|
2640
|
+
// }
|
|
2641
|
+
// },
|
|
2642
|
+
// "actionType": "download"
|
|
2643
|
+
// }
|
|
2623
2644
|
{
|
|
2645
|
+
"actionType": "link",
|
|
2624
2646
|
"args": {
|
|
2625
|
-
"
|
|
2626
|
-
|
|
2627
|
-
"method": "get",
|
|
2628
|
-
"headers": {
|
|
2629
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
2630
|
-
}
|
|
2631
|
-
}
|
|
2632
|
-
},
|
|
2633
|
-
"actionType": "download"
|
|
2647
|
+
"link": url
|
|
2648
|
+
}
|
|
2634
2649
|
}
|
|
2635
2650
|
],
|
|
2636
2651
|
"weight": 0
|
|
@@ -3339,7 +3354,7 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3339
3354
|
nameLabel = `record._display.${nameField.name}.label`;
|
|
3340
3355
|
}
|
|
3341
3356
|
} else if (nameField){
|
|
3342
|
-
nameLabel = `record._display.${nameField.name}
|
|
3357
|
+
nameLabel = `(record._display ? record._display.${nameField.name} : record.${nameField.name})`;
|
|
3343
3358
|
}
|
|
3344
3359
|
return `
|
|
3345
3360
|
if(payload.data.data.length === 0){
|
|
@@ -4871,8 +4886,8 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
4871
4886
|
/*
|
|
4872
4887
|
* @Author: baozhoutao@steedos.com
|
|
4873
4888
|
* @Date: 2022-11-01 15:49:58
|
|
4874
|
-
* @LastEditors:
|
|
4875
|
-
* @LastEditTime:
|
|
4889
|
+
* @LastEditors: yinlianghui@hotoa.com yinlianghui@hotoa.com
|
|
4890
|
+
* @LastEditTime: 2024-05-19 10:01:07
|
|
4876
4891
|
* @Description:
|
|
4877
4892
|
*/
|
|
4878
4893
|
|
|
@@ -4934,6 +4949,12 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
4934
4949
|
closeOnEsc: false,
|
|
4935
4950
|
closeOnOutside: false,
|
|
4936
4951
|
showCloseButton: true,
|
|
4952
|
+
"data": {
|
|
4953
|
+
"&": "$$",
|
|
4954
|
+
"_master": "${_master}",
|
|
4955
|
+
"_master._isRelated": "${_isRelated}",
|
|
4956
|
+
"_master.relatedKey": "${relatedKey}"
|
|
4957
|
+
},
|
|
4937
4958
|
size: "lg",
|
|
4938
4959
|
"onEvent": {
|
|
4939
4960
|
"cancel": {
|
|
@@ -6815,6 +6836,7 @@ function getObjectListHeader$1(objectSchema, listViewName, ctx) {
|
|
|
6815
6836
|
function getBackButtonSchema(){
|
|
6816
6837
|
return {
|
|
6817
6838
|
"type": "service",
|
|
6839
|
+
"className": "steedos-object-record-detail-header-back-button",
|
|
6818
6840
|
"onEvent": {
|
|
6819
6841
|
"@history_paths.changed": {
|
|
6820
6842
|
"actions": [
|
|
@@ -7101,7 +7123,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
7101
7123
|
id: `page_readonly_${name}_header`,
|
|
7102
7124
|
name: `page`,
|
|
7103
7125
|
body: body,
|
|
7104
|
-
className:
|
|
7126
|
+
className: "steedos-object-record-detail-header"
|
|
7105
7127
|
}
|
|
7106
7128
|
|
|
7107
7129
|
}
|
|
@@ -11889,7 +11911,6 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11889
11911
|
var fieldFilters = ${JSON.stringify(field.filters)};
|
|
11890
11912
|
var currentAmis = amisRequire('amis');
|
|
11891
11913
|
//递归fieldFilters数组,检查每一个元素,判断若是公式,就仅把它解析
|
|
11892
|
-
debugger;
|
|
11893
11914
|
function traverseNestedArray(arr) {
|
|
11894
11915
|
for (let i = 0; i < arr.length; i++) {
|
|
11895
11916
|
if (Array.isArray(arr[i])) {
|