@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.esm.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.esm.js
CHANGED
|
@@ -4762,11 +4762,11 @@ async function getQuickEditSchema(field, options){
|
|
|
4762
4762
|
if(event.data.isBatchEdit){
|
|
4763
4763
|
selectedItems.forEach(function(selectedItem){
|
|
4764
4764
|
selectedItem._display.${field.name} = event.data._display.${field.name};
|
|
4765
|
-
doAction({actionType: 'setValue', "args": {"value": selectedItem._display},componentId: "_display_" + selectedItem._index});
|
|
4765
|
+
doAction({actionType: 'setValue', "args": {"value": selectedItem._display},componentId: ${options.objectName} + "_display_" + selectedItem._index});
|
|
4766
4766
|
doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + selectedItem._index});
|
|
4767
4767
|
})
|
|
4768
4768
|
}else{
|
|
4769
|
-
doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: "_display_" + event.data._index});
|
|
4769
|
+
doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: ${options.objectName} + "_display_" + event.data._index});
|
|
4770
4770
|
doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + event.data._index});
|
|
4771
4771
|
}
|
|
4772
4772
|
`
|
|
@@ -4796,7 +4796,6 @@ async function getQuickEditSchema(field, options){
|
|
|
4796
4796
|
{
|
|
4797
4797
|
"actionType": "custom",
|
|
4798
4798
|
"script": `
|
|
4799
|
-
|
|
4800
4799
|
var _display = _.cloneDeep(event.data._display);
|
|
4801
4800
|
${displayField}
|
|
4802
4801
|
doAction({actionType: 'setValue', "args": {"value": {_display}},componentId: "${quickEditId}"});
|
|
@@ -4967,6 +4966,23 @@ async function getQuickEditSchema(field, options){
|
|
|
4967
4966
|
"onEvent":{
|
|
4968
4967
|
"init":{
|
|
4969
4968
|
"actions":[
|
|
4969
|
+
//amis3.6无法从数据域中直接拿到正确的selectitems,需要通过crud组件的getSelected()函数获取
|
|
4970
|
+
{
|
|
4971
|
+
"actionType": "custom",
|
|
4972
|
+
"script": `
|
|
4973
|
+
crudScoped = event.context.scoped.getComponentById('${options.crudId}');
|
|
4974
|
+
const selectedItems = crudScoped && crudScoped.control.getSelected();
|
|
4975
|
+
doAction({
|
|
4976
|
+
"componentId": "${quickEditId}",
|
|
4977
|
+
"actionType": "setValue",
|
|
4978
|
+
"args": {
|
|
4979
|
+
"value": {
|
|
4980
|
+
selectedItems
|
|
4981
|
+
}
|
|
4982
|
+
}
|
|
4983
|
+
});
|
|
4984
|
+
`
|
|
4985
|
+
},
|
|
4970
4986
|
{
|
|
4971
4987
|
"actionType": "setValue",
|
|
4972
4988
|
"componentId": quickEditId,
|
|
@@ -8897,12 +8913,16 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
8897
8913
|
// }
|
|
8898
8914
|
// listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
|
|
8899
8915
|
// 点击搜索的时候自动收起搜索栏
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
|
|
8916
|
+
//触发amis crud 高度重算
|
|
8917
|
+
doAction({
|
|
8918
|
+
"actionType": "broadcast",
|
|
8919
|
+
"args": {
|
|
8920
|
+
"eventName": "@height.changed.${objectSchema.name}"
|
|
8921
|
+
},
|
|
8922
|
+
"data": {
|
|
8923
|
+
"timeOut": 500
|
|
8924
|
+
}
|
|
8925
|
+
});
|
|
8906
8926
|
const filterService = filterForm.context.getComponents().find(function(n){
|
|
8907
8927
|
return n.props.type === "service";
|
|
8908
8928
|
});
|
|
@@ -9004,9 +9024,16 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
9004
9024
|
let filterFormService = SteedosUI.getClosestAmisComponentByType(filterForm.context, "service");
|
|
9005
9025
|
filterFormService.setData({showFieldsFilter: !!!filterFormService.props.data.showFieldsFilter});
|
|
9006
9026
|
//触发amis crud 高度重算
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
|
|
9027
|
+
doAction({
|
|
9028
|
+
"actionType": "broadcast",
|
|
9029
|
+
"args": {
|
|
9030
|
+
"eventName": "@height.changed.${objectSchema.name}"
|
|
9031
|
+
},
|
|
9032
|
+
"data": {
|
|
9033
|
+
"timeOut": 100
|
|
9034
|
+
}
|
|
9035
|
+
});
|
|
9036
|
+
|
|
9010
9037
|
// 移除搜索按钮上的红点
|
|
9011
9038
|
// let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
9012
9039
|
let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
@@ -9163,9 +9190,15 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
9163
9190
|
sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify(localListViewProps));
|
|
9164
9191
|
}
|
|
9165
9192
|
//触发amis crud 高度重算
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
|
|
9193
|
+
doAction({
|
|
9194
|
+
"actionType": "broadcast",
|
|
9195
|
+
"args": {
|
|
9196
|
+
"eventName": "@height.changed.${objectSchema.name}"
|
|
9197
|
+
},
|
|
9198
|
+
"data": {
|
|
9199
|
+
"timeOut": 100
|
|
9200
|
+
}
|
|
9201
|
+
});
|
|
9169
9202
|
// ===END===
|
|
9170
9203
|
`;
|
|
9171
9204
|
return {
|
|
@@ -10871,13 +10904,16 @@ const filterService = filterForm.context.getComponents().find(function(n){
|
|
|
10871
10904
|
});
|
|
10872
10905
|
let toShowFieldsFilter = !!!filterService.props.data.showFieldsFilter;
|
|
10873
10906
|
filterService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
|
|
10879
|
-
}
|
|
10880
|
-
|
|
10907
|
+
//触发amis crud 高度重算
|
|
10908
|
+
doAction({
|
|
10909
|
+
"actionType": "broadcast",
|
|
10910
|
+
"args": {
|
|
10911
|
+
"eventName": "@height.changed." + event.data.objectName
|
|
10912
|
+
},
|
|
10913
|
+
"data": {
|
|
10914
|
+
"timeOut": 1000
|
|
10915
|
+
}
|
|
10916
|
+
});
|
|
10881
10917
|
// 手机端在显示搜索栏时隐藏crud上的刷新按钮,因为点击后crud高度显示有问题
|
|
10882
10918
|
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
10883
10919
|
crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
@@ -11241,12 +11277,16 @@ async function getObjectFilter(objectSchema, fields, options) {
|
|
|
11241
11277
|
return;
|
|
11242
11278
|
}
|
|
11243
11279
|
// 列表搜索栏字段值变更后立刻触发提交表单执行crud搜索,所以这里需要额外重算crud高度及筛选按钮红色星号图标显示隐藏
|
|
11244
|
-
|
|
11245
|
-
|
|
11246
|
-
|
|
11247
|
-
|
|
11248
|
-
|
|
11249
|
-
|
|
11280
|
+
//触发amis crud 高度重算
|
|
11281
|
+
doAction({
|
|
11282
|
+
"actionType": "broadcast",
|
|
11283
|
+
"args": {
|
|
11284
|
+
"eventName": "@height.changed.${objectSchema.name}"
|
|
11285
|
+
},
|
|
11286
|
+
"data": {
|
|
11287
|
+
"timeOut": 1000
|
|
11288
|
+
}
|
|
11289
|
+
});
|
|
11250
11290
|
resizeWindow();
|
|
11251
11291
|
const scope = event.context.scoped;
|
|
11252
11292
|
// let filterFormValues = event.data;
|
|
@@ -11558,7 +11598,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11558
11598
|
|
|
11559
11599
|
if(body.columns && options.formFactor != 'SMALL'){
|
|
11560
11600
|
//将_display放入crud的columns的倒数第二列中(最后一列会影响固定列),可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
11561
|
-
body.columns.splice(body.columns.length - 1, 0, {name: '_display',type: 'static', width: 32, placeholder: "",id: "_display_${_index}", className: "hidden"});
|
|
11601
|
+
body.columns.splice(body.columns.length - 1, 0, {name: '_display',type: 'static', width: 32, placeholder: "",id: objectSchema.name + "_display_${_index}", className: "hidden"});
|
|
11562
11602
|
}
|
|
11563
11603
|
|
|
11564
11604
|
if (defaults) {
|
|
@@ -11595,7 +11635,24 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11595
11635
|
id: `service_${id}`,
|
|
11596
11636
|
name: `page`,
|
|
11597
11637
|
data: options.amisData,
|
|
11598
|
-
body: body
|
|
11638
|
+
body: body,
|
|
11639
|
+
//监听广播事件,重算crud高度
|
|
11640
|
+
onEvent: {
|
|
11641
|
+
[`@height.changed.${objectSchema.name}`]: {
|
|
11642
|
+
"actions": [
|
|
11643
|
+
{
|
|
11644
|
+
"actionType": "custom",
|
|
11645
|
+
"script": `
|
|
11646
|
+
var crudScoped = event.context.scoped.getComponentById('${body.id}');
|
|
11647
|
+
var timeOut = event.data.timeOut || 500;
|
|
11648
|
+
setTimeout(()=>{
|
|
11649
|
+
crudScoped && crudScoped.control.updateAutoFillHeight();
|
|
11650
|
+
}, timeOut);
|
|
11651
|
+
`
|
|
11652
|
+
}
|
|
11653
|
+
]
|
|
11654
|
+
}
|
|
11655
|
+
}
|
|
11599
11656
|
}
|
|
11600
11657
|
}
|
|
11601
11658
|
|
|
@@ -13494,6 +13551,8 @@ function getLookupSapceUserTreeSchema(isMobile){
|
|
|
13494
13551
|
_.each(children, (item) => {
|
|
13495
13552
|
if (item.children) {
|
|
13496
13553
|
item.children = getChildren(records, item.children)
|
|
13554
|
+
}else{
|
|
13555
|
+
item.children = [];
|
|
13497
13556
|
}
|
|
13498
13557
|
})
|
|
13499
13558
|
return children;
|
|
@@ -13848,6 +13907,14 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
13848
13907
|
})
|
|
13849
13908
|
payload.data.rows = rows;
|
|
13850
13909
|
*/
|
|
13910
|
+
if(enable_tree){
|
|
13911
|
+
const rows = _.map(payload.data.rows, (item)=>{
|
|
13912
|
+
delete item.children;
|
|
13913
|
+
delete item.parent;
|
|
13914
|
+
return item;
|
|
13915
|
+
})
|
|
13916
|
+
payload.data.rows = rows;
|
|
13917
|
+
}
|
|
13851
13918
|
return payload;
|
|
13852
13919
|
}
|
|
13853
13920
|
if(!payload.data.rows){
|
|
@@ -13879,6 +13946,8 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
13879
13946
|
_.each(children, (item)=>{
|
|
13880
13947
|
if(item.children){
|
|
13881
13948
|
item.children = getChildren(records, item.children)
|
|
13949
|
+
}else{
|
|
13950
|
+
item.children = [];
|
|
13882
13951
|
}
|
|
13883
13952
|
})
|
|
13884
13953
|
return children;
|
|
@@ -13933,7 +14002,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
13933
14002
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
13934
14003
|
const isCreate = _$1.isBoolean(field.create) ? field.create : true;
|
|
13935
14004
|
// lookup字段配置过滤条件就强制不显示新建按钮
|
|
13936
|
-
let isHasFilters = (field.filters || field._filtersFunction) ? true : false;
|
|
14005
|
+
let isHasFilters = (field.filters || field.filtersFunction || field._filtersFunction) ? true : false;
|
|
13937
14006
|
if (isAllowCreate && isCreate && !isHasFilters) {
|
|
13938
14007
|
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
13939
14008
|
new_button.align = "right";
|
|
@@ -14336,18 +14405,30 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
14336
14405
|
enableEnhancedLookup = true;
|
|
14337
14406
|
}
|
|
14338
14407
|
}
|
|
14408
|
+
let amisSchema;
|
|
14339
14409
|
// 默认使用下拉框模式显示lookup选项,只能配置了enable_enhanced_lookup才使用弹出增强模式
|
|
14340
14410
|
if(enableEnhancedLookup == true){
|
|
14341
|
-
|
|
14411
|
+
amisSchema = await lookupToAmisPicker(field, readonly, ctx);
|
|
14342
14412
|
}else if(refObject.enable_tree) {
|
|
14343
|
-
|
|
14413
|
+
amisSchema = await lookupToAmisTreeSelect(field, readonly, Object.assign({}, ctx, {
|
|
14344
14414
|
labelField: referenceTo.labelField?.name || 'name',
|
|
14345
14415
|
valueField: referenceTo.valueField?.name || '_id',
|
|
14346
14416
|
objectName: referenceTo.objectName
|
|
14347
14417
|
}));
|
|
14348
14418
|
}else {
|
|
14349
|
-
|
|
14419
|
+
amisSchema = await lookupToAmisSelect(field, readonly, ctx);
|
|
14420
|
+
}
|
|
14421
|
+
let refLookupPage = refObject.pages && refObject.pages.lookup;
|
|
14422
|
+
if(refLookupPage){
|
|
14423
|
+
if(refLookupPage.is_enable){
|
|
14424
|
+
let pageAmisSchema = refLookupPage.amis_schema;
|
|
14425
|
+
if(typeof pageAmisSchema == 'string'){
|
|
14426
|
+
pageAmisSchema = JSON.parse(pageAmisSchema);
|
|
14427
|
+
}
|
|
14428
|
+
amisSchema = _$1.defaultsDeep({}, pageAmisSchema, amisSchema);
|
|
14429
|
+
}
|
|
14350
14430
|
}
|
|
14431
|
+
return amisSchema;
|
|
14351
14432
|
}
|
|
14352
14433
|
|
|
14353
14434
|
async function lookupToAmisSelectUser(field, readonly, ctx){
|
|
@@ -15096,7 +15177,8 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15096
15177
|
},
|
|
15097
15178
|
pipeOut: (value, oldValue, data) => {
|
|
15098
15179
|
if(value){
|
|
15099
|
-
|
|
15180
|
+
const result = value/100;
|
|
15181
|
+
return Number(result.toFixed(field.scale+2));
|
|
15100
15182
|
}
|
|
15101
15183
|
return value;
|
|
15102
15184
|
},
|
|
@@ -15330,7 +15412,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15330
15412
|
if(field.is_wide || convertData.type === 'group'){
|
|
15331
15413
|
convertData.className = 'col-span-2 m-0';
|
|
15332
15414
|
}else {
|
|
15333
|
-
convertData.className = 'm-
|
|
15415
|
+
convertData.className = 'm-1';
|
|
15334
15416
|
}
|
|
15335
15417
|
if(readonly){
|
|
15336
15418
|
convertData.className = `${convertData.className} border-b`;
|
|
@@ -15735,8 +15817,8 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
15735
15817
|
/*
|
|
15736
15818
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
15737
15819
|
* @Date: 2023-11-15 09:50:22
|
|
15738
|
-
* @LastEditors:
|
|
15739
|
-
* @LastEditTime: 2024-01-
|
|
15820
|
+
* @LastEditors: liaodaxue
|
|
15821
|
+
* @LastEditTime: 2024-01-09 18:12:28
|
|
15740
15822
|
*/
|
|
15741
15823
|
|
|
15742
15824
|
/**
|
|
@@ -15776,6 +15858,7 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
15776
15858
|
"config": Object.assign({}, field, {
|
|
15777
15859
|
label: false
|
|
15778
15860
|
}),
|
|
15861
|
+
inInputTable: true,
|
|
15779
15862
|
"static": true,
|
|
15780
15863
|
"readonly": true,
|
|
15781
15864
|
label: field.label,
|
|
@@ -19667,6 +19750,7 @@ var AmisObjectButton = function (props) {
|
|
|
19667
19750
|
delete renderData.event;
|
|
19668
19751
|
}
|
|
19669
19752
|
schema.data = defaultsDeep$1({}, renderData, getDefaultRenderData(), schema.data);
|
|
19753
|
+
delete schema.data.event;
|
|
19670
19754
|
}
|
|
19671
19755
|
return (React.createElement(React.Fragment, null, button && amisSchema ? (React.createElement(React.Fragment, null, render('body', schema, {
|
|
19672
19756
|
// 这里的信息会作为 props 传递给子组件,一般情况下都不需要这个,
|
|
@@ -19686,7 +19770,7 @@ var getMenu = function (render, buttons, btnClassName, props) {
|
|
|
19686
19770
|
if (btnClassName) {
|
|
19687
19771
|
button.className = "".concat(button.className, " ").concat(btnClassName);
|
|
19688
19772
|
}
|
|
19689
|
-
if (button.
|
|
19773
|
+
if (button.visibleOnAlias) {
|
|
19690
19774
|
button.visibleOn = button.visibleOnAlias;
|
|
19691
19775
|
}
|
|
19692
19776
|
delete button.className;
|
|
@@ -20054,16 +20138,21 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
20054
20138
|
},
|
|
20055
20139
|
{
|
|
20056
20140
|
"actionType": "reload",
|
|
20057
|
-
"componentId": "listview_" + objectApiName,
|
|
20058
20141
|
"expression": "${(event.data.recordId || event.data.__deletedRecord === true || event.data.displayAs === 'split') && event.data._isRelated != true}" //不是新建, 或分栏模式下新建主对象记录, 则刷新列表
|
|
20059
20142
|
}
|
|
20060
20143
|
]
|
|
20061
20144
|
};
|
|
20145
|
+
//触发amis crud 高度重算
|
|
20062
20146
|
listSchema.onEvent["selectedChange"] = {
|
|
20063
20147
|
"actions": [
|
|
20064
20148
|
{
|
|
20065
|
-
"actionType": "
|
|
20066
|
-
"
|
|
20149
|
+
"actionType": "broadcast",
|
|
20150
|
+
"args": {
|
|
20151
|
+
"eventName": "@height.changed.".concat(objectApiName),
|
|
20152
|
+
},
|
|
20153
|
+
"data": {
|
|
20154
|
+
"timeOut": 500
|
|
20155
|
+
}
|
|
20067
20156
|
}
|
|
20068
20157
|
]
|
|
20069
20158
|
};
|
|
@@ -21673,14 +21762,14 @@ function getAmisStaticFieldType(type, data_type, options) {
|
|
|
21673
21762
|
return type;
|
|
21674
21763
|
}
|
|
21675
21764
|
var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
21676
|
-
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;
|
|
21765
|
+
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;
|
|
21677
21766
|
var e_1, _e;
|
|
21678
|
-
var _f, _g, _h;
|
|
21679
|
-
return __generator(this, function (
|
|
21680
|
-
switch (
|
|
21767
|
+
var _f, _g, _h, _j, _k;
|
|
21768
|
+
return __generator(this, function (_l) {
|
|
21769
|
+
switch (_l.label) {
|
|
21681
21770
|
case 0:
|
|
21682
21771
|
steedosField = null;
|
|
21683
|
-
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;
|
|
21772
|
+
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;
|
|
21684
21773
|
// console.log(`AmisSteedosField`, props)
|
|
21685
21774
|
// if($schema.config && isString($schema.config)){
|
|
21686
21775
|
// $schema.config = JSON.parse($schema.config)
|
|
@@ -21708,10 +21797,10 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21708
21797
|
// 字段配置为只读,强制走fStatic模式,加上_display判断是为了不影响历史代码,比如直接在ObjectForm中调用steedos-field组件
|
|
21709
21798
|
fStatic = true;
|
|
21710
21799
|
}
|
|
21711
|
-
|
|
21800
|
+
_l.label = 1;
|
|
21712
21801
|
case 1:
|
|
21713
|
-
|
|
21714
|
-
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/,
|
|
21802
|
+
_l.trys.push([1, 21, , 22]);
|
|
21803
|
+
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/, 5];
|
|
21715
21804
|
defaultSource = {
|
|
21716
21805
|
"method": "post",
|
|
21717
21806
|
"url": "${context.rootUrl}/graphql",
|
|
@@ -21733,23 +21822,49 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21733
21822
|
}
|
|
21734
21823
|
}
|
|
21735
21824
|
source = ((_f = steedosField.amis) === null || _f === void 0 ? void 0 : _f.source) || ((_g = steedosField.amis) === null || _g === void 0 ? void 0 : _g.autoComplete) || defaultSource;
|
|
21736
|
-
|
|
21737
|
-
type: 'select',
|
|
21825
|
+
fieldBaseProps = {
|
|
21738
21826
|
multiple: steedosField.multiple,
|
|
21739
21827
|
name: steedosField.name,
|
|
21740
21828
|
label: steedosField.label,
|
|
21741
21829
|
static: true,
|
|
21742
|
-
className: (_h = steedosField.amis) === null || _h === void 0 ? void 0 : _h.className
|
|
21743
|
-
|
|
21744
|
-
|
|
21830
|
+
className: (_h = steedosField.amis) === null || _h === void 0 ? void 0 : _h.className
|
|
21831
|
+
};
|
|
21832
|
+
if (!inInputTable) return [3 /*break*/, 2];
|
|
21833
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'select', source: source });
|
|
21834
|
+
return [3 /*break*/, 4];
|
|
21835
|
+
case 2:
|
|
21836
|
+
tpl_1 = '';
|
|
21837
|
+
return [4 /*yield*/, env.fetcher(source, props.data)];
|
|
21838
|
+
case 3:
|
|
21839
|
+
res = _l.sent();
|
|
21840
|
+
valueOptions = ((_j = res === null || res === void 0 ? void 0 : res.data) === null || _j === void 0 ? void 0 : _j.options) || [];
|
|
21841
|
+
fieldValue_1 = (_k = props.data) === null || _k === void 0 ? void 0 : _k[steedosField.name];
|
|
21842
|
+
if (fieldValue_1 && fieldValue_1.length && valueOptions && valueOptions.length) {
|
|
21843
|
+
reference_to_field_1 = steedosField.reference_to_field;
|
|
21844
|
+
forEach(valueOptions, function (item, index) {
|
|
21845
|
+
var label = item.label, value = item.value;
|
|
21846
|
+
if (fieldValue_1.indexOf(value) > -1) {
|
|
21847
|
+
// 因为lookup、master_detail字段配置了reference_to_field != _id的情况下,source中返回的值不能当作链接的后缀值,所以移除字段链接。
|
|
21848
|
+
var optionTpl = "<a href=\"/app/-/".concat(steedosField.reference_to, "/view/").concat(value, "\" >").concat(label, "</a>");
|
|
21849
|
+
if (reference_to_field_1 && reference_to_field_1 != '_id') {
|
|
21850
|
+
optionTpl = "".concat(label);
|
|
21851
|
+
}
|
|
21852
|
+
tpl_1 += tpl_1 ? ',' + optionTpl : optionTpl;
|
|
21853
|
+
}
|
|
21854
|
+
});
|
|
21855
|
+
}
|
|
21856
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'static', tpl: tpl_1 });
|
|
21857
|
+
_l.label = 4;
|
|
21858
|
+
case 4:
|
|
21859
|
+
schema = Object.assign({}, fieldBaseProps, pick(steedosField.amis || {}, ['className', 'inline', 'label', 'labelAlign', 'name', 'labelRemark', 'description', 'placeholder', 'staticClassName', 'staticLabelClassName', 'staticInputClassName', 'staticSchema']));
|
|
21745
21860
|
schema.placeholder = "";
|
|
21746
21861
|
return [2 /*return*/, schema];
|
|
21747
|
-
case
|
|
21748
|
-
if (!fStatic) return [3 /*break*/,
|
|
21749
|
-
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/,
|
|
21862
|
+
case 5:
|
|
21863
|
+
if (!fStatic) return [3 /*break*/, 18];
|
|
21864
|
+
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/, 7];
|
|
21750
21865
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
21751
|
-
case
|
|
21752
|
-
fieldSchema =
|
|
21866
|
+
case 6:
|
|
21867
|
+
fieldSchema = _l.sent();
|
|
21753
21868
|
if (steedosField.type === 'file' && fieldSchema.disabled) {
|
|
21754
21869
|
fieldValue = fieldSchema.value;
|
|
21755
21870
|
if (fieldValue && fieldValue.length) {
|
|
@@ -21785,52 +21900,52 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21785
21900
|
}
|
|
21786
21901
|
}
|
|
21787
21902
|
return [2 /*return*/, fieldSchema];
|
|
21788
|
-
case
|
|
21903
|
+
case 7:
|
|
21789
21904
|
schema = Object.assign({}, steedosField, {
|
|
21790
21905
|
type: getAmisStaticFieldType(steedosField.type, steedosField.data_type, steedosField),
|
|
21791
21906
|
static: true,
|
|
21792
21907
|
label: steedosField.label
|
|
21793
21908
|
});
|
|
21794
|
-
if (!(steedosField.type === "time")) return [3 /*break*/,
|
|
21909
|
+
if (!(steedosField.type === "time")) return [3 /*break*/, 8];
|
|
21795
21910
|
Object.assign(schema, {
|
|
21796
21911
|
inputFormat: 'HH:mm',
|
|
21797
21912
|
timeFormat: 'HH:mm',
|
|
21798
21913
|
format: '1970-01-01THH:mm:00.000[Z]',
|
|
21799
21914
|
});
|
|
21800
|
-
return [3 /*break*/,
|
|
21801
|
-
case
|
|
21802
|
-
if (!(steedosField.type === "percent")) return [3 /*break*/,
|
|
21915
|
+
return [3 /*break*/, 17];
|
|
21916
|
+
case 8:
|
|
21917
|
+
if (!(steedosField.type === "percent")) return [3 /*break*/, 9];
|
|
21803
21918
|
Object.assign(schema, {
|
|
21804
21919
|
"percent": steedosField.scale ? steedosField.scale : true
|
|
21805
21920
|
});
|
|
21806
|
-
return [3 /*break*/,
|
|
21807
|
-
case
|
|
21808
|
-
if (!(steedosField.type === "password")) return [3 /*break*/,
|
|
21921
|
+
return [3 /*break*/, 17];
|
|
21922
|
+
case 9:
|
|
21923
|
+
if (!(steedosField.type === "password")) return [3 /*break*/, 10];
|
|
21809
21924
|
Object.assign(schema, {
|
|
21810
21925
|
"revealPassword": false //没生效,需要用样式隐藏
|
|
21811
21926
|
});
|
|
21812
|
-
return [3 /*break*/,
|
|
21813
|
-
case
|
|
21814
|
-
if (!(steedosField.type === "select")) return [3 /*break*/,
|
|
21927
|
+
return [3 /*break*/, 17];
|
|
21928
|
+
case 10:
|
|
21929
|
+
if (!(steedosField.type === "select")) return [3 /*break*/, 11];
|
|
21815
21930
|
Object.assign(schema, {
|
|
21816
21931
|
"placeholder": ""
|
|
21817
21932
|
});
|
|
21818
|
-
return [3 /*break*/,
|
|
21819
|
-
case
|
|
21820
|
-
if (!(steedosField.type === "color")) return [3 /*break*/,
|
|
21933
|
+
return [3 /*break*/, 17];
|
|
21934
|
+
case 11:
|
|
21935
|
+
if (!(steedosField.type === "color")) return [3 /*break*/, 12];
|
|
21821
21936
|
Object.assign(schema, {
|
|
21822
21937
|
"defaultColor": null
|
|
21823
21938
|
});
|
|
21824
|
-
return [3 /*break*/,
|
|
21825
|
-
case
|
|
21826
|
-
if (!(steedosField.type === "number")) return [3 /*break*/,
|
|
21939
|
+
return [3 /*break*/, 17];
|
|
21940
|
+
case 12:
|
|
21941
|
+
if (!(steedosField.type === "number")) return [3 /*break*/, 13];
|
|
21827
21942
|
// amis input-number和number组件中的precision表示小数位数,并不是魔方平台的精度概念,要转换下,否则小数点后会显示很多的0
|
|
21828
21943
|
Object.assign(schema, {
|
|
21829
21944
|
"precision": steedosField.scale || 0
|
|
21830
21945
|
});
|
|
21831
|
-
return [3 /*break*/,
|
|
21832
|
-
case
|
|
21833
|
-
if (!(steedosField.type === "table")) return [3 /*break*/,
|
|
21946
|
+
return [3 /*break*/, 17];
|
|
21947
|
+
case 13:
|
|
21948
|
+
if (!(steedosField.type === "table")) return [3 /*break*/, 14];
|
|
21834
21949
|
if (steedosField.subFields) {
|
|
21835
21950
|
tableFields = [];
|
|
21836
21951
|
try {
|
|
@@ -21863,9 +21978,9 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21863
21978
|
}
|
|
21864
21979
|
});
|
|
21865
21980
|
}
|
|
21866
|
-
return [3 /*break*/,
|
|
21867
|
-
case
|
|
21868
|
-
if (!(steedosField.type === "image")) return [3 /*break*/,
|
|
21981
|
+
return [3 /*break*/, 17];
|
|
21982
|
+
case 14:
|
|
21983
|
+
if (!(steedosField.type === "image")) return [3 /*break*/, 15];
|
|
21869
21984
|
Object.assign(schema, {
|
|
21870
21985
|
enlargeAble: true,
|
|
21871
21986
|
showToolbar: true,
|
|
@@ -21896,18 +22011,18 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21896
22011
|
return value;
|
|
21897
22012
|
}
|
|
21898
22013
|
});
|
|
21899
|
-
return [3 /*break*/,
|
|
21900
|
-
case
|
|
21901
|
-
if (!(steedosField.type === "file")) return [3 /*break*/,
|
|
22014
|
+
return [3 /*break*/, 17];
|
|
22015
|
+
case 15:
|
|
22016
|
+
if (!(steedosField.type === "file")) return [3 /*break*/, 17];
|
|
21902
22017
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
21903
|
-
case
|
|
22018
|
+
case 16:
|
|
21904
22019
|
// 附件static模式先保持原来的逻辑,依赖_display,审批王中相关功能在creator中
|
|
21905
22020
|
// convertSFieldToAmisField中会合并steedosField.amis,所以也不需要再次合并steedosField.amis,直接return就好
|
|
21906
|
-
return [2 /*return*/,
|
|
21907
|
-
case
|
|
22021
|
+
return [2 /*return*/, _l.sent()];
|
|
22022
|
+
case 17:
|
|
21908
22023
|
Object.assign(schema, steedosField.amis || {});
|
|
21909
22024
|
return [2 /*return*/, schema];
|
|
21910
|
-
case
|
|
22025
|
+
case 18:
|
|
21911
22026
|
fieldAmis = steedosField.amis || {};
|
|
21912
22027
|
if (!props.data.hasOwnProperty("_display")) {
|
|
21913
22028
|
// 有_display时保持原来的逻辑不变,不走以下新的逻辑,审批王中会特意传入_display以跳过后面新加的代码
|
|
@@ -21965,16 +22080,16 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21965
22080
|
}
|
|
21966
22081
|
}
|
|
21967
22082
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
21968
|
-
case
|
|
21969
|
-
schema =
|
|
22083
|
+
case 19:
|
|
22084
|
+
schema = _l.sent();
|
|
21970
22085
|
// console.log(`AmisSteedosField return schema`, schema)
|
|
21971
22086
|
return [2 /*return*/, schema];
|
|
21972
|
-
case
|
|
21973
|
-
case
|
|
21974
|
-
error_1 =
|
|
22087
|
+
case 20: return [3 /*break*/, 22];
|
|
22088
|
+
case 21:
|
|
22089
|
+
error_1 = _l.sent();
|
|
21975
22090
|
console.log("error", error_1);
|
|
21976
|
-
return [3 /*break*/,
|
|
21977
|
-
case
|
|
22091
|
+
return [3 /*break*/, 22];
|
|
22092
|
+
case 22: return [2 /*return*/, null];
|
|
21978
22093
|
}
|
|
21979
22094
|
});
|
|
21980
22095
|
}); };
|