@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/index.esm.js CHANGED
@@ -19326,23 +19326,23 @@ const getApprovalDrawerSchema = async (instance, submitEvents) => {
19326
19326
  // }
19327
19327
  // ]
19328
19328
  // },
19329
- validateError: {
19330
- weight: 0,
19331
- actions: [
19332
- {
19333
- "componentId": "",
19334
- "args": {
19335
- "msgType": "info",
19336
- "position": "top-right",
19337
- "closeButton": true,
19338
- "showIcon": true,
19339
- "title": i18next$1.t('frontend_workflow_submit_validate_error_title'),//"提交失败",
19340
- "msg": i18next$1.t('frontend_workflow_submit_validate_error_msg'),//"请填写必填字段"
19341
- },
19342
- "actionType": "toast"
19343
- }
19344
- ],
19345
- }
19329
+ // validateError: {
19330
+ // weight: 0,
19331
+ // actions: [
19332
+ // {
19333
+ // "componentId": "",
19334
+ // "args": {
19335
+ // "msgType": "info",
19336
+ // "position": "top-right",
19337
+ // "closeButton": true,
19338
+ // "showIcon": true,
19339
+ // "title": i18next.t('frontend_workflow_submit_validate_error_title'),//"提交失败",
19340
+ // "msg": i18next.t('frontend_workflow_submit_validate_error_msg'),//"请填写必填字段"
19341
+ // },
19342
+ // "actionType": "toast"
19343
+ // }
19344
+ // ],
19345
+ // }
19346
19346
  },
19347
19347
 
19348
19348
  },
@@ -19577,7 +19577,7 @@ const getRelatedInstances = async (instance)=>{
19577
19577
  * @Author: baozhoutao@steedos.com
19578
19578
  * @Date: 2022-09-24 16:48:28
19579
19579
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
19580
- * @LastEditTime: 2025-08-28 01:38:39
19580
+ * @LastEditTime: 2025-11-03 11:16:43
19581
19581
  * @Description:
19582
19582
  */
19583
19583
 
@@ -19601,19 +19601,19 @@ const getInstanceApprovalHistory = async ()=>{
19601
19601
  "name": "user_name",
19602
19602
  "label": "user_name",
19603
19603
  "type": "tpl",
19604
- "tpl": "<div><div>${opinion}</div>${user_name}</div>"
19604
+ "tpl": "<div><div>${opinion}</div>${user_name|raw}</div>"
19605
19605
  },
19606
19606
  {
19607
19607
  "name": "finish_date",
19608
19608
  "label": "finish_date",
19609
- "classNameExpr": "<%= data.finish_date == i18next.t('frontend_workflow_approval_history_read') ? 'text-[blue]' : (data.finish_date == i18next.t('frontend_workflow_approval_history_unprocessed') ? 'text-[red]' : '') %>"
19609
+ "classNameExpr": `<%= data.finish_date == '${i18next$1.t('frontend_workflow_approval_history_read')}' ? 'text-[blue]' : (data.finish_date == '${i18next$1.t('frontend_workflow_approval_history_unprocessed')}' ? 'text-[red]' : '') %>`
19610
19610
  // "type": "datetime",
19611
19611
  // "format": "YYYY-MM-DD HH:mm"
19612
19612
  },
19613
19613
  {
19614
19614
  "name": "judge",
19615
19615
  "label": "judge",
19616
- "classNameExpr": "<%= data.judge == i18next.t('frontend_workflow_approval_judge_approved') ? 'text-green-600' : (data.judge == i18next.t('frontend_workflow_approval_judge_rejected') ? 'text-[red]' : '') %>"
19616
+ "classNameExpr": `<%= data.judge == '${i18next$1.t('frontend_workflow_approval_judge_approved')}' ? 'text-green-600' : (data.judge == '${i18next$1.t('frontend_workflow_approval_judge_rejected')}' ? 'text-[red]' : '') %>`
19617
19617
  }
19618
19618
  ]
19619
19619
  }
@@ -19623,7 +19623,7 @@ const getInstanceApprovalHistory = async ()=>{
19623
19623
  * @Author: baozhoutao@steedos.com
19624
19624
  * @Date: 2022-09-07 16:20:45
19625
19625
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
19626
- * @LastEditTime: 2025-09-08 14:35:29
19626
+ * @LastEditTime: 2025-10-30 13:40:31
19627
19627
  * @Description:
19628
19628
  */
19629
19629
 
@@ -20453,11 +20453,54 @@ const getApproveButton = async (instance, submitEvents)=>{
20453
20453
  },
20454
20454
  id: "steedos-approve-button",
20455
20455
  level: "primary",
20456
- className:
20457
- "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",
20456
+ className: {
20457
+ "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,
20458
+ "hidden": instance.box === 'draft'
20459
+ }
20458
20460
  }
