@steedos-widgets/amis-lib 6.10.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 +132 -46
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +132 -46
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +228 -197
- package/dist/index.umd.js.map +1 -1
- package/dist/types/workflow/approve.d.ts +0 -15
- package/dist/types/workflow/flow.d.ts +4 -31
- 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;
|
|
@@ -20507,6 +20550,14 @@ const getFlowFormSchema = async (instance, box) => {
|
|
|
20507
20550
|
changeEvents = onEvent?.change.actions || [];
|
|
20508
20551
|
submitEvents = onEvent?.submit.actions || [];
|
|
20509
20552
|
}
|
|
20553
|
+
if (box == 'inbox' || box == 'draft') {
|
|
20554
|
+
// 滚动条滚动到底部弹出底部签批drawer窗口
|
|
20555
|
+
initedEvents.push({
|
|
20556
|
+
"actionType": "custom",
|
|
20557
|
+
"script": getScrollToBottomAutoOpenApproveDrawerScript(),
|
|
20558
|
+
"args": {}
|
|
20559
|
+
});
|
|
20560
|
+
}
|
|
20510
20561
|
|
|
20511
20562
|
console.log('getFlowFormSchema formContentSchema', formContentSchema);
|
|
20512
20563
|
return {
|
|
@@ -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: [
|
|
@@ -20766,7 +20817,7 @@ const getOpinionFieldStepsName = (field, top_keywords) => {
|
|
|
20766
20817
|
* @Author: baozhoutao@steedos.com
|
|
20767
20818
|
* @Date: 2022-09-09 17:47:37
|
|
20768
20819
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
20769
|
-
* @LastEditTime: 2025-
|
|
20820
|
+
* @LastEditTime: 2025-11-03 15:17:50
|
|
20770
20821
|
* @Description:
|
|
20771
20822
|
*/
|
|
20772
20823
|
|
|
@@ -20915,6 +20966,26 @@ const isCurrentStepOpinionField = (field, currentStep)=>{
|
|
|
20915
20966
|
return ___default["default"].includes(___default["default"].map(getOpinionFieldStepsName(field), 'stepName'), currentStep?.name);
|
|
20916
20967
|
};
|
|
20917
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
|
+
};
|
|
20918
20989
|
|
|
20919
20990
|
const getInstanceInfo = async (props) => {
|
|
20920
20991
|
const { instanceId, box } = props;
|
|
@@ -21003,6 +21074,7 @@ const getInstanceInfo = async (props) => {
|
|
|
21003
21074
|
});
|
|
21004
21075
|
|
|
21005
21076
|
const moment = getMoment();
|
|
21077
|
+
const signImageCache = new Map();
|
|
21006
21078
|
return {
|
|
21007
21079
|
box: box,
|
|
21008
21080
|
_id: instanceId,
|
|
@@ -21046,14 +21118,28 @@ const getInstanceInfo = async (props) => {
|
|
|
21046
21118
|
forward_from_instance: instance.forward_from_instance,
|
|
21047
21119
|
cc_users: instance.cc_users,
|
|
21048
21120
|
traces: instance.traces,
|
|
21049
|
-
historyApproves: ___default["default"].map(instance.traces, (trace) => {
|
|
21121
|
+
historyApproves: await Promise.all(___default["default"].map(instance.traces, async (trace) => {
|
|
21050
21122
|
return Object.assign(
|
|
21051
21123
|
{
|
|
21052
|
-
children: ___default["default"].map(trace.approves, (approve) => {
|
|
21124
|
+
children: await Promise.all(___default["default"].map(trace.approves, async (approve) => {
|
|
21053
21125
|
let finishDate = approve.finish_date;
|
|
21054
21126
|
let judge = approve.judge;
|
|
21055
21127
|
let userName = approve.user_name;
|
|
21056
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
|
+
}
|
|
21057
21143
|
if(approve.type === 'cc'){
|
|
21058
21144
|
userName = `${userName} (传阅)`;
|
|
21059
21145
|
opinion = approve.cc_description;
|
|
@@ -21107,11 +21193,11 @@ const getInstanceInfo = async (props) => {
|
|
|
21107
21193
|
judge: judge,
|
|
21108
21194
|
opinion: opinion,
|
|
21109
21195
|
};
|
|
21110
|
-
}),
|
|
21196
|
+
})),
|
|
21111
21197
|
},
|
|
21112
21198
|
{ name: trace.name, judge: "" }
|
|
21113
21199
|
);
|
|
21114
|
-
}),
|
|
21200
|
+
})),
|
|
21115
21201
|
};
|
|
21116
21202
|
};
|
|
21117
21203
|
|