@steedos-widgets/amis-object 1.3.21 → 1.3.22-beta.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/AmisInputTable.d.ts +0 -11
- package/dist/amis-object.cjs.css +3 -0
- package/dist/amis-object.cjs.js +178 -238
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +3 -0
- package/dist/amis-object.esm.js +178 -238
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +3 -0
- package/dist/amis-object.umd.js +43 -27
- 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.js
CHANGED
|
@@ -4903,21 +4903,21 @@ async function getQuickEditSchema(field, options){
|
|
|
4903
4903
|
break;
|
|
4904
4904
|
case "avatar":
|
|
4905
4905
|
case "image":
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4906
|
+
quickEditSchema.body[0].receiver.adaptor = `
|
|
4907
|
+
const { context } = api.body;
|
|
4908
|
+
var rootUrl = context.rootUrl + "/api/files/${field.type}s/";
|
|
4909
|
+
payload = {
|
|
4910
|
+
status: response.status == 200 ? 0 : response.status,
|
|
4911
|
+
msg: response.statusText,
|
|
4912
|
+
data: {
|
|
4913
|
+
value: rootUrl + payload._id,//为了实现图片crud的回显,需要将value从id改为url,当保存数据数据时,再在发送适配器内重新将id提取出来
|
|
4914
|
+
name: payload.original.name,
|
|
4915
|
+
url: rootUrl + payload._id,
|
|
4916
|
+
}
|
|
4916
4917
|
}
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
break;
|
|
4918
|
+
return payload;
|
|
4919
|
+
`;
|
|
4920
|
+
break;
|
|
4921
4921
|
}
|
|
4922
4922
|
quickEditSchema.body[0].visibleOn = "${quickedit_record_permissions.allowEdit && quickedit_record_permissions_loading == false}";
|
|
4923
4923
|
quickEditSchema.body.push({
|
|
@@ -5124,6 +5124,11 @@ async function getQuickEditSchema(field, options){
|
|
|
5124
5124
|
if(field.type == "location"){
|
|
5125
5125
|
quickEditSchema = false;
|
|
5126
5126
|
}
|
|
5127
|
+
if(field.type == "color"){
|
|
5128
|
+
quickEditSchema = {
|
|
5129
|
+
type: "input-color"
|
|
5130
|
+
};
|
|
5131
|
+
}
|
|
5127
5132
|
}
|
|
5128
5133
|
return quickEditSchema;
|
|
5129
5134
|
}
|
|
@@ -14675,6 +14680,13 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
14675
14680
|
};
|
|
14676
14681
|
if(readonly){
|
|
14677
14682
|
convertData.defaultColor = null;
|
|
14683
|
+
}else {
|
|
14684
|
+
convertData.pipeIn = (value, data) => {
|
|
14685
|
+
if(value && value.indexOf('#')<0){
|
|
14686
|
+
return '#'+value;
|
|
14687
|
+
}
|
|
14688
|
+
return value;
|
|
14689
|
+
};
|
|
14678
14690
|
}
|
|
14679
14691
|
break;
|
|
14680
14692
|
case 'boolean':
|
|
@@ -15530,7 +15542,7 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
15530
15542
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
15531
15543
|
* @Date: 2023-11-15 09:50:22
|
|
15532
15544
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
15533
|
-
* @LastEditTime: 2023-12-
|
|
15545
|
+
* @LastEditTime: 2023-12-19 15:53:32
|
|
15534
15546
|
*/
|
|
15535
15547
|
|
|
15536
15548
|
/**
|
|
@@ -15629,33 +15641,22 @@ function getFormPagination(props) {
|
|
|
15629
15641
|
let __paginationServiceId = event.data.__paginationServiceId;
|
|
15630
15642
|
let __wrapperServiceId = event.data.__wrapperServiceId;
|
|
15631
15643
|
let __formId = event.data.__formId;
|
|
15632
|
-
let fieldValue = event.data.
|
|
15644
|
+
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
15633
15645
|
let pageChangeDirection = context.props.pageChangeDirection;
|
|
15634
15646
|
let currentPage = event.data.__page;
|
|
15635
15647
|
let currentIndex = event.data.index;
|
|
15636
15648
|
|
|
15637
|
-
// 翻页到下一页之前需要先把当前页改动的内容保存到中间变量
|
|
15649
|
+
// 翻页到下一页之前需要先把当前页改动的内容保存到中间变量__tableItems中
|
|
15638
15650
|
let currentFormValues = scope.getComponentById(__formId).getValues();
|
|
15639
15651
|
fieldValue[currentIndex] = currentFormValues;
|
|
15640
|
-
//
|
|
15641
|
-
|
|
15642
|
-
|
|
15643
|
-
|
|
15644
|
-
|
|
15645
|
-
|
|
15646
|
-
|
|
15647
|
-
|
|
15648
|
-
// }
|
|
15649
|
-
// });
|
|
15650
|
-
// 如果翻页到下一页前需要同时把改动的内容保存到最终正式的表单字段中,需要额外给正式表单字段执行一次setValue
|
|
15651
|
-
// 但是同时保存到正式表单字段中会造成翻页后点击取消无法取消翻页之前的改动内容
|
|
15652
|
-
// doAction({
|
|
15653
|
-
// "componentId": "${props.id}",
|
|
15654
|
-
// "actionType": "setValue",
|
|
15655
|
-
// "args": {
|
|
15656
|
-
// "value": fieldValue
|
|
15657
|
-
// }
|
|
15658
|
-
// });
|
|
15652
|
+
// 翻页到下一页前需要同时把改动的内容保存到最终正式的表单字段中,所以额外给正式表单字段执行一次setValue
|
|
15653
|
+
doAction({
|
|
15654
|
+
"componentId": "${props.id}",
|
|
15655
|
+
"actionType": "setValue",
|
|
15656
|
+
"args": {
|
|
15657
|
+
"value": fieldValue
|
|
15658
|
+
}
|
|
15659
|
+
});
|
|
15659
15660
|
|
|
15660
15661
|
// 以下是翻页逻辑,翻到下一页并把下一页内容显示到表单上
|
|
15661
15662
|
let targetPage;
|
|
@@ -15666,7 +15667,7 @@ function getFormPagination(props) {
|
|
|
15666
15667
|
targetPage = currentPage - 1;
|
|
15667
15668
|
}
|
|
15668
15669
|
let targetIndex = targetPage - 1;//input-table组件行索引,从0开始的索引
|
|
15669
|
-
// let targetFormData =
|
|
15670
|
+
// let targetFormData = __tableItems[targetIndex];
|
|
15670
15671
|
doAction({
|
|
15671
15672
|
"actionType": "setValue",
|
|
15672
15673
|
"componentId": __paginationServiceId,
|
|
@@ -15746,16 +15747,11 @@ function getFormPagination(props) {
|
|
|
15746
15747
|
*/
|
|
15747
15748
|
function getFormPaginationWrapper(props, form, mode) {
|
|
15748
15749
|
let serviceId = `service_popup_pagination_wrapper__${props.id}`;
|
|
15749
|
-
// 这里加__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
|
|
15750
|
-
// 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
|
|
15751
|
-
// 只读的时候不可以走中间变量__changedItems,比如工作流规则详细页面修改了子表字段”时间触发器“值后,在只读界面点击查看按钮弹出的表单中__changedItems值是修改前的值
|
|
15752
|
-
let formValues = mode === "readonly" ? `\${${props.name}[__super.index]}` : "${__changedItems[__super.index]}";
|
|
15753
|
-
// 这时用__readonlyItemsLength是因为`\${${props.name}.length}`拿不到值
|
|
15754
|
-
let totalValue = mode === "readonly" ? "${__readonlyItemsLength}" : "${__changedItems.length}";
|
|
15755
15750
|
let innerForm = Object.assign({}, form, {
|
|
15756
15751
|
"data": {
|
|
15757
|
-
//
|
|
15758
|
-
|
|
15752
|
+
// 这里加__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
|
|
15753
|
+
// 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
|
|
15754
|
+
"&": "${__tableItems[__super.index]}"
|
|
15759
15755
|
}
|
|
15760
15756
|
});
|
|
15761
15757
|
let formBody = [
|
|
@@ -15778,47 +15774,43 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
15778
15774
|
}
|
|
15779
15775
|
];
|
|
15780
15776
|
let onServiceInitedScript = `
|
|
15781
|
-
//
|
|
15782
|
-
// inlineEditMode模式时,用户在表格单元格中直接修改数据,然后弹出的表单form中并没有包含单元格中修改的内容
|
|
15783
|
-
//
|
|
15777
|
+
// 以下脚本是为了解决有时弹出编辑表单时,表单中的值比最后一次编辑保存的值会延迟一拍。
|
|
15778
|
+
// 比如:inlineEditMode模式时,用户在表格单元格中直接修改数据,然后弹出的表单form中并没有包含单元格中修改的内容
|
|
15779
|
+
// 另外有的地方在非inlineEditMode模式时也会有这种延迟一拍问题,比如对象字段中下拉框类型字段的”选择项“属性
|
|
15780
|
+
// 再比如工作流规则详细页面修改了子表字段”时间触发器“值后,在只读界面点击查看按钮弹出的表单中__tableItems值是修改前的值
|
|
15781
|
+
// 处理思路是每次弹出form之前先把其__tableItems同步更新为最新值,这样就能在弹出form中包含单元格中做的修改
|
|
15784
15782
|
// 注意:service init事件只会在每次弹出窗口时才执行,在触发翻页时并不会触发service init事件
|
|
15785
|
-
let inlineEditMode = ${props.inlineEditMode};
|
|
15786
|
-
if(!inlineEditMode){
|
|
15787
|
-
return;
|
|
15788
|
-
}
|
|
15789
15783
|
let scope = event.context.scoped;
|
|
15790
15784
|
let __wrapperServiceId = event.data.__wrapperServiceId;
|
|
15791
15785
|
let wrapperService = scope.getComponentById(__wrapperServiceId);
|
|
15792
15786
|
let wrapperServiceData = wrapperService.getData();
|
|
15793
15787
|
let lastestFieldValue = wrapperServiceData["${props.name}"];//这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
15794
|
-
//不可以直接像event.data.
|
|
15795
|
-
event.data.
|
|
15796
|
-
event.data.
|
|
15788
|
+
//不可以直接像event.data.__tableItems = lastestFieldValue; 这样整个赋值,否则作用域会断
|
|
15789
|
+
event.data.__tableItems.forEach(function(n,i){
|
|
15790
|
+
event.data.__tableItems[i] = lastestFieldValue[i];
|
|
15797
15791
|
});
|
|
15798
15792
|
`;
|
|
15799
15793
|
let schema = {
|
|
15800
15794
|
"type": "service",
|
|
15801
15795
|
"id": serviceId,
|
|
15802
15796
|
"schemaApi": {
|
|
15803
|
-
"url": "${context.rootUrl}/graphql?rebuildOn=${index}",
|
|
15804
|
-
|
|
15805
|
-
"
|
|
15806
|
-
"
|
|
15807
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
15808
|
-
},
|
|
15809
|
-
"requestAdaptor": "api.data={query: '{spaces__findOne(id: \"none\"){_id,name}}'};return api;",
|
|
15797
|
+
// "url": "${context.rootUrl}/graphql?rebuildOn=${index}",
|
|
15798
|
+
"url": "${context.rootUrl}/api/v1/spaces/none",
|
|
15799
|
+
"trackExpression": "${index}",
|
|
15800
|
+
"method": "get",
|
|
15810
15801
|
"adaptor": `
|
|
15811
15802
|
const formBody = ${JSON.stringify(formBody)};
|
|
15812
15803
|
return {
|
|
15813
15804
|
"body": formBody
|
|
15814
15805
|
}
|
|
15815
|
-
|
|
15806
|
+
`,
|
|
15807
|
+
"cache": 600000
|
|
15816
15808
|
},
|
|
15817
15809
|
// "body": formBody,
|
|
15818
15810
|
"data": {
|
|
15819
15811
|
"__page": "${index + 1}",
|
|
15820
15812
|
// "__total": `\${${props.name}.length}`,
|
|
15821
|
-
"__total":
|
|
15813
|
+
"__total": "${__tableItems.length}",
|
|
15822
15814
|
"__paginationServiceId": serviceId,
|
|
15823
15815
|
"__formId": form.id
|
|
15824
15816
|
},
|
|
@@ -15840,13 +15832,15 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
15840
15832
|
* @param {*} props
|
|
15841
15833
|
* @param {*} mode edit/new/readonly
|
|
15842
15834
|
*/
|
|
15843
|
-
async function getForm(props, mode = "edit") {
|
|
15835
|
+
async function getForm(props, mode = "edit", formId) {
|
|
15844
15836
|
let formFields = getFormFields(props, mode);
|
|
15845
15837
|
let body = await getFormBody(null, formFields);
|
|
15846
|
-
|
|
15838
|
+
if(!formId){
|
|
15839
|
+
formId = `form_popup__${props.id}`;
|
|
15840
|
+
}
|
|
15847
15841
|
let schema = {
|
|
15848
15842
|
"type": "form",
|
|
15849
|
-
"id":
|
|
15843
|
+
"id": formId,
|
|
15850
15844
|
"title": "表单",
|
|
15851
15845
|
"debug": false,
|
|
15852
15846
|
"mode": "normal",
|
|
@@ -15858,8 +15852,7 @@ async function getForm(props, mode = "edit") {
|
|
|
15858
15852
|
if (mode === "edit") {
|
|
15859
15853
|
let onEditItemSubmitScript = `
|
|
15860
15854
|
// let fieldValue = _.cloneDeep(event.data["${props.name}"]);
|
|
15861
|
-
let fieldValue = event.data.
|
|
15862
|
-
|
|
15855
|
+
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
15863
15856
|
//这里加__super.__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
|
|
15864
15857
|
// 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
|
|
15865
15858
|
fieldValue[event.data.__super.__super.index] = JSON.parse(JSON.stringify(event.data));
|
|
@@ -15870,16 +15863,6 @@ async function getForm(props, mode = "edit") {
|
|
|
15870
15863
|
"value": fieldValue
|
|
15871
15864
|
}
|
|
15872
15865
|
});
|
|
15873
|
-
// // 因为翻页form中用的是event.data.changedItems中的数据,所以不需要像下面这样doAction setValue变更中间变量changedItems值
|
|
15874
|
-
// doAction({
|
|
15875
|
-
// "componentId": event.data.__wrapperServiceId,
|
|
15876
|
-
// "actionType": "setValue",
|
|
15877
|
-
// "args": {
|
|
15878
|
-
// "value": {
|
|
15879
|
-
// "__changedItems": fieldValue
|
|
15880
|
-
// }
|
|
15881
|
-
// }
|
|
15882
|
-
// });
|
|
15883
15866
|
`;
|
|
15884
15867
|
Object.assign(schema, {
|
|
15885
15868
|
"onEvent": {
|
|
@@ -15907,29 +15890,30 @@ async function getForm(props, mode = "edit") {
|
|
|
15907
15890
|
}
|
|
15908
15891
|
else if (mode === "new") {
|
|
15909
15892
|
let onNewItemSubmitScript = `
|
|
15910
|
-
|
|
15911
|
-
if(
|
|
15912
|
-
event.data.
|
|
15893
|
+
let newItem = JSON.parse(JSON.stringify(event.data));
|
|
15894
|
+
if(event.data["${props.name}"]){
|
|
15895
|
+
// let fieldValue = event.data.__tableItems;
|
|
15896
|
+
// 这里不用__tableItems是因为新建的时候没有翻页,里面没有也不需要走__tableItems变量
|
|
15897
|
+
let fieldValue = event.data["${props.name}"];
|
|
15898
|
+
fieldValue.push(newItem);
|
|
15899
|
+
doAction({
|
|
15900
|
+
"componentId": "${props.id}",
|
|
15901
|
+
"actionType": "setValue",
|
|
15902
|
+
"args": {
|
|
15903
|
+
"value": fieldValue
|
|
15904
|
+
}
|
|
15905
|
+
});
|
|
15906
|
+
}
|
|
15907
|
+
else{
|
|
15908
|
+
// 这里不可以执行event.data["${props.name}"]=[newItem],数据域会断掉
|
|
15909
|
+
doAction({
|
|
15910
|
+
"componentId": "${props.id}",
|
|
15911
|
+
"actionType": "setValue",
|
|
15912
|
+
"args": {
|
|
15913
|
+
"value": [newItem]
|
|
15914
|
+
}
|
|
15915
|
+
});
|
|
15913
15916
|
}
|
|
15914
|
-
let fieldValue = event.data.__changedItems;
|
|
15915
|
-
fieldValue.push(JSON.parse(JSON.stringify(event.data)));
|
|
15916
|
-
doAction({
|
|
15917
|
-
"componentId": "${props.id}",
|
|
15918
|
-
"actionType": "setValue",
|
|
15919
|
-
"args": {
|
|
15920
|
-
"value": fieldValue
|
|
15921
|
-
}
|
|
15922
|
-
});
|
|
15923
|
-
// // 因为翻页form中用的是event.data.changedItems中的数据,所以不需要像下面这样doAction setValue变更中间变量changedItems值
|
|
15924
|
-
// doAction({
|
|
15925
|
-
// "componentId": event.data.__wrapperServiceId,
|
|
15926
|
-
// "actionType": "setValue",
|
|
15927
|
-
// "args": {
|
|
15928
|
-
// "value": {
|
|
15929
|
-
// "__changedItems": fieldValue
|
|
15930
|
-
// }
|
|
15931
|
-
// }
|
|
15932
|
-
// });
|
|
15933
15917
|
`;
|
|
15934
15918
|
Object.assign(schema, {
|
|
15935
15919
|
"onEvent": {
|
|
@@ -15956,12 +15940,13 @@ async function getForm(props, mode = "edit") {
|
|
|
15956
15940
|
});
|
|
15957
15941
|
}
|
|
15958
15942
|
if (mode === "edit" || mode === "readonly") {
|
|
15959
|
-
schema = getFormPaginationWrapper(props, schema
|
|
15943
|
+
schema = getFormPaginationWrapper(props, schema);
|
|
15960
15944
|
}
|
|
15961
15945
|
return schema;
|
|
15962
15946
|
}
|
|
15963
15947
|
|
|
15964
15948
|
async function getButtonNew(props) {
|
|
15949
|
+
let formId = `form_popup__${props.id}`;
|
|
15965
15950
|
return {
|
|
15966
15951
|
"label": "新增",
|
|
15967
15952
|
"type": "button",
|
|
@@ -15975,14 +15960,28 @@ async function getButtonNew(props) {
|
|
|
15975
15960
|
"type": "dialog",
|
|
15976
15961
|
"title": "新增行",
|
|
15977
15962
|
"body": [
|
|
15978
|
-
await getForm(props, "new")
|
|
15963
|
+
await getForm(props, "new", formId)
|
|
15979
15964
|
],
|
|
15980
15965
|
"size": "lg",
|
|
15981
15966
|
"showCloseButton": true,
|
|
15982
15967
|
"showErrorMsg": true,
|
|
15983
15968
|
"showLoading": true,
|
|
15984
15969
|
"className": "app-popover",
|
|
15985
|
-
"closeOnEsc": false
|
|
15970
|
+
"closeOnEsc": false,
|
|
15971
|
+
"onEvent": {
|
|
15972
|
+
"confirm": {
|
|
15973
|
+
"actions": [
|
|
15974
|
+
{
|
|
15975
|
+
"actionType": "validate",
|
|
15976
|
+
"componentId": formId
|
|
15977
|
+
},
|
|
15978
|
+
{
|
|
15979
|
+
"preventDefault": true,
|
|
15980
|
+
"expression": "${event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
15981
|
+
}
|
|
15982
|
+
]
|
|
15983
|
+
}
|
|
15984
|
+
}
|
|
15986
15985
|
}
|
|
15987
15986
|
}
|
|
15988
15987
|
]
|
|
@@ -15993,27 +15992,7 @@ async function getButtonNew(props) {
|
|
|
15993
15992
|
}
|
|
15994
15993
|
|
|
15995
15994
|
async function getButtonEdit(props, showAsInlineEditMode) {
|
|
15996
|
-
let
|
|
15997
|
-
let scope = event.context.scoped;
|
|
15998
|
-
let __wrapperServiceId = event.data.__wrapperServiceId;
|
|
15999
|
-
let wrapperService = scope.getComponentById(__wrapperServiceId);
|
|
16000
|
-
let wrapperServiceData = wrapperService.getData();
|
|
16001
|
-
let originalFieldValue = wrapperServiceData["${props.name}"];//这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
16002
|
-
//不可以直接像event.data.__changedItems = originalFieldValue; 这样整个赋值,否则作用域会断,造成无法还原
|
|
16003
|
-
event.data.__changedItems.forEach(function(n,i){
|
|
16004
|
-
event.data.__changedItems[i] = originalFieldValue[i];
|
|
16005
|
-
});
|
|
16006
|
-
// 因为翻页form中用的是event.data.changedItems中的数据,所以像下面这样doAction setValue无法实现还原
|
|
16007
|
-
// doAction({
|
|
16008
|
-
// "componentId": __wrapperServiceId,
|
|
16009
|
-
// "actionType": "setValue",
|
|
16010
|
-
// "args": {
|
|
16011
|
-
// "value": {
|
|
16012
|
-
// "__changedItems": originalFieldValue
|
|
16013
|
-
// }
|
|
16014
|
-
// }
|
|
16015
|
-
// });
|
|
16016
|
-
`;
|
|
15995
|
+
let formId = `form_popup__${props.id}`;
|
|
16017
15996
|
return {
|
|
16018
15997
|
"type": "button",
|
|
16019
15998
|
"label": "",
|
|
@@ -16028,7 +16007,7 @@ async function getButtonEdit(props, showAsInlineEditMode) {
|
|
|
16028
16007
|
"type": "dialog",
|
|
16029
16008
|
"title": "编辑行",
|
|
16030
16009
|
"body": [
|
|
16031
|
-
await getForm(props, "edit")
|
|
16010
|
+
await getForm(props, "edit", formId)
|
|
16032
16011
|
],
|
|
16033
16012
|
"size": "lg",
|
|
16034
16013
|
"showCloseButton": true,
|
|
@@ -16037,7 +16016,7 @@ async function getButtonEdit(props, showAsInlineEditMode) {
|
|
|
16037
16016
|
"className": "app-popover",
|
|
16038
16017
|
"closeOnEsc": false,
|
|
16039
16018
|
"data": {
|
|
16040
|
-
// 这里必须加data数据映射,否则翻页功能中取
|
|
16019
|
+
// 这里必须加data数据映射,否则翻页功能中取__tableItems值时会乱,比如翻页编辑后会把上一页中没改过的字段值带过去
|
|
16041
16020
|
// 额外把华炎魔方主表记录ObjectForm中的字段值从record变量中映射到子表form中,因为子表lookup字段filtersFunction中可能依赖了主表记录中的字段值,比如“工作流规则”对象“时间触发器”字段中的“日期字段”字段
|
|
16042
16021
|
// 额外把global、uiSchema也映射过去,有可能要用,后续需要用到其他变更可以这里加映射
|
|
16043
16022
|
// "&": "${record || {}}",
|
|
@@ -16047,17 +16026,21 @@ async function getButtonEdit(props, showAsInlineEditMode) {
|
|
|
16047
16026
|
"global": "${global}",
|
|
16048
16027
|
"uiSchema": "${uiSchema}",
|
|
16049
16028
|
"index": "${index}",
|
|
16050
|
-
"
|
|
16029
|
+
"__tableItems": `\${${props.name}}`,
|
|
16051
16030
|
"__wrapperServiceId": "${__wrapperServiceId}"
|
|
16052
16031
|
},
|
|
16053
16032
|
"onEvent": {
|
|
16054
|
-
"
|
|
16055
|
-
|
|
16056
|
-
|
|
16057
|
-
|
|
16058
|
-
|
|
16059
|
-
|
|
16060
|
-
|
|
16033
|
+
"confirm": {
|
|
16034
|
+
"actions": [
|
|
16035
|
+
{
|
|
16036
|
+
"actionType": "validate",
|
|
16037
|
+
"componentId": formId
|
|
16038
|
+
},
|
|
16039
|
+
{
|
|
16040
|
+
"preventDefault": true,
|
|
16041
|
+
"expression": "${event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
16042
|
+
}
|
|
16043
|
+
]
|
|
16061
16044
|
}
|
|
16062
16045
|
}
|
|
16063
16046
|
}
|
|
@@ -16093,7 +16076,7 @@ async function getButtonView(props) {
|
|
|
16093
16076
|
"closeOnEsc": false,
|
|
16094
16077
|
"actions": [],
|
|
16095
16078
|
"data": {
|
|
16096
|
-
// 这里必须加data数据映射,否则翻页功能中取
|
|
16079
|
+
// 这里必须加data数据映射,否则翻页功能中取__tableItems值时会乱,比如翻页编辑后会把上一页中没改过的字段值带过去
|
|
16097
16080
|
// 额外把华炎魔方主表记录ObjectForm中的字段值从formData变量中映射到子表form中,因为子表lookup字段filtersFunction中可能依赖了主表记录中的字段值,比如“工作流规则”对象“时间触发器”字段中的“日期字段”字段
|
|
16098
16081
|
// global、uiSchema等常用变量本来就在formData变量已经存在了,无需另外映射
|
|
16099
16082
|
// "&": "${formData || {}}",
|
|
@@ -16101,9 +16084,8 @@ async function getButtonView(props) {
|
|
|
16101
16084
|
// 映射到中间变量__parentForm而不是直接用&展开映射是为了避免表单中字段名与作用域中变量重名
|
|
16102
16085
|
"__parentForm": "${__super.__super || {}}",
|
|
16103
16086
|
"index": "${index}",
|
|
16104
|
-
"
|
|
16105
|
-
"__wrapperServiceId": "${__wrapperServiceId}"
|
|
16106
|
-
"__readonlyItemsLength": `\${${props.name}.length}`
|
|
16087
|
+
"__tableItems": `\${${props.name}}`,
|
|
16088
|
+
"__wrapperServiceId": "${__wrapperServiceId}"
|
|
16107
16089
|
}
|
|
16108
16090
|
}
|
|
16109
16091
|
}
|
|
@@ -16115,30 +16097,20 @@ async function getButtonView(props) {
|
|
|
16115
16097
|
|
|
16116
16098
|
function getButtonDelete(props) {
|
|
16117
16099
|
let onDeleteItemScript = `
|
|
16118
|
-
// let fieldValue =
|
|
16119
|
-
|
|
16120
|
-
|
|
16121
|
-
|
|
16122
|
-
let
|
|
16123
|
-
|
|
16124
|
-
|
|
16100
|
+
// let fieldValue = event.data["${props.name}"];
|
|
16101
|
+
let scope = event.context.scoped;
|
|
16102
|
+
let __wrapperServiceId = event.data.__wrapperServiceId;
|
|
16103
|
+
let wrapperService = scope.getComponentById(__wrapperServiceId);
|
|
16104
|
+
let wrapperServiceData = wrapperService.getData();
|
|
16105
|
+
let lastestFieldValue = wrapperServiceData["${props.name}"];//这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
16106
|
+
lastestFieldValue.splice(event.data.index, 1);
|
|
16125
16107
|
doAction({
|
|
16126
16108
|
"componentId": "${props.id}",
|
|
16127
16109
|
"actionType": "setValue",
|
|
16128
16110
|
"args": {
|
|
16129
|
-
"value":
|
|
16111
|
+
"value": lastestFieldValue
|
|
16130
16112
|
}
|
|
16131
16113
|
});
|
|
16132
|
-
// // 因为翻页form中用的是event.data.changedItems中的数据,所以不需要像下面这样doAction setValue变更中间变量changedItems值
|
|
16133
|
-
// doAction({
|
|
16134
|
-
// "componentId": event.data.__wrapperServiceId,
|
|
16135
|
-
// "actionType": "setValue",
|
|
16136
|
-
// "args": {
|
|
16137
|
-
// "value": {
|
|
16138
|
-
// "__changedItems": fieldValue
|
|
16139
|
-
// }
|
|
16140
|
-
// }
|
|
16141
|
-
// });
|
|
16142
16114
|
`;
|
|
16143
16115
|
return {
|
|
16144
16116
|
"type": "button",
|
|
@@ -16176,13 +16148,15 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
16176
16148
|
if (props.editable) {
|
|
16177
16149
|
let showEditButton = true;
|
|
16178
16150
|
if (showAsInlineEditMode) {
|
|
16179
|
-
//
|
|
16180
|
-
|
|
16181
|
-
|
|
16182
|
-
|
|
16183
|
-
|
|
16184
|
-
|
|
16185
|
-
|
|
16151
|
+
// 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
|
|
16152
|
+
showEditButton = true;
|
|
16153
|
+
// // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
|
|
16154
|
+
// if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length) {
|
|
16155
|
+
// showEditButton = true;
|
|
16156
|
+
// }
|
|
16157
|
+
// else {
|
|
16158
|
+
// showEditButton = false;
|
|
16159
|
+
// }
|
|
16186
16160
|
}
|
|
16187
16161
|
// 编辑时显示编辑按钮
|
|
16188
16162
|
if (showEditButton) {
|
|
@@ -16192,11 +16166,9 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
16192
16166
|
}
|
|
16193
16167
|
else {
|
|
16194
16168
|
// 只读时显示查看按钮
|
|
16195
|
-
if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length)
|
|
16196
|
-
|
|
16197
|
-
|
|
16198
|
-
buttonsForColumnOperations.push(buttonViewSchema);
|
|
16199
|
-
}
|
|
16169
|
+
// 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length)
|
|
16170
|
+
let buttonViewSchema = await getButtonView(props);
|
|
16171
|
+
buttonsForColumnOperations.push(buttonViewSchema);
|
|
16200
16172
|
}
|
|
16201
16173
|
if (props.removable) {
|
|
16202
16174
|
let buttonDeleteSchema = getButtonDelete(props);
|
|
@@ -16232,85 +16204,53 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
16232
16204
|
if (showAsInlineEditMode) {
|
|
16233
16205
|
inputTableSchema.needConfirm = false;
|
|
16234
16206
|
}
|
|
16235
|
-
let dataProviderInited = `
|
|
16236
|
-
// 单独维护一份中间变量changedItems,因为原变量在input-table组件有单独的作用域,翻页功能中无法维护此作用域中的行记录值
|
|
16237
|
-
setData({ __changedItems: _.cloneDeep(data["${props.name}"]) || []});
|
|
16238
|
-
`;
|
|
16239
|
-
let onInitScript = `
|
|
16240
|
-
// 上面dataProviderInited中setData有时不生效,没有成功给service组件设置__changedItems变量值
|
|
16241
|
-
// 比如设计字段布局界面中的设置分组功能就因为__changedItems变量值不存在而报错,应该是因为把steedos-input-table组件单独放到弹出窗口中会有这个问题
|
|
16242
|
-
// 所以额外在service init事件中手动设置一次__changedItems值
|
|
16243
|
-
let __wrapperServiceId = event.data.__wrapperServiceId;
|
|
16244
|
-
let fieldValue = _.cloneDeep(event.data["${props.name}"]) || [];
|
|
16245
|
-
doAction({
|
|
16246
|
-
"componentId": __wrapperServiceId,
|
|
16247
|
-
"actionType": "setValue",
|
|
16248
|
-
"args": {
|
|
16249
|
-
"value": {
|
|
16250
|
-
"__changedItems": fieldValue
|
|
16251
|
-
}
|
|
16252
|
-
}
|
|
16253
|
-
});
|
|
16254
|
-
// 下面的doAction好像不是必须的
|
|
16255
|
-
// doAction({
|
|
16256
|
-
// "componentId": "${props.id}",
|
|
16257
|
-
// "actionType": "setValue",
|
|
16258
|
-
// "args": {
|
|
16259
|
-
// "value": fieldValue
|
|
16260
|
-
// }
|
|
16261
|
-
// });
|
|
16262
|
-
`;
|
|
16263
|
-
let schema = {
|
|
16264
|
-
"type": "service",
|
|
16265
|
-
"body": [
|
|
16266
|
-
inputTableSchema
|
|
16267
|
-
],
|
|
16268
|
-
"className": props.className,
|
|
16269
|
-
"id": serviceId,
|
|
16270
|
-
"data": {
|
|
16271
|
-
"__wrapperServiceId": serviceId
|
|
16272
|
-
},
|
|
16273
|
-
"dataProvider": {
|
|
16274
|
-
"inited": dataProviderInited
|
|
16275
|
-
},
|
|
16276
|
-
"onEvent": {
|
|
16277
|
-
"init": {
|
|
16278
|
-
"actions": [
|
|
16279
|
-
{
|
|
16280
|
-
"actionType": "custom",
|
|
16281
|
-
"script": onInitScript
|
|
16282
|
-
}
|
|
16283
|
-
]
|
|
16284
|
-
}
|
|
16285
|
-
}
|
|
16286
|
-
};
|
|
16287
|
-
let footerToolbar = clone(props.footerToolbar || []); //这里不clone的话,会造成死循环,应该是因为props属性变更会让组件重新渲染
|
|
16288
|
-
if (props.addable) {
|
|
16289
|
-
let buttonNewSchema = await getButtonNew(props);
|
|
16290
|
-
footerToolbar.unshift(buttonNewSchema);
|
|
16291
|
-
}
|
|
16292
|
-
if (footerToolbar.length) {
|
|
16293
|
-
schema.body.push({
|
|
16294
|
-
"type": "wrapper",
|
|
16295
|
-
"size": "none",
|
|
16296
|
-
"body": footerToolbar
|
|
16297
|
-
});
|
|
16298
|
-
}
|
|
16299
16207
|
let amis = props["input-table"] || props.amis;//额外支持"input-table"代替amis属性,是因为在字段yml文件中用amis作为key不好理解
|
|
16300
16208
|
if (amis) {
|
|
16301
16209
|
// 支持配置amis属性重写或添加最终生成的input-table中任何属性。
|
|
16302
16210
|
delete amis.id;//如果steedos-input-table组件配置了amis.id属性,会造成新建编辑行功能不生效
|
|
16303
|
-
Object.assign(
|
|
16211
|
+
Object.assign(inputTableSchema, amis);
|
|
16304
16212
|
}
|
|
16305
16213
|
const isAnyFieldHasDependOn = (props.fields || []).find(function (item) {
|
|
16306
16214
|
return item.depend_on;
|
|
16307
16215
|
});
|
|
16308
|
-
if(isAnyFieldHasDependOn){
|
|
16216
|
+
if (isAnyFieldHasDependOn) {
|
|
16309
16217
|
// 有任意一个子字段有depend_on属性时,强制设置禁用静态模式
|
|
16310
|
-
Object.assign(
|
|
16218
|
+
Object.assign(inputTableSchema, {
|
|
16311
16219
|
strictMode: false
|
|
16312
16220
|
});
|
|
16313
16221
|
}
|
|
16222
|
+
let schemaBody = [inputTableSchema];
|
|
16223
|
+
let footerToolbar = clone(props.footerToolbar || []); //这里不clone的话,会造成死循环,应该是因为props属性变更会让组件重新渲染
|
|
16224
|
+
if (props.addable) {
|
|
16225
|
+
let buttonNewSchema = await getButtonNew(props);
|
|
16226
|
+
footerToolbar.unshift(buttonNewSchema);
|
|
16227
|
+
}
|
|
16228
|
+
if (footerToolbar.length) {
|
|
16229
|
+
schemaBody.push({
|
|
16230
|
+
"type": "wrapper",
|
|
16231
|
+
"size": "none",
|
|
16232
|
+
"body": footerToolbar
|
|
16233
|
+
});
|
|
16234
|
+
}
|
|
16235
|
+
// 不可以直接把headerToolbar unshift进schemaBody,因为它没有显示在label下面,而是显示在上面了,这没有意义
|
|
16236
|
+
// 看起来amis官方后续会支持给input-table组件配置headerToolbar,见:https://github.com/baidu/amis/issues/7246
|
|
16237
|
+
// let headerToolbar = clone(props.headerToolbar || []); //这里不clone的话,会造成死循环,应该是因为props属性变更会让组件重新渲染
|
|
16238
|
+
// if (headerToolbar.length) {
|
|
16239
|
+
// schemaBody.unshift({
|
|
16240
|
+
// "type": "wrapper",
|
|
16241
|
+
// "size": "none",
|
|
16242
|
+
// "body": headerToolbar
|
|
16243
|
+
// });
|
|
16244
|
+
// }
|
|
16245
|
+
let schema = {
|
|
16246
|
+
"type": "service",
|
|
16247
|
+
"body": schemaBody,
|
|
16248
|
+
"className": props.className,
|
|
16249
|
+
"id": serviceId,
|
|
16250
|
+
"data": {
|
|
16251
|
+
"__wrapperServiceId": serviceId
|
|
16252
|
+
}
|
|
16253
|
+
};
|
|
16314
16254
|
// console.log("===schema===", schema);
|
|
16315
16255
|
return schema;
|
|
16316
16256
|
};
|
|
@@ -20574,7 +20514,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
20574
20514
|
schemaApi: {
|
|
20575
20515
|
"method": "get",
|
|
20576
20516
|
"url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
|
|
20577
|
-
"adaptor": "\n try {\n // console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"").concat(data.tabId, "\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n })\n })\n } else {\n var tabGroup = _.find(tab_groups, {\"group_name\": groupName});\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": tabGroup && tabGroup.default_open != false,\n \"isGroup\": true,\n \"children\": _.sortBy(_.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n }\n }),(tab) => {return tab.index})\n }) \n }\n });\n \n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n });\n })\n }\n //\u4EE5\u4E0B\u4E3Anav\u7B2C\u4E00\u5C42\u6392\u5E8F\uFF0C\u5305\u62EC\u5206\u7EC4\u4E0E\u9009\u9879\u5361\n // let groupLength = ((payload.tab_groups && payload.tab_groups.length) || 0) + 1000;\n data.nav = _.sortBy(data.nav, function(tab){\n if(tab.isGroup){\n return _.findIndex(payload.tab_groups, function(group){\n return group.group_name === tab.label;\n });\n }else{\n // \u6CA1\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u6309index\u6392\u5217\u5728\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u524D\u65B9\n return (tab.index || 0) - 1000;\n }\n })\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n // console.log('payload===2==>', payload)\n return payload;\n "),
|
|
20517
|
+
"adaptor": "\n try {\n // console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"").concat(data.tabId, "\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n })\n })\n } else {\n var tabGroup = _.find(tab_groups, {\"group_name\": groupName});\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": tabGroup && tabGroup.default_open != false,\n \"isGroup\": true,\n \"children\": _.sortBy(_.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n }\n }),(tab) => {return tab.index})\n }) \n }\n });\n \n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n });\n })\n }\n //\u4EE5\u4E0B\u4E3Anav\u7B2C\u4E00\u5C42\u6392\u5E8F\uFF0C\u5305\u62EC\u5206\u7EC4\u4E0E\u9009\u9879\u5361\n // let groupLength = ((payload.tab_groups && payload.tab_groups.length) || 0) + 1000;\n data.nav = _.sortBy(data.nav, function(tab){\n if(tab.isGroup){\n return _.findIndex(payload.tab_groups, function(group){\n return group.group_name === tab.label;\n });\n }else{\n // \u6CA1\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u6309index\u6392\u5217\u5728\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u524D\u65B9\n return (tab.index || 0) - 1000;\n }\n })\n const badgeText = \"${IF(").concat(appId, " == 'approve_workflow',${ss:keyvalues.badge.value|pick:'workflow'},${ss:keyvalues.badge.value|pick:").concat(appId, "}) | toInt}\";\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n //\u5DE6\u5C42\u663E\u793A\u65F6\u5BA1\u6279\u5355\u663E\u793Abadge\u6570\u91CF\n \"itemBadge\": stacked?{\n \"mode\": \"text\",\n \"text\": badgeText,\n \"visibleOn\": \"${id == 'instances'}\",\n \"overflowCount\": 99,\n \"style\": {\n \"right\": \"20%\",\n \"margin-right\": \"-23px\",\n \"height\": \"20px\",\n \"border-radius\": \"10px\",\n \"font-size\": \"16px\",\n \"line-height\": \"18px\",\n \"top\": \"50%\"\n }\n }:\"\",\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n // console.log('payload===2==>', payload)\n return payload;\n "),
|
|
20578
20518
|
"headers": {
|
|
20579
20519
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
20580
20520
|
}
|
|
@@ -21762,7 +21702,7 @@ var AmisInputTable = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
21762
21702
|
return __generator(this, function (_a) {
|
|
21763
21703
|
switch (_a.label) {
|
|
21764
21704
|
case 0:
|
|
21765
|
-
props.$schema, props.fields, props.name, props.id, props.data, props.columns, props.amis, props.className, props.tableClassName, props.footerToolbar, props.inlineEditMode, props.strictMode;
|
|
21705
|
+
props.$schema, props.fields, props.name, props.id, props.data, props.columns, props.amis, props.className, props.tableClassName, props.headerToolbar, props.footerToolbar, props.inlineEditMode, props.strictMode;
|
|
21766
21706
|
return [4 /*yield*/, getAmisInputTableSchema(props)];
|
|
21767
21707
|
case 1:
|
|
21768
21708
|
amisSchema = _a.sent();
|