20459
20461
  };
20460
20462
 
20463
+ const getScrollToBottomAutoOpenApproveDrawerScript = () => {
20464
+ return `
20465
+ (function () {
20466
+ setTimeout(function () {
20467
+ var bodyEl = document.querySelector('.steedos-amis-instance-view-body');
20468
+ if (!bodyEl) return;
20469
+ var btn = document.querySelector('.approve-button');
20470
+ if (!btn) return;
20471
+
20472
+ var lastAtBottom = false; // 上一个scroll事件是否到底
20473
+
20474
+ function isAtBottom() {
20475
+ var scrollTop = bodyEl.scrollTop,
20476
+ scrollHeight = bodyEl.scrollHeight,
20477
+ clientHeight = bodyEl.clientHeight;
20478
+ return (scrollHeight <= clientHeight) || (scrollTop + clientHeight >= scrollHeight - 2);
20479
+ }
20480
+
20481
+ // wheel: 只要现在到底、且是向下滚,即可弹出
20482
+ bodyEl.addEventListener('wheel', function (e) {
20483
+ var atBottom = isAtBottom();
20484
+ if (atBottom && e.deltaY > 0) {
20485
+ // [wheel] 拖动条在底部且向下滚,弹drawer
20486
+ btn.click();
20487
+ }
20488
+ });
20489
+
20490
+ // scroll: 拖动时仅“从非底部->底部”瞬间弹
20491
+ bodyEl.addEventListener('scroll', function () {
20492
+ var atBottom = isAtBottom();
20493
+ if (!lastAtBottom && atBottom) {
20494
+ // [scroll] 拖动条到底,弹drawer
20495
+ btn.click();
20496
+ }
20497
+ lastAtBottom = atBottom;
20498
+ });
20499
+ }, 1000);
20500
+ })();
20501
+ `;
20502
+ };
20503
+
20461
20504
  const getFlowFormSchema = async (instance, box) => {
20462
20505
  const formStyle = instance.form.current.style || "table";
20463
20506
  let formContentSchema;
@@ -20480,6 +20523,14 @@ const getFlowFormSchema = async (instance, box) => {
20480
20523
  changeEvents = onEvent?.change.actions || [];
20481
20524
  submitEvents = onEvent?.submit.actions || [];
20482
20525
  }
20526
+ if (box == 'inbox' || box == 'draft') {
20527
+ // 滚动条滚动到底部弹出底部签批drawer窗口
20528
+ initedEvents.push({
20529
+ "actionType": "custom",
20530
+ "script": getScrollToBottomAutoOpenApproveDrawerScript(),
20531
+ "args": {}
20532
+ });
20533
+ }
20483
20534
 
20484
20535
  console.log('getFlowFormSchema formContentSchema', formContentSchema);
20485
20536
  return {
@@ -20561,23 +20612,23 @@ const getFlowFormSchema = async (instance, box) => {
20561
20612
  ],
20562
20613
  id: "instance_form",
20563
20614
  onEvent: {
20564
- validateError: {
20565
- weight: 0,
20566
- actions: [
20567
- {
20568
- "componentId": "",
20569
- "args": {
20570
- "msgType": "info",
20571
- "position": "top-right",
20572
- "closeButton": true,
20573
- "showIcon": true,
20574
- "title": i18next$1.t('frontend_workflow_submit_validate_error_title'),//"提交失败",
20575
- "msg": i18next$1.t('frontend_workflow_submit_validate_error_msg'),//"请填写必填字段"
20576
- },
20577
- "actionType": "toast"
20578
- }
20579
- ],
20580
- },
20615
+ // validateError: {
20616
+ // weight: 0,
20617
+ // actions: [
20618
+ // {
20619
+ // "componentId": "",
20620
+ // "args": {
20621
+ // "msgType": "info",
20622
+ // "position": "top-right",
20623
+ // "closeButton": true,
20624
+ // "showIcon": true,
20625
+ // "title": i18next.t('frontend_workflow_submit_validate_error_title'),//"提交失败",
20626
+ // "msg": i18next.t('frontend_workflow_submit_validate_error_msg'),//"请填写必填字段"
20627
+ // },
20628
+ // "actionType": "toast"
20629
+ // }
20630
+ // ],
20631
+ // },
20581
20632
  change: {
20582
20633
  weight: 0,
20583
20634
  actions: [
@@ -20739,7 +20790,7 @@ const getOpinionFieldStepsName = (field, top_keywords) => {
20739
20790
  * @Author: baozhoutao@steedos.com
20740
20791
  * @Date: 2022-09-09 17:47:37
20741
20792
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
20742
- * @LastEditTime: 2025-09-01 23:33:14
20793
+ * @LastEditTime: 2025-11-03 15:17:50
20743
20794
  * @Description:
20744
20795
  */
20745
20796
 
@@ -20888,6 +20939,26 @@ const isCurrentStepOpinionField = (field, currentStep)=>{
20888
20939
  return ___default.includes(___default.map(getOpinionFieldStepsName(field), 'stepName'), currentStep?.name);
20889
20940
  };
20890
20941
 
20942
+ const isNeedToShowSignImage = (is_finished, judge, traceShowSignImage) => {
20943
+ if (traceShowSignImage === false) {
20944
+ return false;
20945
+ }
20946
+ if (!is_finished) {
20947
+ return false;
20948
+ }
20949
+ if (['returned', 'terminated', 'retrieved'].includes(judge)) {
20950
+ return false;
20951
+ }
20952
+ return true;
20953
+ };
20954
+
20955
+ const getSpaceUserSign = async (space, handler) => {
20956
+ const result = await fetchAPI$1(`/api/v1/space_user_signs?filters=[["space","=","${space}"],["user","=","${handler}"]]&fields=["sign"]`);
20957
+ if (result?.data?.items && result.data.items.length > 0) {
20958
+ return result.data.items[0].sign;
20959
+ }
20960
+ return null;
20961
+ };
20891
20962
 
20892
20963
  const getInstanceInfo = async (props) => {
20893
20964
  const { instanceId, box } = props;
@@ -20976,6 +21047,7 @@ const getInstanceInfo = async (props) => {
20976
21047
  });
20977
21048
 
20978
21049
  const moment = getMoment();
21050
+ const signImageCache = new Map();
20979
21051
  return {
20980
21052
  box: box,
20981
21053
  _id: instanceId,
@@ -21019,14 +21091,28 @@ const getInstanceInfo = async (props) => {
21019
21091
  forward_from_instance: instance.forward_from_instance,
21020
21092
  cc_users: instance.cc_users,
21021
21093
  traces: instance.traces,
21022
- historyApproves: ___default.map(instance.traces, (trace) => {
21094
+ historyApproves: await Promise.all(___default.map(instance.traces, async (trace) => {
21023
21095
  return Object.assign(
21024
21096
  {
21025
- children: ___default.map(trace.approves, (approve) => {
21097
+ children: await Promise.all(___default.map(trace.approves, async (approve) => {
21026
21098
  let finishDate = approve.finish_date;
21027
21099
  let judge = approve.judge;
21028
21100
  let userName = approve.user_name;
21029
21101
  let opinion = approve.description;
21102
+ const traceShowSignImage = true;
21103
+ let showSignImage = isNeedToShowSignImage(approve.is_finished, approve.judge, traceShowSignImage);
21104
+ let userSign;
21105
+ if (showSignImage) {
21106
+ if (signImageCache.has(approve.handler)) {
21107
+ userSign = signImageCache.get(approve.handler);
21108
+ } else {
21109
+ userSign = await getSpaceUserSign(instance.space, approve.handler);
21110
+ signImageCache.set(approve.handler, userSign);
21111
+ }
21112
+ if (userSign){
21113
+ userName = `<img class="image-sign" alt="${userName}" src="/api/v6/files/download/cfs.avatars.filerecord/${userSign}" />`;
21114
+ }
21115
+ }
21030
21116
  if(approve.type === 'cc'){
21031
21117
  userName = `${userName} (传阅)`;
21032
21118
  opinion = approve.cc_description;
@@ -21080,11 +21166,11 @@ const getInstanceInfo = async (props) => {
21080
21166
  judge: judge,
21081
21167
  opinion: opinion,
21082
21168
  };
21083
- }),
21169
+ })),
21084
21170
  },
21085
21171
  { name: trace.name, judge: "" }
21086
21172
  );
21087
- }),
21173
+ })),
21088
21174
  };
21089
21175
  };
21090
21176