@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.cjs.js
CHANGED
|
@@ -2374,7 +2374,7 @@ async function getColumnItemOnClick(field, options){
|
|
|
2374
2374
|
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
2375
2375
|
"recordLoaded": false, // 重置数据加载状态
|
|
2376
2376
|
"recordId": `\${${options.idFieldName}}`,//审批微页面依赖了作用域中的recordId
|
|
2377
|
-
"
|
|
2377
|
+
"_lookupObjectName": options.objectName
|
|
2378
2378
|
}
|
|
2379
2379
|
}) : {
|
|
2380
2380
|
"type": "steedos-record-detail",
|
|
@@ -2385,7 +2385,7 @@ async function getColumnItemOnClick(field, options){
|
|
|
2385
2385
|
"data": {
|
|
2386
2386
|
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
2387
2387
|
"recordLoaded": false, // 重置数据加载状态
|
|
2388
|
-
"
|
|
2388
|
+
"_lookupObjectName": options.objectName
|
|
2389
2389
|
}
|
|
2390
2390
|
};
|
|
2391
2391
|
|
|
@@ -2558,11 +2558,12 @@ async function getTableColumns(object, fields, options){
|
|
|
2558
2558
|
body: {
|
|
2559
2559
|
type: "steedos-field",
|
|
2560
2560
|
static: true,
|
|
2561
|
-
|
|
2561
|
+
isLookupInTable: true,
|
|
2562
2562
|
config: {
|
|
2563
2563
|
type: "lookup",
|
|
2564
2564
|
reference_to: field.reference_to,
|
|
2565
2565
|
name: field.name,
|
|
2566
|
+
is_name: field.is_name,
|
|
2566
2567
|
label: null,
|
|
2567
2568
|
multiple: field.multiple,
|
|
2568
2569
|
amis: Object.assign({}, fieldAmis, { label: null })
|
|
@@ -3331,6 +3332,16 @@ async function getTableApi(mainObject, fields, options){
|
|
|
3331
3332
|
return api;
|
|
3332
3333
|
`;
|
|
3333
3334
|
api.adaptor = `
|
|
3335
|
+
|
|
3336
|
+
if(payload.errors && payload.errors.length > 0){
|
|
3337
|
+
return {
|
|
3338
|
+
status: 500,
|
|
3339
|
+
msg: payload.errors[0].message,
|
|
3340
|
+
data: {}
|
|
3341
|
+
}
|
|
3342
|
+
}
|
|
3343
|
+
|
|
3344
|
+
|
|
3334
3345
|
let fields = ${JSON.stringify(___namespace.map(fields, 'name'))};
|
|
3335
3346
|
// 这里把行数据中所有为空的字段值配置为空字符串,是因为amis有bug:crud的columns中的列如果type为static-前缀的话,行数据中该字段为空的话会显示为父作用域中同名变量值,见:https://github.com/baidu/amis/issues/9556
|
|
3336
3347
|
(payload.data.rows || []).forEach((itemRow) => {
|
|
@@ -3373,10 +3384,13 @@ async function getTableApi(mainObject, fields, options){
|
|
|
3373
3384
|
// item[key] = value
|
|
3374
3385
|
// PC客户端附件子表列表点击标题预览附件功能依赖了_id,所以这里拼出来
|
|
3375
3386
|
let itemKeyValue = item[key];
|
|
3376
|
-
item[key] = value.map(function(
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3387
|
+
item[key] = value.map(function(curValue, index){
|
|
3388
|
+
let fileId = typeof itemKeyValue == 'string' ? itemKeyValue : itemKeyValue[index];
|
|
3389
|
+
// 克隆一份对象,避免下方value递归污染curValue
|
|
3390
|
+
let result = _.clone(curValue);
|
|
3391
|
+
result._id = fileId;
|
|
3392
|
+
result.value = fileId;
|
|
3393
|
+
return result;
|
|
3380
3394
|
});
|
|
3381
3395
|
}else{
|
|
3382
3396
|
item[key] = _.map(value, (item)=>{
|
|
@@ -3576,7 +3590,7 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3576
3590
|
nameLabel = `(record._display && record._display.${nameField.name}) || record.${nameField.name}`;
|
|
3577
3591
|
}
|
|
3578
3592
|
return `
|
|
3579
|
-
if(payload.data.data.length === 0){
|
|
3593
|
+
if(!payload.data.data || payload.data.data.length === 0){
|
|
3580
3594
|
var isEditor = !!${options && options.isEditor};
|
|
3581
3595
|
if(isEditor){
|
|
3582
3596
|
var fieldNames = ${JSON.stringify(fieldNames)};
|
|
@@ -3622,6 +3636,11 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3622
3636
|
objectName: "${object.name}",
|
|
3623
3637
|
recordId: record._id
|
|
3624
3638
|
}
|
|
3639
|
+
if(window.location.pathname.endsWith("/"+record._id)){
|
|
3640
|
+
payload.data.mainRecord= {
|
|
3641
|
+
record
|
|
3642
|
+
};
|
|
3643
|
+
}
|
|
3625
3644
|
window.postMessage(Object.assign({type: "record.loaded"}, {record: record}), "*")
|
|
3626
3645
|
}
|
|
3627
3646
|
if(payload.errors){
|
|
@@ -4890,8 +4909,8 @@ const parseSingleExpression = function (func, formData, dataPath, global, userSe
|
|
|
4890
4909
|
/*
|
|
4891
4910
|
* @Author: baozhoutao@steedos.com
|
|
4892
4911
|
* @Date: 2022-11-01 15:51:00
|
|
4893
|
-
* @LastEditors:
|
|
4894
|
-
* @LastEditTime:
|
|
4912
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
4913
|
+
* @LastEditTime: 2025-07-14 15:52:36
|
|
4895
4914
|
* @Description:
|
|
4896
4915
|
*/
|
|
4897
4916
|
|
|
@@ -5088,8 +5107,8 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
5088
5107
|
/*
|
|
5089
5108
|
* @Author: baozhoutao@steedos.com
|
|
5090
5109
|
* @Date: 2022-11-01 15:49:58
|
|
5091
|
-
* @LastEditors:
|
|
5092
|
-
* @LastEditTime:
|
|
5110
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
5111
|
+
* @LastEditTime: 2025-07-14 15:52:24
|
|
5093
5112
|
* @Description:
|
|
5094
5113
|
*/
|
|
5095
5114
|
|
|
@@ -5119,6 +5138,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
5119
5138
|
: page.schema;
|
|
5120
5139
|
}
|
|
5121
5140
|
|
|
5141
|
+
// console.log('formSchema====>', formSchema);
|
|
5122
5142
|
|
|
5123
5143
|
return {
|
|
5124
5144
|
type: "service",
|
|
@@ -5143,7 +5163,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
5143
5163
|
showCloseButton: true,
|
|
5144
5164
|
"data": {
|
|
5145
5165
|
"&": "$$",
|
|
5146
|
-
"_master": "${
|
|
5166
|
+
"_master": "${mainRecord}",
|
|
5147
5167
|
"_master._isRelated": "${_isRelated}",
|
|
5148
5168
|
"_master.relatedKey": "${relatedKey}"
|
|
5149
5169
|
},
|
|
@@ -5244,12 +5264,12 @@ const getSchema$3 = (uiSchema)=>{
|
|
|
5244
5264
|
{
|
|
5245
5265
|
"actionType": "broadcast",
|
|
5246
5266
|
"args": {
|
|
5247
|
-
"eventName": "@data.changed.${
|
|
5267
|
+
"eventName": "@data.changed.${_lookupObjectName}"
|
|
5248
5268
|
},
|
|
5249
5269
|
"data": {
|
|
5250
|
-
"objectName": "${
|
|
5270
|
+
"objectName": "${_lookupObjectName}"
|
|
5251
5271
|
},
|
|
5252
|
-
"expression": `\${
|
|
5272
|
+
"expression": `\${_lookupObjectName != '${uiSchema.name}' && _lookupObjectName}`
|
|
5253
5273
|
}
|
|
5254
5274
|
]
|
|
5255
5275
|
}
|
|
@@ -9984,16 +10004,16 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
9984
10004
|
},
|
|
9985
10005
|
"expression": `\${_master.objectName != '${objectSchema.name}' && _master.objectName}`
|
|
9986
10006
|
},
|
|
9987
|
-
//
|
|
10007
|
+
// 列表视图、对象表格、对象表单组件上的lookup字段,点开右侧弹出drawer窗口,修改记录后刷新列表
|
|
9988
10008
|
{
|
|
9989
10009
|
"actionType": "broadcast",
|
|
9990
10010
|
"args": {
|
|
9991
|
-
"eventName": "@data.changed.${
|
|
10011
|
+
"eventName": "@data.changed.${_lookupObjectName}"
|
|
9992
10012
|
},
|
|
9993
10013
|
"data": {
|
|
9994
|
-
"objectName": "${
|
|
10014
|
+
"objectName": "${_lookupObjectName}"
|
|
9995
10015
|
},
|
|
9996
|
-
"expression": `\${
|
|
10016
|
+
"expression": `\${_lookupObjectName != '${objectSchema.name}' && _lookupObjectName}`
|
|
9997
10017
|
},
|
|
9998
10018
|
...submitSuccActions,
|
|
9999
10019
|
// {
|
|
@@ -10597,7 +10617,7 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
|
|
|
10597
10617
|
* @Author: baozhoutao@steedos.com
|
|
10598
10618
|
* @Date: 2022-07-05 15:55:39
|
|
10599
10619
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
10600
|
-
* @LastEditTime:
|
|
10620
|
+
* @LastEditTime: 2025-05-20 16:56:55
|
|
10601
10621
|
* @Description:
|
|
10602
10622
|
*/
|
|
10603
10623
|
|
|
@@ -10896,7 +10916,7 @@ async function getListSchema(
|
|
|
10896
10916
|
}
|
|
10897
10917
|
|
|
10898
10918
|
if (window.innerWidth > 768) {
|
|
10899
|
-
// 列表视图组件PC端高度自动计算实现满屏效果,手机端不需要满屏效果,所以不用autofillheight
|
|
10919
|
+
// 列表视图组件PC端高度自动计算实现满屏效果,手机端不需要满屏效果,所以不用autofillheight,且允许微页面中重写组件autoFillHeight属性
|
|
10900
10920
|
defaults.listSchema = _$1.defaultsDeep({}, defaults.listSchema || {}, {
|
|
10901
10921
|
autoFillHeight: true
|
|
10902
10922
|
});
|
|
@@ -12533,7 +12553,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12533
12553
|
{
|
|
12534
12554
|
"actionType": "custom",
|
|
12535
12555
|
"script": `
|
|
12536
|
-
|
|
12556
|
+
// lookup字段弹出列表,点击新建按钮,新建记录成功后,触发@data.changed.xxx,
|
|
12557
|
+
// 此时context.props.data值是lookup字段所在表单数据,经测试多层lookup弹出列表新建记录成功后context.props.data始终取的是最近一层的lookup字段所在表单数据,符合预期
|
|
12558
|
+
const masterRecord = context.props.data;//event.data._master && event.data._master.record;
|
|
12537
12559
|
const fieldConfig = ${JSON.stringify(field)};
|
|
12538
12560
|
let reference_to = fieldConfig.reference_to;
|
|
12539
12561
|
let saveValue;
|
|
@@ -12543,7 +12565,6 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12543
12565
|
}
|
|
12544
12566
|
const saveField = fieldConfig.reference_to_field || '_id';
|
|
12545
12567
|
const saveFieldValue = newRecord[saveField];
|
|
12546
|
-
|
|
12547
12568
|
if( fieldConfig._reference_to && (_.isArray(fieldConfig._reference_to) || _.isFunction(fieldConfig._reference_to) || fieldConfig._reference_to.startsWith('function') ) ){
|
|
12548
12569
|
|
|
12549
12570
|
const fieldValue = masterRecord ? masterRecord[fieldConfig.name] : {o: reference_to, ids: []};
|
|
@@ -12563,8 +12584,10 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12563
12584
|
|
|
12564
12585
|
}else{
|
|
12565
12586
|
if(fieldConfig.multiple){
|
|
12566
|
-
//
|
|
12567
|
-
|
|
12587
|
+
// const fieldValue = (masterRecord && masterRecord[fieldConfig.name]) || [];
|
|
12588
|
+
// 连续新建多个记录时,因为masterRecord获取的主记录不是实时的,所以只会勾选最后一个新建的记录
|
|
12589
|
+
// 而下面context.context.component指向的是lookup picker组件,可以直接取到用户实时勾选的记录。
|
|
12590
|
+
const fieldValue = context.context.component.props.store.toJSON().selectedItems
|
|
12568
12591
|
saveValue = fieldValue.concat(saveFieldValue);
|
|
12569
12592
|
}else{
|
|
12570
12593
|
saveValue = saveFieldValue;
|
|
@@ -14191,7 +14214,8 @@ async function getFieldSearchable(perField, permissionFields, ctx){
|
|
|
14191
14214
|
_field.removable = false;
|
|
14192
14215
|
_field.value = [null,null];
|
|
14193
14216
|
_field.items = {
|
|
14194
|
-
type: "input-number"
|
|
14217
|
+
type: "input-number",
|
|
14218
|
+
clearValueOnEmpty: true
|
|
14195
14219
|
};
|
|
14196
14220
|
_field.is_wide = true;
|
|
14197
14221
|
fieldNamePrefix = `${fieldNamePrefix}between__`;
|
|
@@ -14239,6 +14263,10 @@ async function getFieldSearchable(perField, permissionFields, ctx){
|
|
|
14239
14263
|
delete _field.amis.hidden;
|
|
14240
14264
|
delete _field.amis.hiddenOn;
|
|
14241
14265
|
delete _field.amis.autoFill;
|
|
14266
|
+
if(_field.type.indexOf("-range") > -1 || _field.type === 'input-array'){
|
|
14267
|
+
// 范围类型不允许变更type,否则会因为某些属性兼容性问题报错页面奔溃,比如input-date-range类型有shortcuts属性,改为input-date后其shortcuts属性有兼容性问题
|
|
14268
|
+
delete _field.amis.type;
|
|
14269
|
+
}
|
|
14242
14270
|
}
|
|
14243
14271
|
|
|
14244
14272
|
const amisField = await convertSFieldToAmisField(_field, false, Object.assign({}, ctx, {fieldNamePrefix: fieldNamePrefix, required: false, showSystemFields: true, inFilterForm: true}));
|