@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/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;
@@ -20476,9 +20519,17 @@ const getFlowFormSchema = async (instance, box) => {
20476
20519
 
20477
20520
  if(amisSchemaStr){
20478
20521
  const onEvent = JSON.parse(instance.formVersion.amis_schema).onEvent;
20479
- initedEvents = onEvent.inited.actions || [];
20480
- changeEvents = onEvent.change.actions || [];
20481
- submitEvents = onEvent.submit.actions || [];
20522
+ initedEvents = onEvent?.inited.actions || [];
20523
+ changeEvents = onEvent?.change.actions || [];
20524
+ submitEvents = onEvent?.submit.actions || [];
20525
+ }
20526
+ if (box == 'inbox' || box == 'draft') {
20527
+ // 滚动条滚动到底部弹出底部签批drawer窗口
20528
+ initedEvents.push({
20529
+ "actionType": "custom",
20530
+ "script": getScrollToBottomAutoOpenApproveDrawerScript(),
20531
+ "args": {}
20532
+ });
20482
20533
  }
20483
20534
 
20484
20535
  console.log('getFlowFormSchema formContentSchema', formContentSchema);
@@ -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: [
@@ -20595,7 +20646,7 @@ const getFlowFormSchema = async (instance, box) => {
20595
20646
  await getInstanceApprovalHistory(),
20596
20647
  await getApproveButton(instance, submitEvents)
20597
20648
  ],
20598
- id: "u:63849ea39e12",
20649
+ id: "u:instancePage",
20599
20650
  messages: {},
20600
20651
  pullRefresh: {},
20601
20652
  regions: [
@@ -20606,6 +20657,11 @@ const getFlowFormSchema = async (instance, box) => {
20606
20657
  "@data.@instanceDetail.changed": {
20607
20658
  actions: [
20608
20659
  {
20660
+ actionType: "custom",
20661
+ script:"debugger;",
20662
+ },
20663
+ {
20664
+ componentId:"u:instancePage",
20609
20665
  actionType: "reload"
20610
20666
  }
20611
20667
  ]
@@ -20622,22 +20678,7 @@ const getFlowFormSchema = async (instance, box) => {
20622
20678
  },
20623
20679
  ...initedEvents
20624
20680
  ]
20625
- },
20626
- // inited: {
20627
- // weight: 0,
20628
- // actions: [
20629
- // // {
20630
- // // componentId: "steedos-approve-button",
20631
- // // actionType: "click",
20632
- // // },
20633
- // // {
20634
- // // "componentId": "",
20635
- // // "args": {},
20636
- // // "actionType": "drawer",
20637
- // // "drawer": await getApprovalDrawerSchema()
20638
- // // }
20639
- // ],
20640
- // }
20681
+ }
20641
20682
  },
20642
20683
  initApi:{
20643
20684
  "url": "${context.rootUrl}/graphql",
@@ -20669,8 +20710,6 @@ const getFlowFormSchema = async (instance, box) => {
20669
20710
  return payload;
20670
20711
  `,
20671
20712
  "data": {
20672
- // "&": "$$",
20673
- // "context": "${context}",
20674
20713
  "judge": "${new_judge}",
20675
20714
  }
20676
20715
  },
@@ -20751,7 +20790,7 @@ const getOpinionFieldStepsName = (field, top_keywords) => {
20751
20790
  * @Author: baozhoutao@steedos.com
20752
20791
  * @Date: 2022-09-09 17:47:37
20753
20792
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
20754
- * @LastEditTime: 2025-09-01 23:33:14
20793
+ * @LastEditTime: 2025-11-03 15:17:50
20755
20794
  * @Description:
20756
20795
  */
20757
20796
 
@@ -20900,6 +20939,26 @@ const isCurrentStepOpinionField = (field, currentStep)=>{
20900
20939
  return ___default.includes(___default.map(getOpinionFieldStepsName(field), 'stepName'), currentStep?.name);
20901
20940
  };
20902
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
+ };
20903
20962
 
20904
20963
  const getInstanceInfo = async (props) => {
20905
20964
  const { instanceId, box } = props;
@@ -20988,6 +21047,7 @@ const getInstanceInfo = async (props) => {
20988
21047
  });
20989
21048
 
20990
21049
  const moment = getMoment();
21050
+ const signImageCache = new Map();
20991
21051
  return {
20992
21052
  box: box,
20993
21053
  _id: instanceId,
@@ -21031,14 +21091,28 @@ const getInstanceInfo = async (props) => {
21031
21091
  forward_from_instance: instance.forward_from_instance,
21032
21092
  cc_users: instance.cc_users,
21033
21093
  traces: instance.traces,
21034
- historyApproves: ___default.map(instance.traces, (trace) => {
21094
+ historyApproves: await Promise.all(___default.map(instance.traces, async (trace) => {
21035
21095
  return Object.assign(
21036
21096
  {
21037
- children: ___default.map(trace.approves, (approve) => {
21097
+ children: await Promise.all(___default.map(trace.approves, async (approve) => {
21038
21098
  let finishDate = approve.finish_date;
21039
21099
  let judge = approve.judge;
21040
21100
  let userName = approve.user_name;
21041
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
+ }
21042
21116
  if(approve.type === 'cc'){
21043
21117
  userName = `${userName} (传阅)`;
21044
21118
  opinion = approve.cc_description;
@@ -21092,11 +21166,11 @@ const getInstanceInfo = async (props) => {
21092
21166
  judge: judge,
21093
21167
  opinion: opinion,
21094
21168
  };
21095
- }),
21169
+ })),
21096
21170
  },
21097
21171
  { name: trace.name, judge: "" }
21098
21172
  );
21099
- }),
21173
+ })),
21100
21174
  };
21101
21175
  };
21102
21176