@steedos-widgets/amis-lib 6.3.13-beta.1 → 6.3.13-beta.11
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 +55 -27
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +55 -27
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +20 -18
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -2347,7 +2347,7 @@ async function getColumnItemOnClick(field, options){
|
|
|
2347
2347
|
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
2348
2348
|
"recordLoaded": false, // 重置数据加载状态
|
|
2349
2349
|
"recordId": `\${${options.idFieldName}}`,//审批微页面依赖了作用域中的recordId
|
|
2350
|
-
"
|
|
2350
|
+
"_lookupObjectName": options.objectName
|
|
2351
2351
|
}
|
|
2352
2352
|
}) : {
|
|
2353
2353
|
"type": "steedos-record-detail",
|
|
@@ -2358,7 +2358,7 @@ async function getColumnItemOnClick(field, options){
|
|
|
2358
2358
|
"data": {
|
|
2359
2359
|
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
2360
2360
|
"recordLoaded": false, // 重置数据加载状态
|
|
2361
|
-
"
|
|
2361
|
+
"_lookupObjectName": options.objectName
|
|
2362
2362
|
}
|
|
2363
2363
|
};
|
|
2364
2364
|
|
|
@@ -2531,11 +2531,12 @@ async function getTableColumns(object, fields, options){
|
|
|
2531
2531
|
body: {
|
|
2532
2532
|
type: "steedos-field",
|
|
2533
2533
|
static: true,
|
|
2534
|
-
|
|
2534
|
+
isLookupInTable: true,
|
|
2535
2535
|
config: {
|
|
2536
2536
|
type: "lookup",
|
|
2537
2537
|
reference_to: field.reference_to,
|
|
2538
2538
|
name: field.name,
|
|
2539
|
+
is_name: field.is_name,
|
|
2539
2540
|
label: null,
|
|
2540
2541
|
multiple: field.multiple,
|
|
2541
2542
|
amis: Object.assign({}, fieldAmis, { label: null })
|
|
@@ -3304,6 +3305,16 @@ async function getTableApi(mainObject, fields, options){
|
|
|
3304
3305
|
return api;
|
|
3305
3306
|
`;
|
|
3306
3307
|
api.adaptor = `
|
|
3308
|
+
|
|
3309
|
+
if(payload.errors && payload.errors.length > 0){
|
|
3310
|
+
return {
|
|
3311
|
+
status: 500,
|
|
3312
|
+
msg: payload.errors[0].message,
|
|
3313
|
+
data: {}
|
|
3314
|
+
}
|
|
3315
|
+
}
|
|
3316
|
+
|
|
3317
|
+
|
|
3307
3318
|
let fields = ${JSON.stringify(_$1.map(fields, 'name'))};
|
|
3308
3319
|
// 这里把行数据中所有为空的字段值配置为空字符串,是因为amis有bug:crud的columns中的列如果type为static-前缀的话,行数据中该字段为空的话会显示为父作用域中同名变量值,见:https://github.com/baidu/amis/issues/9556
|
|
3309
3320
|
(payload.data.rows || []).forEach((itemRow) => {
|
|
@@ -3346,10 +3357,13 @@ async function getTableApi(mainObject, fields, options){
|
|
|
3346
3357
|
// item[key] = value
|
|
3347
3358
|
// PC客户端附件子表列表点击标题预览附件功能依赖了_id,所以这里拼出来
|
|
3348
3359
|
let itemKeyValue = item[key];
|
|
3349
|
-
item[key] = value.map(function(
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3360
|
+
item[key] = value.map(function(curValue, index){
|
|
3361
|
+
let fileId = typeof itemKeyValue == 'string' ? itemKeyValue : itemKeyValue[index];
|
|
3362
|
+
// 克隆一份对象,避免下方value递归污染curValue
|
|
3363
|
+
let result = _.clone(curValue);
|
|
3364
|
+
result._id = fileId;
|
|
3365
|
+
result.value = fileId;
|
|
3366
|
+
return result;
|
|
3353
3367
|
});
|
|
3354
3368
|
}else{
|
|
3355
3369
|
item[key] = _.map(value, (item)=>{
|
|
@@ -3549,7 +3563,7 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3549
3563
|
nameLabel = `(record._display && record._display.${nameField.name}) || record.${nameField.name}`;
|
|
3550
3564
|
}
|
|
3551
3565
|
return `
|
|
3552
|
-
if(payload.data.data.length === 0){
|
|
3566
|
+
if(!payload.data.data || payload.data.data.length === 0){
|
|
3553
3567
|
var isEditor = !!${options && options.isEditor};
|
|
3554
3568
|
if(isEditor){
|
|
3555
3569
|
var fieldNames = ${JSON.stringify(fieldNames)};
|
|
@@ -3595,6 +3609,11 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3595
3609
|
objectName: "${object.name}",
|
|
3596
3610
|
recordId: record._id
|
|
3597
3611
|
}
|
|
3612
|
+
if(window.location.pathname.endsWith("/"+record._id)){
|
|
3613
|
+
payload.data.mainRecord= {
|
|
3614
|
+
record
|
|
3615
|
+
};
|
|
3616
|
+
}
|
|
3598
3617
|
window.postMessage(Object.assign({type: "record.loaded"}, {record: record}), "*")
|
|
3599
3618
|
}
|
|
3600
3619
|
if(payload.errors){
|
|
@@ -4863,8 +4882,8 @@ const parseSingleExpression = function (func, formData, dataPath, global, userSe
|
|
|
4863
4882
|
/*
|
|
4864
4883
|
* @Author: baozhoutao@steedos.com
|
|
4865
4884
|
* @Date: 2022-11-01 15:51:00
|
|
4866
|
-
* @LastEditors:
|
|
4867
|
-
* @LastEditTime:
|
|
4885
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
4886
|
+
* @LastEditTime: 2025-07-14 15:52:36
|
|
4868
4887
|
* @Description:
|
|
4869
4888
|
*/
|
|
4870
4889
|
|
|
@@ -5061,8 +5080,8 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
5061
5080
|
/*
|
|
5062
5081
|
* @Author: baozhoutao@steedos.com
|
|
5063
5082
|
* @Date: 2022-11-01 15:49:58
|
|
5064
|
-
* @LastEditors:
|
|
5065
|
-
* @LastEditTime:
|
|
5083
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
5084
|
+
* @LastEditTime: 2025-07-14 15:52:24
|
|
5066
5085
|
* @Description:
|
|
5067
5086
|
*/
|
|
5068
5087
|
|
|
@@ -5092,6 +5111,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
5092
5111
|
: page.schema;
|
|
5093
5112
|
}
|
|
5094
5113
|
|
|
5114
|
+
// console.log('formSchema====>', formSchema);
|
|
5095
5115
|
|
|
5096
5116
|
return {
|
|
5097
5117
|
type: "service",
|
|
@@ -5116,7 +5136,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
5116
5136
|
showCloseButton: true,
|
|
5117
5137
|
"data": {
|
|
5118
5138
|
"&": "$$",
|
|
5119
|
-
"_master": "${
|
|
5139
|
+
"_master": "${mainRecord}",
|
|
5120
5140
|
"_master._isRelated": "${_isRelated}",
|
|
5121
5141
|
"_master.relatedKey": "${relatedKey}"
|
|
5122
5142
|
},
|
|
@@ -5217,12 +5237,12 @@ const getSchema$3 = (uiSchema)=>{
|
|
|
5217
5237
|
{
|
|
5218
5238
|
"actionType": "broadcast",
|
|
5219
5239
|
"args": {
|
|
5220
|
-
"eventName": "@data.changed.${
|
|
5240
|
+
"eventName": "@data.changed.${_lookupObjectName}"
|
|
5221
5241
|
},
|
|
5222
5242
|
"data": {
|
|
5223
|
-
"objectName": "${
|
|
5243
|
+
"objectName": "${_lookupObjectName}"
|
|
5224
5244
|
},
|
|
5225
|
-
"expression": `\${
|
|
5245
|
+
"expression": `\${_lookupObjectName != '${uiSchema.name}' && _lookupObjectName}`
|
|
5226
5246
|
}
|
|
5227
5247
|
]
|
|
5228
5248
|
}
|
|
@@ -9957,16 +9977,16 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
9957
9977
|
},
|
|
9958
9978
|
"expression": `\${_master.objectName != '${objectSchema.name}' && _master.objectName}`
|
|
9959
9979
|
},
|
|
9960
|
-
//
|
|
9980
|
+
// 列表视图、对象表格、对象表单组件上的lookup字段,点开右侧弹出drawer窗口,修改记录后刷新列表
|
|
9961
9981
|
{
|
|
9962
9982
|
"actionType": "broadcast",
|
|
9963
9983
|
"args": {
|
|
9964
|
-
"eventName": "@data.changed.${
|
|
9984
|
+
"eventName": "@data.changed.${_lookupObjectName}"
|
|
9965
9985
|
},
|
|
9966
9986
|
"data": {
|
|
9967
|
-
"objectName": "${
|
|
9987
|
+
"objectName": "${_lookupObjectName}"
|
|
9968
9988
|
},
|
|
9969
|
-
"expression": `\${
|
|
9989
|
+
"expression": `\${_lookupObjectName != '${objectSchema.name}' && _lookupObjectName}`
|
|
9970
9990
|
},
|
|
9971
9991
|
...submitSuccActions,
|
|
9972
9992
|
// {
|
|
@@ -10570,7 +10590,7 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
|
|
|
10570
10590
|
* @Author: baozhoutao@steedos.com
|
|
10571
10591
|
* @Date: 2022-07-05 15:55:39
|
|
10572
10592
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
10573
|
-
* @LastEditTime:
|
|
10593
|
+
* @LastEditTime: 2025-05-20 16:56:55
|
|
10574
10594
|
* @Description:
|
|
10575
10595
|
*/
|
|
10576
10596
|
|
|
@@ -10869,7 +10889,7 @@ async function getListSchema(
|
|
|
10869
10889
|
}
|
|
10870
10890
|
|
|
10871
10891
|
if (window.innerWidth > 768) {
|
|
10872
|
-
// 列表视图组件PC端高度自动计算实现满屏效果,手机端不需要满屏效果,所以不用autofillheight
|
|
10892
|
+
// 列表视图组件PC端高度自动计算实现满屏效果,手机端不需要满屏效果,所以不用autofillheight,且允许微页面中重写组件autoFillHeight属性
|
|
10873
10893
|
defaults.listSchema = defaultsDeep$1({}, defaults.listSchema || {}, {
|
|
10874
10894
|
autoFillHeight: true
|
|
10875
10895
|
});
|
|
@@ -12506,7 +12526,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12506
12526
|
{
|
|
12507
12527
|
"actionType": "custom",
|
|
12508
12528
|
"script": `
|
|
12509
|
-
|
|
12529
|
+
// lookup字段弹出列表,点击新建按钮,新建记录成功后,触发@data.changed.xxx,
|
|
12530
|
+
// 此时context.props.data值是lookup字段所在表单数据,经测试多层lookup弹出列表新建记录成功后context.props.data始终取的是最近一层的lookup字段所在表单数据,符合预期
|
|
12531
|
+
const masterRecord = context.props.data;//event.data._master && event.data._master.record;
|
|
12510
12532
|
const fieldConfig = ${JSON.stringify(field)};
|
|
12511
12533
|
let reference_to = fieldConfig.reference_to;
|
|
12512
12534
|
let saveValue;
|
|
@@ -12516,7 +12538,6 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12516
12538
|
}
|
|
12517
12539
|
const saveField = fieldConfig.reference_to_field || '_id';
|
|
12518
12540
|
const saveFieldValue = newRecord[saveField];
|
|
12519
|
-
|
|
12520
12541
|
if( fieldConfig._reference_to && (_.isArray(fieldConfig._reference_to) || _.isFunction(fieldConfig._reference_to) || fieldConfig._reference_to.startsWith('function') ) ){
|
|
12521
12542
|
|
|
12522
12543
|
const fieldValue = masterRecord ? masterRecord[fieldConfig.name] : {o: reference_to, ids: []};
|
|
@@ -12536,8 +12557,10 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12536
12557
|
|
|
12537
12558
|
}else{
|
|
12538
12559
|
if(fieldConfig.multiple){
|
|
12539
|
-
//
|
|
12540
|
-
|
|
12560
|
+
// const fieldValue = (masterRecord && masterRecord[fieldConfig.name]) || [];
|
|
12561
|
+
// 连续新建多个记录时,因为masterRecord获取的主记录不是实时的,所以只会勾选最后一个新建的记录
|
|
12562
|
+
// 而下面context.context.component指向的是lookup picker组件,可以直接取到用户实时勾选的记录。
|
|
12563
|
+
const fieldValue = context.context.component.props.store.toJSON().selectedItems
|
|
12541
12564
|
saveValue = fieldValue.concat(saveFieldValue);
|
|
12542
12565
|
}else{
|
|
12543
12566
|
saveValue = saveFieldValue;
|
|
@@ -14164,7 +14187,8 @@ async function getFieldSearchable(perField, permissionFields, ctx){
|
|
|
14164
14187
|
_field.removable = false;
|
|
14165
14188
|
_field.value = [null,null];
|
|
14166
14189
|
_field.items = {
|
|
14167
|
-
type: "input-number"
|
|
14190
|
+
type: "input-number",
|
|
14191
|
+
clearValueOnEmpty: true
|
|
14168
14192
|
};
|
|
14169
14193
|
_field.is_wide = true;
|
|
14170
14194
|
fieldNamePrefix = `${fieldNamePrefix}between__`;
|
|
@@ -14212,6 +14236,10 @@ async function getFieldSearchable(perField, permissionFields, ctx){
|
|
|
14212
14236
|
delete _field.amis.hidden;
|
|
14213
14237
|
delete _field.amis.hiddenOn;
|
|
14214
14238
|
delete _field.amis.autoFill;
|
|
14239
|
+
if(_field.type.indexOf("-range") > -1 || _field.type === 'input-array'){
|
|
14240
|
+
// 范围类型不允许变更type,否则会因为某些属性兼容性问题报错页面奔溃,比如input-date-range类型有shortcuts属性,改为input-date后其shortcuts属性有兼容性问题
|
|
14241
|
+
delete _field.amis.type;
|
|
14242
|
+
}
|
|
14215
14243
|
}
|
|
14216
14244
|
|
|
14217
14245
|
const amisField = await convertSFieldToAmisField(_field, false, Object.assign({}, ctx, {fieldNamePrefix: fieldNamePrefix, required: false, showSystemFields: true, inFilterForm: true}));
|