@steedos-widgets/amis-lib 6.10.2-beta.3 → 6.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +142 -68
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +142 -68
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +225 -211
- package/dist/index.umd.js.map +1 -1
- package/dist/types/workflow/approve.d.ts +0 -15
- package/dist/types/workflow/flow.d.ts +12 -33
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -19353,23 +19353,23 @@ const getApprovalDrawerSchema = async (instance, submitEvents) => {
|
|
|
19353
19353
|
// }
|
|
19354
19354
|
// ]
|
|
19355
19355
|
// },
|
|
19356
|
-
validateError: {
|
|
19357
|
-
|
|
19358
|
-
|
|
19359
|
-
|
|
19360
|
-
|
|
19361
|
-
|
|
19362
|
-
|
|
19363
|
-
|
|
19364
|
-
|
|
19365
|
-
|
|
19366
|
-
|
|
19367
|
-
|
|
19368
|
-
|
|
19369
|
-
|
|
19370
|
-
|
|
19371
|
-
|
|
19372
|
-
}
|
|
19356
|
+
// validateError: {
|
|
19357
|
+
// weight: 0,
|
|
19358
|
+
// actions: [
|
|
19359
|
+
// {
|
|
19360
|
+
// "componentId": "",
|
|
19361
|
+
// "args": {
|
|
19362
|
+
// "msgType": "info",
|
|
19363
|
+
// "position": "top-right",
|
|
19364
|
+
// "closeButton": true,
|
|
19365
|
+
// "showIcon": true,
|
|
19366
|
+
// "title": i18next.t('frontend_workflow_submit_validate_error_title'),//"提交失败",
|
|
19367
|
+
// "msg": i18next.t('frontend_workflow_submit_validate_error_msg'),//"请填写必填字段"
|
|
19368
|
+
// },
|
|
19369
|
+
// "actionType": "toast"
|
|
19370
|
+
// }
|
|
19371
|
+
// ],
|
|
19372
|
+
// }
|
|
19373
19373
|
},
|
|
19374
19374
|
|
|
19375
19375
|
},
|
|
@@ -19604,7 +19604,7 @@ const getRelatedInstances = async (instance)=>{
|
|
|
19604
19604
|
* @Author: baozhoutao@steedos.com
|
|
19605
19605
|
* @Date: 2022-09-24 16:48:28
|
|
19606
19606
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
19607
|
-
* @LastEditTime: 2025-
|
|
19607
|
+
* @LastEditTime: 2025-11-03 11:16:43
|
|
19608
19608
|
* @Description:
|
|
19609
19609
|
*/
|
|
19610
19610
|
|
|
@@ -19628,19 +19628,19 @@ const getInstanceApprovalHistory = async ()=>{
|
|
|
19628
19628
|
"name": "user_name",
|
|
19629
19629
|
"label": "user_name",
|
|
19630
19630
|
"type": "tpl",
|
|
19631
|
-
"tpl": "<div><div>${opinion}</div>${user_name}</div>"
|
|
19631
|
+
"tpl": "<div><div>${opinion}</div>${user_name|raw}</div>"
|
|
19632
19632
|
},
|
|
19633
19633
|
{
|
|
19634
19634
|
"name": "finish_date",
|
|
19635
19635
|
"label": "finish_date",
|
|
19636
|
-
"classNameExpr":
|
|
19636
|
+
"classNameExpr": `<%= data.finish_date == '${amisLib.i18next.t('frontend_workflow_approval_history_read')}' ? 'text-[blue]' : (data.finish_date == '${amisLib.i18next.t('frontend_workflow_approval_history_unprocessed')}' ? 'text-[red]' : '') %>`
|
|
19637
19637
|
// "type": "datetime",
|
|
19638
19638
|
// "format": "YYYY-MM-DD HH:mm"
|
|
19639
19639
|
},
|
|
19640
19640
|
{
|
|
19641
19641
|
"name": "judge",
|
|
19642
19642
|
"label": "judge",
|
|
19643
|
-
"classNameExpr":
|
|
19643
|
+
"classNameExpr": `<%= data.judge == '${amisLib.i18next.t('frontend_workflow_approval_judge_approved')}' ? 'text-green-600' : (data.judge == '${amisLib.i18next.t('frontend_workflow_approval_judge_rejected')}' ? 'text-[red]' : '') %>`
|
|
19644
19644
|
}
|
|
19645
19645
|
]
|
|
19646
19646
|
}
|
|
@@ -19650,7 +19650,7 @@ const getInstanceApprovalHistory = async ()=>{
|
|
|
19650
19650
|
* @Author: baozhoutao@steedos.com
|
|
19651
19651
|
* @Date: 2022-09-07 16:20:45
|
|
19652
19652
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
19653
|
-
* @LastEditTime: 2025-
|
|
19653
|
+
* @LastEditTime: 2025-10-30 13:40:31
|
|
19654
19654
|
* @Description:
|
|
19655
19655
|
*/
|
|
19656
19656
|
|
|
@@ -20480,11 +20480,54 @@ const getApproveButton = async (instance, submitEvents)=>{
|
|
|
20480
20480
|
},
|
|
20481
20481
|
id: "steedos-approve-button",
|
|
20482
20482
|
level: "primary",
|
|
20483
|
-
className:
|
|
20484
|
-
"approve-button w-14 h-14 rounded-full fixed bottom-4 right-4 shadow-lg text-white text-base text-center font-semibold bg-blue-500 p-0",
|
|
20483
|
+
className: {
|
|
20484
|
+
"approve-button w-14 h-14 rounded-full fixed bottom-4 right-4 shadow-lg text-white text-base text-center font-semibold bg-blue-500 p-0": true,
|
|
20485
|
+
"hidden": instance.box === 'draft'
|
|
20486
|
+
}
|
|
20485
20487
|
}
|
|
20486
20488
|
};
|
|
20487
20489
|
|
|
20490
|
+
const getScrollToBottomAutoOpenApproveDrawerScript = () => {
|
|
20491
|
+
return `
|
|
20492
|
+
(function () {
|
|
20493
|
+
setTimeout(function () {
|
|
20494
|
+
var bodyEl = document.querySelector('.steedos-amis-instance-view-body');
|
|
20495
|
+
if (!bodyEl) return;
|
|
20496
|
+
var btn = document.querySelector('.approve-button');
|
|
20497
|
+
if (!btn) return;
|
|
20498
|
+
|
|
20499
|
+
var lastAtBottom = false; // 上一个scroll事件是否到底
|
|
20500
|
+
|
|
20501
|
+
function isAtBottom() {
|
|
20502
|
+
var scrollTop = bodyEl.scrollTop,
|
|
20503
|
+
scrollHeight = bodyEl.scrollHeight,
|
|
20504
|
+
clientHeight = bodyEl.clientHeight;
|
|
20505
|
+
return (scrollHeight <= clientHeight) || (scrollTop + clientHeight >= scrollHeight - 2);
|
|
20506
|
+
}
|
|
20507
|
+
|
|
20508
|
+
// wheel: 只要现在到底、且是向下滚,即可弹出
|
|
20509
|
+
bodyEl.addEventListener('wheel', function (e) {
|
|
20510
|
+
var atBottom = isAtBottom();
|
|
20511
|
+
if (atBottom && e.deltaY > 0) {
|
|
20512
|
+
// [wheel] 拖动条在底部且向下滚,弹drawer
|
|
20513
|
+
btn.click();
|
|
20514
|
+
}
|
|
20515
|
+
});
|
|
20516
|
+
|
|
20517
|
+
// scroll: 拖动时仅“从非底部->底部”瞬间弹
|
|
20518
|
+
bodyEl.addEventListener('scroll', function () {
|
|
20519
|
+
var atBottom = isAtBottom();
|
|
20520
|
+
if (!lastAtBottom && atBottom) {
|
|
20521
|
+
// [scroll] 拖动条到底,弹drawer
|
|
20522
|
+
btn.click();
|
|
20523
|
+
}
|
|
20524
|
+
lastAtBottom = atBottom;
|
|
20525
|
+
});
|
|
20526
|
+
}, 1000);
|
|
20527
|
+
})();
|
|
20528
|
+
`;
|
|
20529
|
+
};
|
|
20530
|
+
|
|
20488
20531
|
const getFlowFormSchema = async (instance, box) => {
|
|
20489
20532
|
const formStyle = instance.form.current.style || "table";
|
|
20490
20533
|
let formContentSchema;
|
|
@@ -20503,9 +20546,17 @@ const getFlowFormSchema = async (instance, box) => {
|
|
|
20503
20546
|
|
|
20504
20547
|
if(amisSchemaStr){
|
|
20505
20548
|
const onEvent = JSON.parse(instance.formVersion.amis_schema).onEvent;
|
|
20506
|
-
initedEvents = onEvent
|
|
20507
|
-
changeEvents = onEvent
|
|
20508
|
-
submitEvents = onEvent
|
|
20549
|
+
initedEvents = onEvent?.inited.actions || [];
|
|
20550
|
+
changeEvents = onEvent?.change.actions || [];
|
|
20551
|
+
submitEvents = onEvent?.submit.actions || [];
|
|
20552
|
+
}
|
|
20553
|
+
if (box == 'inbox' || box == 'draft') {
|
|
20554
|
+
// 滚动条滚动到底部弹出底部签批drawer窗口
|
|
20555
|
+
initedEvents.push({
|
|
20556
|
+
"actionType": "custom",
|
|
20557
|
+
"script": getScrollToBottomAutoOpenApproveDrawerScript(),
|
|
20558
|
+
"args": {}
|
|
20559
|
+
});
|
|
20509
20560
|
}
|
|
20510
20561
|
|
|
20511
20562
|
console.log('getFlowFormSchema formContentSchema', formContentSchema);
|
|
@@ -20588,23 +20639,23 @@ const getFlowFormSchema = async (instance, box) => {
|
|
|
20588
20639
|
],
|
|
20589
20640
|
id: "instance_form",
|
|
20590
20641
|
onEvent: {
|
|
20591
|
-
validateError: {
|
|
20592
|
-
|
|
20593
|
-
|
|
20594
|
-
|
|
20595
|
-
|
|
20596
|
-
|
|
20597
|
-
|
|
20598
|
-
|
|
20599
|
-
|
|
20600
|
-
|
|
20601
|
-
|
|
20602
|
-
|
|
20603
|
-
|
|
20604
|
-
|
|
20605
|
-
|
|
20606
|
-
|
|
20607
|
-
},
|
|
20642
|
+
// validateError: {
|
|
20643
|
+
// weight: 0,
|
|
20644
|
+
// actions: [
|
|
20645
|
+
// {
|
|
20646
|
+
// "componentId": "",
|
|
20647
|
+
// "args": {
|
|
20648
|
+
// "msgType": "info",
|
|
20649
|
+
// "position": "top-right",
|
|
20650
|
+
// "closeButton": true,
|
|
20651
|
+
// "showIcon": true,
|
|
20652
|
+
// "title": i18next.t('frontend_workflow_submit_validate_error_title'),//"提交失败",
|
|
20653
|
+
// "msg": i18next.t('frontend_workflow_submit_validate_error_msg'),//"请填写必填字段"
|
|
20654
|
+
// },
|
|
20655
|
+
// "actionType": "toast"
|
|
20656
|
+
// }
|
|
20657
|
+
// ],
|
|
20658
|
+
// },
|
|
20608
20659
|
change: {
|
|
20609
20660
|
weight: 0,
|
|
20610
20661
|
actions: [
|
|
@@ -20622,7 +20673,7 @@ const getFlowFormSchema = async (instance, box) => {
|
|
|
20622
20673
|
await getInstanceApprovalHistory(),
|
|
20623
20674
|
await getApproveButton(instance, submitEvents)
|
|
20624
20675
|
],
|
|
20625
|
-
id: "u:
|
|
20676
|
+
id: "u:instancePage",
|
|
20626
20677
|
messages: {},
|
|
20627
20678
|
pullRefresh: {},
|
|
20628
20679
|
regions: [
|
|
@@ -20633,6 +20684,11 @@ const getFlowFormSchema = async (instance, box) => {
|
|
|
20633
20684
|
"@data.@instanceDetail.changed": {
|
|
20634
20685
|
actions: [
|
|
20635
20686
|
{
|
|
20687
|
+
actionType: "custom",
|
|
20688
|
+
script:"debugger;",
|
|
20689
|
+
},
|
|
20690
|
+
{
|
|
20691
|
+
componentId:"u:instancePage",
|
|
20636
20692
|
actionType: "reload"
|
|
20637
20693
|
}
|
|
20638
20694
|
]
|
|
@@ -20649,22 +20705,7 @@ const getFlowFormSchema = async (instance, box) => {
|
|
|
20649
20705
|
},
|
|
20650
20706
|
...initedEvents
|
|
20651
20707
|
]
|
|
20652
|
-
}
|
|
20653
|
-
// inited: {
|
|
20654
|
-
// weight: 0,
|
|
20655
|
-
// actions: [
|
|
20656
|
-
// // {
|
|
20657
|
-
// // componentId: "steedos-approve-button",
|
|
20658
|
-
// // actionType: "click",
|
|
20659
|
-
// // },
|
|
20660
|
-
// // {
|
|
20661
|
-
// // "componentId": "",
|
|
20662
|
-
// // "args": {},
|
|
20663
|
-
// // "actionType": "drawer",
|
|
20664
|
-
// // "drawer": await getApprovalDrawerSchema()
|
|
20665
|
-
// // }
|
|
20666
|
-
// ],
|
|
20667
|
-
// }
|
|
20708
|
+
}
|
|
20668
20709
|
},
|
|
20669
20710
|
initApi:{
|
|
20670
20711
|
"url": "${context.rootUrl}/graphql",
|
|
@@ -20696,8 +20737,6 @@ const getFlowFormSchema = async (instance, box) => {
|
|
|
20696
20737
|
return payload;
|
|
20697
20738
|
`,
|
|
20698
20739
|
"data": {
|
|
20699
|
-
// "&": "$$",
|
|
20700
|
-
// "context": "${context}",
|
|
20701
20740
|
"judge": "${new_judge}",
|
|
20702
20741
|
}
|
|
20703
20742
|
},
|
|
@@ -20778,7 +20817,7 @@ const getOpinionFieldStepsName = (field, top_keywords) => {
|
|
|
20778
20817
|
* @Author: baozhoutao@steedos.com
|
|
20779
20818
|
* @Date: 2022-09-09 17:47:37
|
|
20780
20819
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
20781
|
-
* @LastEditTime: 2025-
|
|
20820
|
+
* @LastEditTime: 2025-11-03 15:17:50
|
|
20782
20821
|
* @Description:
|
|
20783
20822
|
*/
|
|
20784
20823
|
|
|
@@ -20927,6 +20966,26 @@ const isCurrentStepOpinionField = (field, currentStep)=>{
|
|
|
20927
20966
|
return ___default["default"].includes(___default["default"].map(getOpinionFieldStepsName(field), 'stepName'), currentStep?.name);
|
|
20928
20967
|
};
|
|
20929
20968
|
|
|
20969
|
+
const isNeedToShowSignImage = (is_finished, judge, traceShowSignImage) => {
|
|
20970
|
+
if (traceShowSignImage === false) {
|
|
20971
|
+
return false;
|
|
20972
|
+
}
|
|
20973
|
+
if (!is_finished) {
|
|
20974
|
+
return false;
|
|
20975
|
+
}
|
|
20976
|
+
if (['returned', 'terminated', 'retrieved'].includes(judge)) {
|
|
20977
|
+
return false;
|
|
20978
|
+
}
|
|
20979
|
+
return true;
|
|
20980
|
+
};
|
|
20981
|
+
|
|
20982
|
+
const getSpaceUserSign = async (space, handler) => {
|
|
20983
|
+
const result = await amisLib.fetchAPI(`/api/v1/space_user_signs?filters=[["space","=","${space}"],["user","=","${handler}"]]&fields=["sign"]`);
|
|
20984
|
+
if (result?.data?.items && result.data.items.length > 0) {
|
|
20985
|
+
return result.data.items[0].sign;
|
|
20986
|
+
}
|
|
20987
|
+
return null;
|
|
20988
|
+
};
|
|
20930
20989
|
|
|
20931
20990
|
const getInstanceInfo = async (props) => {
|
|
20932
20991
|
const { instanceId, box } = props;
|
|
@@ -21015,6 +21074,7 @@ const getInstanceInfo = async (props) => {
|
|
|
21015
21074
|
});
|
|
21016
21075
|
|
|
21017
21076
|
const moment = getMoment();
|
|
21077
|
+
const signImageCache = new Map();
|
|
21018
21078
|
return {
|
|
21019
21079
|
box: box,
|
|
21020
21080
|
_id: instanceId,
|
|
@@ -21058,14 +21118,28 @@ const getInstanceInfo = async (props) => {
|
|
|
21058
21118
|
forward_from_instance: instance.forward_from_instance,
|
|
21059
21119
|
cc_users: instance.cc_users,
|
|
21060
21120
|
traces: instance.traces,
|
|
21061
|
-
historyApproves: ___default["default"].map(instance.traces, (trace) => {
|
|
21121
|
+
historyApproves: await Promise.all(___default["default"].map(instance.traces, async (trace) => {
|
|
21062
21122
|
return Object.assign(
|
|
21063
21123
|
{
|
|
21064
|
-
children: ___default["default"].map(trace.approves, (approve) => {
|
|
21124
|
+
children: await Promise.all(___default["default"].map(trace.approves, async (approve) => {
|
|
21065
21125
|
let finishDate = approve.finish_date;
|
|
21066
21126
|
let judge = approve.judge;
|
|
21067
21127
|
let userName = approve.user_name;
|
|
21068
21128
|
let opinion = approve.description;
|
|
21129
|
+
const traceShowSignImage = true;
|
|
21130
|
+
let showSignImage = isNeedToShowSignImage(approve.is_finished, approve.judge, traceShowSignImage);
|
|
21131
|
+
let userSign;
|
|
21132
|
+
if (showSignImage) {
|
|
21133
|
+
if (signImageCache.has(approve.handler)) {
|
|
21134
|
+
userSign = signImageCache.get(approve.handler);
|
|
21135
|
+
} else {
|
|
21136
|
+
userSign = await getSpaceUserSign(instance.space, approve.handler);
|
|
21137
|
+
signImageCache.set(approve.handler, userSign);
|
|
21138
|
+
}
|
|
21139
|
+
if (userSign){
|
|
21140
|
+
userName = `<img class="image-sign" alt="${userName}" src="/api/v6/files/download/cfs.avatars.filerecord/${userSign}" />`;
|
|
21141
|
+
}
|
|
21142
|
+
}
|
|
21069
21143
|
if(approve.type === 'cc'){
|
|
21070
21144
|
userName = `${userName} (传阅)`;
|
|
21071
21145
|
opinion = approve.cc_description;
|
|
@@ -21119,11 +21193,11 @@ const getInstanceInfo = async (props) => {
|
|
|
21119
21193
|
judge: judge,
|
|
21120
21194
|
opinion: opinion,
|
|
21121
21195
|
};
|
|
21122
|
-
}),
|
|
21196
|
+
})),
|
|
21123
21197
|
},
|
|
21124
21198
|
{ name: trace.name, judge: "" }
|
|
21125
21199
|
);
|
|
21126
|
-
}),
|
|
21200
|
+
})),
|
|
21127
21201
|
};
|
|
21128
21202
|
};
|
|
21129
21203
|
|