@steedos-widgets/amis-object 3.6.0-beta.7 → 3.6.1
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/amis-object.cjs.css +3 -3
- package/dist/amis-object.cjs.js +212 -97
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +3 -3
- package/dist/amis-object.esm.js +212 -97
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +3 -3
- package/dist/amis-object.umd.js +36 -33
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +21 -21
- package/package.json +3 -3
package/dist/amis-object.cjs.css
CHANGED
|
@@ -479,6 +479,9 @@ fieldset.antd-Collapse > legend{
|
|
|
479
479
|
.m-0 {
|
|
480
480
|
margin: 0px
|
|
481
481
|
}
|
|
482
|
+
.m-1 {
|
|
483
|
+
margin: 0.25rem
|
|
484
|
+
}
|
|
482
485
|
.m-2 {
|
|
483
486
|
margin: 0.5rem
|
|
484
487
|
}
|
|
@@ -724,9 +727,6 @@ fieldset.antd-Collapse > legend{
|
|
|
724
727
|
.animate-spin {
|
|
725
728
|
animation: spin 1s linear infinite
|
|
726
729
|
}
|
|
727
|
-
.resize {
|
|
728
|
-
resize: both
|
|
729
|
-
}
|
|
730
730
|
.flex-row {
|
|
731
731
|
flex-direction: row
|
|
732
732
|
}
|
package/dist/amis-object.cjs.js
CHANGED
|
@@ -4790,11 +4790,11 @@ async function getQuickEditSchema(field, options){
|
|
|
4790
4790
|
if(event.data.isBatchEdit){
|
|
4791
4791
|
selectedItems.forEach(function(selectedItem){
|
|
4792
4792
|
selectedItem._display.${field.name} = event.data._display.${field.name};
|
|
4793
|
-
doAction({actionType: 'setValue', "args": {"value": selectedItem._display},componentId: "_display_" + selectedItem._index});
|
|
4793
|
+
doAction({actionType: 'setValue', "args": {"value": selectedItem._display},componentId: ${options.objectName} + "_display_" + selectedItem._index});
|
|
4794
4794
|
doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + selectedItem._index});
|
|
4795
4795
|
})
|
|
4796
4796
|
}else{
|
|
4797
|
-
doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: "_display_" + event.data._index});
|
|
4797
|
+
doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: ${options.objectName} + "_display_" + event.data._index});
|
|
4798
4798
|
doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + event.data._index});
|
|
4799
4799
|
}
|
|
4800
4800
|
`
|
|
@@ -4824,7 +4824,6 @@ async function getQuickEditSchema(field, options){
|
|
|
4824
4824
|
{
|
|
4825
4825
|
"actionType": "custom",
|
|
4826
4826
|
"script": `
|
|
4827
|
-
|
|
4828
4827
|
var _display = _.cloneDeep(event.data._display);
|
|
4829
4828
|
${displayField}
|
|
4830
4829
|
doAction({actionType: 'setValue', "args": {"value": {_display}},componentId: "${quickEditId}"});
|
|
@@ -4995,6 +4994,23 @@ async function getQuickEditSchema(field, options){
|
|
|
4995
4994
|
"onEvent":{
|
|
4996
4995
|
"init":{
|
|
4997
4996
|
"actions":[
|
|
4997
|
+
//amis3.6无法从数据域中直接拿到正确的selectitems,需要通过crud组件的getSelected()函数获取
|
|
4998
|
+
{
|
|
4999
|
+
"actionType": "custom",
|
|
5000
|
+
"script": `
|
|
5001
|
+
crudScoped = event.context.scoped.getComponentById('${options.crudId}');
|
|
5002
|
+
const selectedItems = crudScoped && crudScoped.control.getSelected();
|
|
5003
|
+
doAction({
|
|
5004
|
+
"componentId": "${quickEditId}",
|
|
5005
|
+
"actionType": "setValue",
|
|
5006
|
+
"args": {
|
|
5007
|
+
"value": {
|
|
5008
|
+
selectedItems
|
|
5009
|
+
}
|
|
5010
|
+
}
|
|
5011
|
+
});
|
|
5012
|
+
`
|
|
5013
|
+
},
|
|
4998
5014
|
{
|
|
4999
5015
|
"actionType": "setValue",
|
|
5000
5016
|
"componentId": quickEditId,
|
|
@@ -8925,12 +8941,16 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
8925
8941
|
// }
|
|
8926
8942
|
// listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
|
|
8927
8943
|
// 点击搜索的时候自动收起搜索栏
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8944
|
+
//触发amis crud 高度重算
|
|
8945
|
+
doAction({
|
|
8946
|
+
"actionType": "broadcast",
|
|
8947
|
+
"args": {
|
|
8948
|
+
"eventName": "@height.changed.${objectSchema.name}"
|
|
8949
|
+
},
|
|
8950
|
+
"data": {
|
|
8951
|
+
"timeOut": 500
|
|
8952
|
+
}
|
|
8953
|
+
});
|
|
8934
8954
|
const filterService = filterForm.context.getComponents().find(function(n){
|
|
8935
8955
|
return n.props.type === "service";
|
|
8936
8956
|
});
|
|
@@ -9032,9 +9052,16 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
9032
9052
|
let filterFormService = SteedosUI.getClosestAmisComponentByType(filterForm.context, "service");
|
|
9033
9053
|
filterFormService.setData({showFieldsFilter: !!!filterFormService.props.data.showFieldsFilter});
|
|
9034
9054
|
//触发amis crud 高度重算
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
|
|
9055
|
+
doAction({
|
|
9056
|
+
"actionType": "broadcast",
|
|
9057
|
+
"args": {
|
|
9058
|
+
"eventName": "@height.changed.${objectSchema.name}"
|
|
9059
|
+
},
|
|
9060
|
+
"data": {
|
|
9061
|
+
"timeOut": 100
|
|
9062
|
+
}
|
|
9063
|
+
});
|
|
9064
|
+
|
|
9038
9065
|
// 移除搜索按钮上的红点
|
|
9039
9066
|
// let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
9040
9067
|
let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
@@ -9191,9 +9218,15 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
9191
9218
|
sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify(localListViewProps));
|
|
9192
9219
|
}
|
|
9193
9220
|
//触发amis crud 高度重算
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
|
|
9221
|
+
doAction({
|
|
9222
|
+
"actionType": "broadcast",
|
|
9223
|
+
"args": {
|
|
9224
|
+
"eventName": "@height.changed.${objectSchema.name}"
|
|
9225
|
+
},
|
|
9226
|
+
"data": {
|
|
9227
|
+
"timeOut": 100
|
|
9228
|
+
}
|
|
9229
|
+
});
|
|
9197
9230
|
// ===END===
|
|
9198
9231
|
`;
|
|
9199
9232
|
return {
|
|
@@ -10899,13 +10932,16 @@ const filterService = filterForm.context.getComponents().find(function(n){
|
|
|
10899
10932
|
});
|
|
10900
10933
|
let toShowFieldsFilter = !!!filterService.props.data.showFieldsFilter;
|
|
10901
10934
|
filterService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
10905
|
-
|
|
10906
|
-
|
|
10907
|
-
}
|
|
10908
|
-
|
|
10935
|
+
//触发amis crud 高度重算
|
|
10936
|
+
doAction({
|
|
10937
|
+
"actionType": "broadcast",
|
|
10938
|
+
"args": {
|
|
10939
|
+
"eventName": "@height.changed." + event.data.objectName
|
|
10940
|
+
},
|
|
10941
|
+
"data": {
|
|
10942
|
+
"timeOut": 1000
|
|
10943
|
+
}
|
|
10944
|
+
});
|
|
10909
10945
|
// 手机端在显示搜索栏时隐藏crud上的刷新按钮,因为点击后crud高度显示有问题
|
|
10910
10946
|
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
10911
10947
|
crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
@@ -11269,12 +11305,16 @@ async function getObjectFilter(objectSchema, fields, options) {
|
|
|
11269
11305
|
return;
|
|
11270
11306
|
}
|
|
11271
11307
|
// 列表搜索栏字段值变更后立刻触发提交表单执行crud搜索,所以这里需要额外重算crud高度及筛选按钮红色星号图标显示隐藏
|
|
11272
|
-
|
|
11273
|
-
|
|
11274
|
-
|
|
11275
|
-
|
|
11276
|
-
|
|
11277
|
-
|
|
11308
|
+
//触发amis crud 高度重算
|
|
11309
|
+
doAction({
|
|
11310
|
+
"actionType": "broadcast",
|
|
11311
|
+
"args": {
|
|
11312
|
+
"eventName": "@height.changed.${objectSchema.name}"
|
|
11313
|
+
},
|
|
11314
|
+
"data": {
|
|
11315
|
+
"timeOut": 1000
|
|
11316
|
+
}
|
|
11317
|
+
});
|
|
11278
11318
|
resizeWindow();
|
|
11279
11319
|
const scope = event.context.scoped;
|
|
11280
11320
|
// let filterFormValues = event.data;
|
|
@@ -11586,7 +11626,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11586
11626
|
|
|
11587
11627
|
if(body.columns && options.formFactor != 'SMALL'){
|
|
11588
11628
|
//将_display放入crud的columns的倒数第二列中(最后一列会影响固定列),可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
11589
|
-
body.columns.splice(body.columns.length - 1, 0, {name: '_display',type: 'static', width: 32, placeholder: "",id: "_display_${_index}", className: "hidden"});
|
|
11629
|
+
body.columns.splice(body.columns.length - 1, 0, {name: '_display',type: 'static', width: 32, placeholder: "",id: objectSchema.name + "_display_${_index}", className: "hidden"});
|
|
11590
11630
|
}
|
|
11591
11631
|
|
|
11592
11632
|
if (defaults) {
|
|
@@ -11623,7 +11663,24 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11623
11663
|
id: `service_${id}`,
|
|
11624
11664
|
name: `page`,
|
|
11625
11665
|
data: options.amisData,
|
|
11626
|
-
body: body
|
|
11666
|
+
body: body,
|
|
11667
|
+
//监听广播事件,重算crud高度
|
|
11668
|
+
onEvent: {
|
|
11669
|
+
[`@height.changed.${objectSchema.name}`]: {
|
|
11670
|
+
"actions": [
|
|
11671
|
+
{
|
|
11672
|
+
"actionType": "custom",
|
|
11673
|
+
"script": `
|
|
11674
|
+
var crudScoped = event.context.scoped.getComponentById('${body.id}');
|
|
11675
|
+
var timeOut = event.data.timeOut || 500;
|
|
11676
|
+
setTimeout(()=>{
|
|
11677
|
+
crudScoped && crudScoped.control.updateAutoFillHeight();
|
|
11678
|
+
}, timeOut);
|
|
11679
|
+
`
|
|
11680
|
+
}
|
|
11681
|
+
]
|
|
11682
|
+
}
|
|
11683
|
+
}
|
|
11627
11684
|
}
|
|
11628
11685
|
}
|
|
11629
11686
|
|
|
@@ -13522,6 +13579,8 @@ function getLookupSapceUserTreeSchema(isMobile){
|
|
|
13522
13579
|
_.each(children, (item) => {
|
|
13523
13580
|
if (item.children) {
|
|
13524
13581
|
item.children = getChildren(records, item.children)
|
|
13582
|
+
}else{
|
|
13583
|
+
item.children = [];
|
|
13525
13584
|
}
|
|
13526
13585
|
})
|
|
13527
13586
|
return children;
|
|
@@ -13876,6 +13935,14 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
13876
13935
|
})
|
|
13877
13936
|
payload.data.rows = rows;
|
|
13878
13937
|
*/
|
|
13938
|
+
if(enable_tree){
|
|
13939
|
+
const rows = _.map(payload.data.rows, (item)=>{
|
|
13940
|
+
delete item.children;
|
|
13941
|
+
delete item.parent;
|
|
13942
|
+
return item;
|
|
13943
|
+
})
|
|
13944
|
+
payload.data.rows = rows;
|
|
13945
|
+
}
|
|
13879
13946
|
return payload;
|
|
13880
13947
|
}
|
|
13881
13948
|
if(!payload.data.rows){
|
|
@@ -13907,6 +13974,8 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
13907
13974
|
_.each(children, (item)=>{
|
|
13908
13975
|
if(item.children){
|
|
13909
13976
|
item.children = getChildren(records, item.children)
|
|
13977
|
+
}else{
|
|
13978
|
+
item.children = [];
|
|
13910
13979
|
}
|
|
13911
13980
|
})
|
|
13912
13981
|
return children;
|
|
@@ -13961,7 +14030,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
13961
14030
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
13962
14031
|
const isCreate = _$1__namespace.isBoolean(field.create) ? field.create : true;
|
|
13963
14032
|
// lookup字段配置过滤条件就强制不显示新建按钮
|
|
13964
|
-
let isHasFilters = (field.filters || field._filtersFunction) ? true : false;
|
|
14033
|
+
let isHasFilters = (field.filters || field.filtersFunction || field._filtersFunction) ? true : false;
|
|
13965
14034
|
if (isAllowCreate && isCreate && !isHasFilters) {
|
|
13966
14035
|
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
13967
14036
|
new_button.align = "right";
|
|
@@ -14364,18 +14433,30 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
14364
14433
|
enableEnhancedLookup = true;
|
|
14365
14434
|
}
|
|
14366
14435
|
}
|
|
14436
|
+
let amisSchema;
|
|
14367
14437
|
// 默认使用下拉框模式显示lookup选项,只能配置了enable_enhanced_lookup才使用弹出增强模式
|
|
14368
14438
|
if(enableEnhancedLookup == true){
|
|
14369
|
-
|
|
14439
|
+
amisSchema = await lookupToAmisPicker(field, readonly, ctx);
|
|
14370
14440
|
}else if(refObject.enable_tree) {
|
|
14371
|
-
|
|
14441
|
+
amisSchema = await lookupToAmisTreeSelect(field, readonly, Object.assign({}, ctx, {
|
|
14372
14442
|
labelField: referenceTo.labelField?.name || 'name',
|
|
14373
14443
|
valueField: referenceTo.valueField?.name || '_id',
|
|
14374
14444
|
objectName: referenceTo.objectName
|
|
14375
14445
|
}));
|
|
14376
14446
|
}else {
|
|
14377
|
-
|
|
14447
|
+
amisSchema = await lookupToAmisSelect(field, readonly, ctx);
|
|
14448
|
+
}
|
|
14449
|
+
let refLookupPage = refObject.pages && refObject.pages.lookup;
|
|
14450
|
+
if(refLookupPage){
|
|
14451
|
+
if(refLookupPage.is_enable){
|
|
14452
|
+
let pageAmisSchema = refLookupPage.amis_schema;
|
|
14453
|
+
if(typeof pageAmisSchema == 'string'){
|
|
14454
|
+
pageAmisSchema = JSON.parse(pageAmisSchema);
|
|
14455
|
+
}
|
|
14456
|
+
amisSchema = _$1__namespace.defaultsDeep({}, pageAmisSchema, amisSchema);
|
|
14457
|
+
}
|
|
14378
14458
|
}
|
|
14459
|
+
return amisSchema;
|
|
14379
14460
|
}
|
|
14380
14461
|
|
|
14381
14462
|
async function lookupToAmisSelectUser(field, readonly, ctx){
|
|
@@ -15124,7 +15205,8 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15124
15205
|
},
|
|
15125
15206
|
pipeOut: (value, oldValue, data) => {
|
|
15126
15207
|
if(value){
|
|
15127
|
-
|
|
15208
|
+
const result = value/100;
|
|
15209
|
+
return Number(result.toFixed(field.scale+2));
|
|
15128
15210
|
}
|
|
15129
15211
|
return value;
|
|
15130
15212
|
},
|
|
@@ -15358,7 +15440,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15358
15440
|
if(field.is_wide || convertData.type === 'group'){
|
|
15359
15441
|
convertData.className = 'col-span-2 m-0';
|
|
15360
15442
|
}else {
|
|
15361
|
-
convertData.className = 'm-
|
|
15443
|
+
convertData.className = 'm-1';
|
|
15362
15444
|
}
|
|
15363
15445
|
if(readonly){
|
|
15364
15446
|
convertData.className = `${convertData.className} border-b`;
|
|
@@ -15763,8 +15845,8 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
15763
15845
|
/*
|
|
15764
15846
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
15765
15847
|
* @Date: 2023-11-15 09:50:22
|
|
15766
|
-
* @LastEditors:
|
|
15767
|
-
* @LastEditTime: 2024-01-
|
|
15848
|
+
* @LastEditors: liaodaxue
|
|
15849
|
+
* @LastEditTime: 2024-01-09 18:12:28
|
|
15768
15850
|
*/
|
|
15769
15851
|
|
|
15770
15852
|
/**
|
|
@@ -15804,6 +15886,7 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
15804
15886
|
"config": Object.assign({}, field, {
|
|
15805
15887
|
label: false
|
|
15806
15888
|
}),
|
|
15889
|
+
inInputTable: true,
|
|
15807
15890
|
"static": true,
|
|
15808
15891
|
"readonly": true,
|
|
15809
15892
|
label: field.label,
|
|
@@ -19695,6 +19778,7 @@ var AmisObjectButton = function (props) {
|
|
|
19695
19778
|
delete renderData.event;
|
|
19696
19779
|
}
|
|
19697
19780
|
schema.data = _$1.defaultsDeep({}, renderData, getDefaultRenderData(), schema.data);
|
|
19781
|
+
delete schema.data.event;
|
|
19698
19782
|
}
|
|
19699
19783
|
return (React__default["default"].createElement(React__default["default"].Fragment, null, button && amisSchema ? (React__default["default"].createElement(React__default["default"].Fragment, null, render('body', schema, {
|
|
19700
19784
|
// 这里的信息会作为 props 传递给子组件,一般情况下都不需要这个,
|
|
@@ -19714,7 +19798,7 @@ var getMenu = function (render, buttons, btnClassName, props) {
|
|
|
19714
19798
|
if (btnClassName) {
|
|
19715
19799
|
button.className = "".concat(button.className, " ").concat(btnClassName);
|
|
19716
19800
|
}
|
|
19717
|
-
if (button.
|
|
19801
|
+
if (button.visibleOnAlias) {
|
|
19718
19802
|
button.visibleOn = button.visibleOnAlias;
|
|
19719
19803
|
}
|
|
19720
19804
|
delete button.className;
|
|
@@ -20082,16 +20166,21 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
20082
20166
|
},
|
|
20083
20167
|
{
|
|
20084
20168
|
"actionType": "reload",
|
|
20085
|
-
"componentId": "listview_" + objectApiName,
|
|
20086
20169
|
"expression": "${(event.data.recordId || event.data.__deletedRecord === true || event.data.displayAs === 'split') && event.data._isRelated != true}" //不是新建, 或分栏模式下新建主对象记录, 则刷新列表
|
|
20087
20170
|
}
|
|
20088
20171
|
]
|
|
20089
20172
|
};
|
|
20173
|
+
//触发amis crud 高度重算
|
|
20090
20174
|
listSchema.onEvent["selectedChange"] = {
|
|
20091
20175
|
"actions": [
|
|
20092
20176
|
{
|
|
20093
|
-
"actionType": "
|
|
20094
|
-
"
|
|
20177
|
+
"actionType": "broadcast",
|
|
20178
|
+
"args": {
|
|
20179
|
+
"eventName": "@height.changed.".concat(objectApiName),
|
|
20180
|
+
},
|
|
20181
|
+
"data": {
|
|
20182
|
+
"timeOut": 500
|
|
20183
|
+
}
|
|
20095
20184
|
}
|
|
20096
20185
|
]
|
|
20097
20186
|
};
|
|
@@ -21701,14 +21790,14 @@ function getAmisStaticFieldType(type, data_type, options) {
|
|
|
21701
21790
|
return type;
|
|
21702
21791
|
}
|
|
21703
21792
|
var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
21704
|
-
var steedosField, field, _a, readonly, _b, ctx, config, fStatic, defaultSource, source, schema, fieldSchema, fieldValue, hasImageOrFile_1, fieldHtml_1, schema, tableFields, _c, _d, subField, subFieldName, fieldAmis, schema, error_1;
|
|
21793
|
+
var steedosField, field, _a, readonly, _b, ctx, config, fStatic, env, inInputTable, defaultSource, source, fieldBaseProps, tpl_1, res, valueOptions, fieldValue_1, reference_to_field_1, schema, fieldSchema, fieldValue, hasImageOrFile_1, fieldHtml_1, schema, tableFields, _c, _d, subField, subFieldName, fieldAmis, schema, error_1;
|
|
21705
21794
|
var e_1, _e;
|
|
21706
|
-
var _f, _g, _h;
|
|
21707
|
-
return __generator(this, function (
|
|
21708
|
-
switch (
|
|
21795
|
+
var _f, _g, _h, _j, _k;
|
|
21796
|
+
return __generator(this, function (_l) {
|
|
21797
|
+
switch (_l.label) {
|
|
21709
21798
|
case 0:
|
|
21710
21799
|
steedosField = null;
|
|
21711
|
-
field = props.field, _a = props.readonly, readonly = _a === void 0 ? false : _a, _b = props.ctx, ctx = _b === void 0 ? {} : _b, config = props.config, props.$schema, fStatic = props.static;
|
|
21800
|
+
field = props.field, _a = props.readonly, readonly = _a === void 0 ? false : _a, _b = props.ctx, ctx = _b === void 0 ? {} : _b, config = props.config, props.$schema, fStatic = props.static, env = props.env, inInputTable = props.inInputTable;
|
|
21712
21801
|
// console.log(`AmisSteedosField`, props)
|
|
21713
21802
|
// if($schema.config && isString($schema.config)){
|
|
21714
21803
|
// $schema.config = JSON.parse($schema.config)
|
|
@@ -21736,10 +21825,10 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21736
21825
|
// 字段配置为只读,强制走fStatic模式,加上_display判断是为了不影响历史代码,比如直接在ObjectForm中调用steedos-field组件
|
|
21737
21826
|
fStatic = true;
|
|
21738
21827
|
}
|
|
21739
|
-
|
|
21828
|
+
_l.label = 1;
|
|
21740
21829
|
case 1:
|
|
21741
|
-
|
|
21742
|
-
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/,
|
|
21830
|
+
_l.trys.push([1, 21, , 22]);
|
|
21831
|
+
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/, 5];
|
|
21743
21832
|
defaultSource = {
|
|
21744
21833
|
"method": "post",
|
|
21745
21834
|
"url": "${context.rootUrl}/graphql",
|
|
@@ -21761,23 +21850,49 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21761
21850
|
}
|
|
21762
21851
|
}
|
|
21763
21852
|
source = ((_f = steedosField.amis) === null || _f === void 0 ? void 0 : _f.source) || ((_g = steedosField.amis) === null || _g === void 0 ? void 0 : _g.autoComplete) || defaultSource;
|
|
21764
|
-
|
|
21765
|
-
type: 'select',
|
|
21853
|
+
fieldBaseProps = {
|
|
21766
21854
|
multiple: steedosField.multiple,
|
|
21767
21855
|
name: steedosField.name,
|
|
21768
21856
|
label: steedosField.label,
|
|
21769
21857
|
static: true,
|
|
21770
|
-
className: (_h = steedosField.amis) === null || _h === void 0 ? void 0 : _h.className
|
|
21771
|
-
|
|
21772
|
-
|
|
21858
|
+
className: (_h = steedosField.amis) === null || _h === void 0 ? void 0 : _h.className
|
|
21859
|
+
};
|
|
21860
|
+
if (!inInputTable) return [3 /*break*/, 2];
|
|
21861
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'select', source: source });
|
|
21862
|
+
return [3 /*break*/, 4];
|
|
21863
|
+
case 2:
|
|
21864
|
+
tpl_1 = '';
|
|
21865
|
+
return [4 /*yield*/, env.fetcher(source, props.data)];
|
|
21866
|
+
case 3:
|
|
21867
|
+
res = _l.sent();
|
|
21868
|
+
valueOptions = ((_j = res === null || res === void 0 ? void 0 : res.data) === null || _j === void 0 ? void 0 : _j.options) || [];
|
|
21869
|
+
fieldValue_1 = (_k = props.data) === null || _k === void 0 ? void 0 : _k[steedosField.name];
|
|
21870
|
+
if (fieldValue_1 && fieldValue_1.length && valueOptions && valueOptions.length) {
|
|
21871
|
+
reference_to_field_1 = steedosField.reference_to_field;
|
|
21872
|
+
_$1.forEach(valueOptions, function (item, index) {
|
|
21873
|
+
var label = item.label, value = item.value;
|
|
21874
|
+
if (fieldValue_1.indexOf(value) > -1) {
|
|
21875
|
+
// 因为lookup、master_detail字段配置了reference_to_field != _id的情况下,source中返回的值不能当作链接的后缀值,所以移除字段链接。
|
|
21876
|
+
var optionTpl = "<a href=\"/app/-/".concat(steedosField.reference_to, "/view/").concat(value, "\" >").concat(label, "</a>");
|
|
21877
|
+
if (reference_to_field_1 && reference_to_field_1 != '_id') {
|
|
21878
|
+
optionTpl = "".concat(label);
|
|
21879
|
+
}
|
|
21880
|
+
tpl_1 += tpl_1 ? ',' + optionTpl : optionTpl;
|
|
21881
|
+
}
|
|
21882
|
+
});
|
|
21883
|
+
}
|
|
21884
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'static', tpl: tpl_1 });
|
|
21885
|
+
_l.label = 4;
|
|
21886
|
+
case 4:
|
|
21887
|
+
schema = Object.assign({}, fieldBaseProps, _$1.pick(steedosField.amis || {}, ['className', 'inline', 'label', 'labelAlign', 'name', 'labelRemark', 'description', 'placeholder', 'staticClassName', 'staticLabelClassName', 'staticInputClassName', 'staticSchema']));
|
|
21773
21888
|
schema.placeholder = "";
|
|
21774
21889
|
return [2 /*return*/, schema];
|
|
21775
|
-
case
|
|
21776
|
-
if (!fStatic) return [3 /*break*/,
|
|
21777
|
-
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/,
|
|
21890
|
+
case 5:
|
|
21891
|
+
if (!fStatic) return [3 /*break*/, 18];
|
|
21892
|
+
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/, 7];
|
|
21778
21893
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
21779
|
-
case
|
|
21780
|
-
fieldSchema =
|
|
21894
|
+
case 6:
|
|
21895
|
+
fieldSchema = _l.sent();
|
|
21781
21896
|
if (steedosField.type === 'file' && fieldSchema.disabled) {
|
|
21782
21897
|
fieldValue = fieldSchema.value;
|
|
21783
21898
|
if (fieldValue && fieldValue.length) {
|
|
@@ -21813,52 +21928,52 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21813
21928
|
}
|
|
21814
21929
|
}
|
|
21815
21930
|
return [2 /*return*/, fieldSchema];
|
|
21816
|
-
case
|
|
21931
|
+
case 7:
|
|
21817
21932
|
schema = Object.assign({}, steedosField, {
|
|
21818
21933
|
type: getAmisStaticFieldType(steedosField.type, steedosField.data_type, steedosField),
|
|
21819
21934
|
static: true,
|
|
21820
21935
|
label: steedosField.label
|
|
21821
21936
|
});
|
|
21822
|
-
if (!(steedosField.type === "time")) return [3 /*break*/,
|
|
21937
|
+
if (!(steedosField.type === "time")) return [3 /*break*/, 8];
|
|
21823
21938
|
Object.assign(schema, {
|
|
21824
21939
|
inputFormat: 'HH:mm',
|
|
21825
21940
|
timeFormat: 'HH:mm',
|
|
21826
21941
|
format: '1970-01-01THH:mm:00.000[Z]',
|
|
21827
21942
|
});
|
|
21828
|
-
return [3 /*break*/,
|
|
21829
|
-
case
|
|
21830
|
-
if (!(steedosField.type === "percent")) return [3 /*break*/,
|
|
21943
|
+
return [3 /*break*/, 17];
|
|
21944
|
+
case 8:
|
|
21945
|
+
if (!(steedosField.type === "percent")) return [3 /*break*/, 9];
|
|
21831
21946
|
Object.assign(schema, {
|
|
21832
21947
|
"percent": steedosField.scale ? steedosField.scale : true
|
|
21833
21948
|
});
|
|
21834
|
-
return [3 /*break*/,
|
|
21835
|
-
case
|
|
21836
|
-
if (!(steedosField.type === "password")) return [3 /*break*/,
|
|
21949
|
+
return [3 /*break*/, 17];
|
|
21950
|
+
case 9:
|
|
21951
|
+
if (!(steedosField.type === "password")) return [3 /*break*/, 10];
|
|
21837
21952
|
Object.assign(schema, {
|
|
21838
21953
|
"revealPassword": false //没生效,需要用样式隐藏
|
|
21839
21954
|
});
|
|
21840
|
-
return [3 /*break*/,
|
|
21841
|
-
case
|
|
21842
|
-
if (!(steedosField.type === "select")) return [3 /*break*/,
|
|
21955
|
+
return [3 /*break*/, 17];
|
|
21956
|
+
case 10:
|
|
21957
|
+
if (!(steedosField.type === "select")) return [3 /*break*/, 11];
|
|
21843
21958
|
Object.assign(schema, {
|
|
21844
21959
|
"placeholder": ""
|
|
21845
21960
|
});
|
|
21846
|
-
return [3 /*break*/,
|
|
21847
|
-
case
|
|
21848
|
-
if (!(steedosField.type === "color")) return [3 /*break*/,
|
|
21961
|
+
return [3 /*break*/, 17];
|
|
21962
|
+
case 11:
|
|
21963
|
+
if (!(steedosField.type === "color")) return [3 /*break*/, 12];
|
|
21849
21964
|
Object.assign(schema, {
|
|
21850
21965
|
"defaultColor": null
|
|
21851
21966
|
});
|
|
21852
|
-
return [3 /*break*/,
|
|
21853
|
-
case
|
|
21854
|
-
if (!(steedosField.type === "number")) return [3 /*break*/,
|
|
21967
|
+
return [3 /*break*/, 17];
|
|
21968
|
+
case 12:
|
|
21969
|
+
if (!(steedosField.type === "number")) return [3 /*break*/, 13];
|
|
21855
21970
|
// amis input-number和number组件中的precision表示小数位数,并不是魔方平台的精度概念,要转换下,否则小数点后会显示很多的0
|
|
21856
21971
|
Object.assign(schema, {
|
|
21857
21972
|
"precision": steedosField.scale || 0
|
|
21858
21973
|
});
|
|
21859
|
-
return [3 /*break*/,
|
|
21860
|
-
case
|
|
21861
|
-
if (!(steedosField.type === "table")) return [3 /*break*/,
|
|
21974
|
+
return [3 /*break*/, 17];
|
|
21975
|
+
case 13:
|
|
21976
|
+
if (!(steedosField.type === "table")) return [3 /*break*/, 14];
|
|
21862
21977
|
if (steedosField.subFields) {
|
|
21863
21978
|
tableFields = [];
|
|
21864
21979
|
try {
|
|
@@ -21891,9 +22006,9 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21891
22006
|
}
|
|
21892
22007
|
});
|
|
21893
22008
|
}
|
|
21894
|
-
return [3 /*break*/,
|
|
21895
|
-
case
|
|
21896
|
-
if (!(steedosField.type === "image")) return [3 /*break*/,
|
|
22009
|
+
return [3 /*break*/, 17];
|
|
22010
|
+
case 14:
|
|
22011
|
+
if (!(steedosField.type === "image")) return [3 /*break*/, 15];
|
|
21897
22012
|
Object.assign(schema, {
|
|
21898
22013
|
enlargeAble: true,
|
|
21899
22014
|
showToolbar: true,
|
|
@@ -21924,18 +22039,18 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21924
22039
|
return value;
|
|
21925
22040
|
}
|
|
21926
22041
|
});
|
|
21927
|
-
return [3 /*break*/,
|
|
21928
|
-
case
|
|
21929
|
-
if (!(steedosField.type === "file")) return [3 /*break*/,
|
|
22042
|
+
return [3 /*break*/, 17];
|
|
22043
|
+
case 15:
|
|
22044
|
+
if (!(steedosField.type === "file")) return [3 /*break*/, 17];
|
|
21930
22045
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
21931
|
-
case
|
|
22046
|
+
case 16:
|
|
21932
22047
|
// 附件static模式先保持原来的逻辑,依赖_display,审批王中相关功能在creator中
|
|
21933
22048
|
// convertSFieldToAmisField中会合并steedosField.amis,所以也不需要再次合并steedosField.amis,直接return就好
|
|
21934
|
-
return [2 /*return*/,
|
|
21935
|
-
case
|
|
22049
|
+
return [2 /*return*/, _l.sent()];
|
|
22050
|
+
case 17:
|
|
21936
22051
|
Object.assign(schema, steedosField.amis || {});
|
|
21937
22052
|
return [2 /*return*/, schema];
|
|
21938
|
-
case
|
|
22053
|
+
case 18:
|
|
21939
22054
|
fieldAmis = steedosField.amis || {};
|
|
21940
22055
|
if (!props.data.hasOwnProperty("_display")) {
|
|
21941
22056
|
// 有_display时保持原来的逻辑不变,不走以下新的逻辑,审批王中会特意传入_display以跳过后面新加的代码
|
|
@@ -21993,16 +22108,16 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21993
22108
|
}
|
|
21994
22109
|
}
|
|
21995
22110
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
21996
|
-
case
|
|
21997
|
-
schema =
|
|
22111
|
+
case 19:
|
|
22112
|
+
schema = _l.sent();
|
|
21998
22113
|
// console.log(`AmisSteedosField return schema`, schema)
|
|
21999
22114
|
return [2 /*return*/, schema];
|
|
22000
|
-
case
|
|
22001
|
-
case
|
|
22002
|
-
error_1 =
|
|
22115
|
+
case 20: return [3 /*break*/, 22];
|
|
22116
|
+
case 21:
|
|
22117
|
+
error_1 = _l.sent();
|
|
22003
22118
|
console.log("error", error_1);
|
|
22004
|
-
return [3 /*break*/,
|
|
22005
|
-
case
|
|
22119
|
+
return [3 /*break*/, 22];
|
|
22120
|
+
case 22: return [2 /*return*/, null];
|
|
22006
22121
|
}
|
|
22007
22122
|
});
|
|
22008
22123
|
}); };
|