ydb-components-material 0.1.167 → 0.1.169

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.
@@ -101,14 +101,20 @@ var FileList = function FileList(_ref) {
101
101
  var _useState3 = useState(false),
102
102
  showMerge = _useState3[0],
103
103
  setShowMerge = _useState3[1];
104
- var _useState4 = useState({
104
+ // 签署完成后自动打开维护签署人信息
105
+ // 状态放在 FileList(FileItem 的父级),因为 FileItem 在签章/签批完成后会因 fileId 变化被重新挂载,
106
+ // 局部 state 会丢失。这里记录需要自动弹窗的材料位置,等重挂载后的 FileItem 挂载完成再触发弹窗
107
+ var _useState4 = useState(null),
108
+ needSignerInfo = _useState4[0],
109
+ setNeedSignerInfo = _useState4[1];
110
+ var _useState5 = useState({
105
111
  materialName: '',
106
112
  fileList: [],
107
113
  index: 0,
108
114
  subIndex: 0
109
115
  }),
110
- curMerge = _useState4[0],
111
- setCurMerge = _useState4[1];
116
+ curMerge = _useState5[0],
117
+ setCurMerge = _useState5[1];
112
118
  var convertNumbersToChinese = function convertNumbersToChinese(str) {
113
119
  // 定义基础映射关系
114
120
  var digitMap = {
@@ -245,6 +251,14 @@ var FileList = function FileList(_ref) {
245
251
  setFileArray([].concat(fileArray));
246
252
  };
247
253
 
254
+ // 签署完成后需要自动打开维护签署人信息:记录目标材料位置,等对应 FileItem 挂载后触发弹窗
255
+ var handleNeedSignerInfo = function handleNeedSignerInfo(pos) {
256
+ setNeedSignerInfo(pos);
257
+ };
258
+ var handleCloseSignerInfo = function handleCloseSignerInfo() {
259
+ setNeedSignerInfo(null);
260
+ };
261
+
248
262
  // 如果 文件列表中都是图片,且数量大于1 判断需要合并
249
263
  var judgeNeedMerge = function judgeNeedMerge(files) {
250
264
  console.log('files--------judgeNeedMerge', files);
@@ -354,6 +368,9 @@ var FileList = function FileList(_ref) {
354
368
  parentPageUrl: parentPageUrl,
355
369
  toSign: toSign,
356
370
  saveSignerInfo: saveSignerInfo,
371
+ autoShowSignerInfo: !!(needSignerInfo && needSignerInfo.index === index && needSignerInfo.subIndex === subIndex && needSignerInfo.fileIndex === i),
372
+ onNeedSignerInfo: handleNeedSignerInfo,
373
+ onCloseSignerInfo: handleCloseSignerInfo,
357
374
  style: {
358
375
  marginBottom: '12px'
359
376
  }
@@ -389,6 +406,9 @@ var FileList = function FileList(_ref) {
389
406
  closeLoading: closeLoading,
390
407
  parentPageUrl: parentPageUrl,
391
408
  saveSignerInfo: saveSignerInfo,
409
+ autoShowSignerInfo: !!(needSignerInfo && needSignerInfo.index === index && needSignerInfo.fileIndex === i),
410
+ onNeedSignerInfo: handleNeedSignerInfo,
411
+ onCloseSignerInfo: handleCloseSignerInfo,
392
412
  style: {
393
413
  marginBottom: '12px'
394
414
  }
@@ -29,6 +29,13 @@ export interface FileItemProps {
29
29
  download: (value: any) => void;
30
30
  saveSignerInfo: (value: any) => Promise<boolean>;
31
31
  signInfoMap?: object;
32
+ autoShowSignerInfo?: boolean;
33
+ onNeedSignerInfo?: (pos: {
34
+ index: number;
35
+ subIndex?: number;
36
+ fileIndex: number;
37
+ }) => void;
38
+ onCloseSignerInfo?: () => void;
32
39
  }
33
40
  declare const FileItem: React.FC<FileItemProps>;
34
41
  export default FileItem;
@@ -55,7 +55,10 @@ var FileItem = function FileItem(_ref) {
55
55
  signInfoMap = _ref.signInfoMap,
56
56
  applySeal = _ref.applySeal,
57
57
  parentPageUrl = _ref.parentPageUrl,
58
- toSign = _ref.toSign;
58
+ toSign = _ref.toSign,
59
+ autoShowSignerInfo = _ref.autoShowSignerInfo,
60
+ onNeedSignerInfo = _ref.onNeedSignerInfo,
61
+ onCloseSignerInfo = _ref.onCloseSignerInfo;
59
62
  console.log('fileItem', file, maxFileSize);
60
63
  var fileName = file.fileName,
61
64
  fileUrl = file.fileUrl,
@@ -116,7 +119,7 @@ var FileItem = function FileItem(_ref) {
116
119
  // 本人 → signatureSelfRole/signSelfRole 含 OTHER
117
120
  var signBtnOtherSign = Object.keys(signerInfo).length ? safeSignatureAgentRole.includes(OTHER) || safeSignAgentRole.includes(OTHER) : safeSignatureSelfRole.includes(OTHER) || safeSignSelfRole.includes(OTHER);
118
121
  setSignBtnText(signBtnOtherSign ? '联合签署' : '签署文件');
119
- setReSignBtnText(signBtnOtherSign ? '重新联合签署' : '重新签署');
122
+ setReSignBtnText(signBtnOtherSign ? '重新签署' : '重新签署');
120
123
  }, [signatureSelfRole, signatureAgentRole, signSelfRole, signAgentRole, signerInfo]);
121
124
 
122
125
  // 是否展示签署按钮
@@ -611,7 +614,14 @@ var FileItem = function FileItem(_ref) {
611
614
  // 轮询回调是旧闭包,这里读 ref 拿最新值,避免读到挂载时的初始 false
612
615
  var needOther = needOtherSignRef.current;
613
616
  console.log('needOtherSign-----', needOther);
614
- needOther && setShowSignerInfo(true);
617
+ if (needOther) {
618
+ // 弹窗状态放到父级 FileList 控制,避免 FileItem 因 fileId 变化重挂载导致弹窗状态丢失
619
+ onNeedSignerInfo && onNeedSignerInfo({
620
+ index: index,
621
+ subIndex: subIndex,
622
+ fileIndex: fileIndex
623
+ });
624
+ }
615
625
  };
616
626
 
617
627
  // 获取签章结果
@@ -628,7 +638,13 @@ var FileItem = function FileItem(_ref) {
628
638
  }
629
639
  valChange(val, fileIndex, index, subIndex);
630
640
  // invalidHandle()
631
- needOtherSignRef.current && setShowSignerInfo(true);
641
+ if (needOtherSignRef.current) {
642
+ onNeedSignerInfo && onNeedSignerInfo({
643
+ index: index,
644
+ subIndex: subIndex,
645
+ fileIndex: fileIndex
646
+ });
647
+ }
632
648
  }
633
649
  };
634
650
  var queryFileLibs = function queryFileLibs() {
@@ -933,6 +949,15 @@ var FileItem = function FileItem(_ref) {
933
949
  });
934
950
  }
935
951
  }, [fileId]);
952
+
953
+ // 父级 FileList 通知:本组件(重挂载后)需要自动打开维护签署人信息
954
+ // 打开后立即回调清除标记,避免下次切换材料位置时误弹
955
+ useEffect(function () {
956
+ if (autoShowSignerInfo) {
957
+ setShowSignerInfo(true);
958
+ onCloseSignerInfo && onCloseSignerInfo();
959
+ }
960
+ }, [autoShowSignerInfo, onCloseSignerInfo]);
936
961
  useEffect(function () {
937
962
  try {
938
963
  var stored = localStorage.getItem(fileId);
@@ -1241,7 +1266,8 @@ var FileItem = function FileItem(_ref) {
1241
1266
  }), showSignerInfo && /*#__PURE__*/React.createElement(SignerInfo, {
1242
1267
  signerInfo: signerInfo,
1243
1268
  handleClose: function handleClose() {
1244
- return setShowSignerInfo(false);
1269
+ setShowSignerInfo(false);
1270
+ onCloseSignerInfo && onCloseSignerInfo();
1245
1271
  },
1246
1272
  saveSignerInfo: saveSignerInfo,
1247
1273
  signatureEnable: signatureEnable,
@@ -107,14 +107,20 @@ var FileList = function FileList(_ref) {
107
107
  var _useState3 = (0, _react.useState)(false),
108
108
  showMerge = _useState3[0],
109
109
  setShowMerge = _useState3[1];
110
- var _useState4 = (0, _react.useState)({
110
+ // 签署完成后自动打开维护签署人信息
111
+ // 状态放在 FileList(FileItem 的父级),因为 FileItem 在签章/签批完成后会因 fileId 变化被重新挂载,
112
+ // 局部 state 会丢失。这里记录需要自动弹窗的材料位置,等重挂载后的 FileItem 挂载完成再触发弹窗
113
+ var _useState4 = (0, _react.useState)(null),
114
+ needSignerInfo = _useState4[0],
115
+ setNeedSignerInfo = _useState4[1];
116
+ var _useState5 = (0, _react.useState)({
111
117
  materialName: '',
112
118
  fileList: [],
113
119
  index: 0,
114
120
  subIndex: 0
115
121
  }),
116
- curMerge = _useState4[0],
117
- setCurMerge = _useState4[1];
122
+ curMerge = _useState5[0],
123
+ setCurMerge = _useState5[1];
118
124
  var convertNumbersToChinese = function convertNumbersToChinese(str) {
119
125
  // 定义基础映射关系
120
126
  var digitMap = {
@@ -251,6 +257,14 @@ var FileList = function FileList(_ref) {
251
257
  setFileArray([].concat(fileArray));
252
258
  };
253
259
 
260
+ // 签署完成后需要自动打开维护签署人信息:记录目标材料位置,等对应 FileItem 挂载后触发弹窗
261
+ var handleNeedSignerInfo = function handleNeedSignerInfo(pos) {
262
+ setNeedSignerInfo(pos);
263
+ };
264
+ var handleCloseSignerInfo = function handleCloseSignerInfo() {
265
+ setNeedSignerInfo(null);
266
+ };
267
+
254
268
  // 如果 文件列表中都是图片,且数量大于1 判断需要合并
255
269
  var judgeNeedMerge = function judgeNeedMerge(files) {
256
270
  console.log('files--------judgeNeedMerge', files);
@@ -360,6 +374,9 @@ var FileList = function FileList(_ref) {
360
374
  parentPageUrl: parentPageUrl,
361
375
  toSign: toSign,
362
376
  saveSignerInfo: saveSignerInfo,
377
+ autoShowSignerInfo: !!(needSignerInfo && needSignerInfo.index === index && needSignerInfo.subIndex === subIndex && needSignerInfo.fileIndex === i),
378
+ onNeedSignerInfo: handleNeedSignerInfo,
379
+ onCloseSignerInfo: handleCloseSignerInfo,
363
380
  style: {
364
381
  marginBottom: '12px'
365
382
  }
@@ -395,6 +412,9 @@ var FileList = function FileList(_ref) {
395
412
  closeLoading: closeLoading,
396
413
  parentPageUrl: parentPageUrl,
397
414
  saveSignerInfo: saveSignerInfo,
415
+ autoShowSignerInfo: !!(needSignerInfo && needSignerInfo.index === index && needSignerInfo.fileIndex === i),
416
+ onNeedSignerInfo: handleNeedSignerInfo,
417
+ onCloseSignerInfo: handleCloseSignerInfo,
398
418
  style: {
399
419
  marginBottom: '12px'
400
420
  }
@@ -29,6 +29,13 @@ export interface FileItemProps {
29
29
  download: (value: any) => void;
30
30
  saveSignerInfo: (value: any) => Promise<boolean>;
31
31
  signInfoMap?: object;
32
+ autoShowSignerInfo?: boolean;
33
+ onNeedSignerInfo?: (pos: {
34
+ index: number;
35
+ subIndex?: number;
36
+ fileIndex: number;
37
+ }) => void;
38
+ onCloseSignerInfo?: () => void;
32
39
  }
33
40
  declare const FileItem: React.FC<FileItemProps>;
34
41
  export default FileItem;
@@ -61,7 +61,10 @@ var FileItem = function FileItem(_ref) {
61
61
  signInfoMap = _ref.signInfoMap,
62
62
  applySeal = _ref.applySeal,
63
63
  parentPageUrl = _ref.parentPageUrl,
64
- toSign = _ref.toSign;
64
+ toSign = _ref.toSign,
65
+ autoShowSignerInfo = _ref.autoShowSignerInfo,
66
+ onNeedSignerInfo = _ref.onNeedSignerInfo,
67
+ onCloseSignerInfo = _ref.onCloseSignerInfo;
65
68
  console.log('fileItem', file, maxFileSize);
66
69
  var fileName = file.fileName,
67
70
  fileUrl = file.fileUrl,
@@ -122,7 +125,7 @@ var FileItem = function FileItem(_ref) {
122
125
  // 本人 → signatureSelfRole/signSelfRole 含 OTHER
123
126
  var signBtnOtherSign = Object.keys(signerInfo).length ? safeSignatureAgentRole.includes(OTHER) || safeSignAgentRole.includes(OTHER) : safeSignatureSelfRole.includes(OTHER) || safeSignSelfRole.includes(OTHER);
124
127
  setSignBtnText(signBtnOtherSign ? '联合签署' : '签署文件');
125
- setReSignBtnText(signBtnOtherSign ? '重新联合签署' : '重新签署');
128
+ setReSignBtnText(signBtnOtherSign ? '重新签署' : '重新签署');
126
129
  }, [signatureSelfRole, signatureAgentRole, signSelfRole, signAgentRole, signerInfo]);
127
130
 
128
131
  // 是否展示签署按钮
@@ -617,7 +620,14 @@ var FileItem = function FileItem(_ref) {
617
620
  // 轮询回调是旧闭包,这里读 ref 拿最新值,避免读到挂载时的初始 false
618
621
  var needOther = needOtherSignRef.current;
619
622
  console.log('needOtherSign-----', needOther);
620
- needOther && setShowSignerInfo(true);
623
+ if (needOther) {
624
+ // 弹窗状态放到父级 FileList 控制,避免 FileItem 因 fileId 变化重挂载导致弹窗状态丢失
625
+ onNeedSignerInfo && onNeedSignerInfo({
626
+ index: index,
627
+ subIndex: subIndex,
628
+ fileIndex: fileIndex
629
+ });
630
+ }
621
631
  };
622
632
 
623
633
  // 获取签章结果
@@ -634,7 +644,13 @@ var FileItem = function FileItem(_ref) {
634
644
  }
635
645
  valChange(val, fileIndex, index, subIndex);
636
646
  // invalidHandle()
637
- needOtherSignRef.current && setShowSignerInfo(true);
647
+ if (needOtherSignRef.current) {
648
+ onNeedSignerInfo && onNeedSignerInfo({
649
+ index: index,
650
+ subIndex: subIndex,
651
+ fileIndex: fileIndex
652
+ });
653
+ }
638
654
  }
639
655
  };
640
656
  var queryFileLibs = function queryFileLibs() {
@@ -939,6 +955,15 @@ var FileItem = function FileItem(_ref) {
939
955
  });
940
956
  }
941
957
  }, [fileId]);
958
+
959
+ // 父级 FileList 通知:本组件(重挂载后)需要自动打开维护签署人信息
960
+ // 打开后立即回调清除标记,避免下次切换材料位置时误弹
961
+ (0, _react.useEffect)(function () {
962
+ if (autoShowSignerInfo) {
963
+ setShowSignerInfo(true);
964
+ onCloseSignerInfo && onCloseSignerInfo();
965
+ }
966
+ }, [autoShowSignerInfo, onCloseSignerInfo]);
942
967
  (0, _react.useEffect)(function () {
943
968
  try {
944
969
  var stored = localStorage.getItem(fileId);
@@ -1247,7 +1272,8 @@ var FileItem = function FileItem(_ref) {
1247
1272
  }), showSignerInfo && /*#__PURE__*/_react["default"].createElement(_signerInfo["default"], {
1248
1273
  signerInfo: signerInfo,
1249
1274
  handleClose: function handleClose() {
1250
- return setShowSignerInfo(false);
1275
+ setShowSignerInfo(false);
1276
+ onCloseSignerInfo && onCloseSignerInfo();
1251
1277
  },
1252
1278
  saveSignerInfo: saveSignerInfo,
1253
1279
  signatureEnable: signatureEnable,
@@ -98,7 +98,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
98
98
  packageName = 'ydb-components-material';
99
99
  }
100
100
  if (version === void 0) {
101
- version = '0.1.167';
101
+ version = '0.1.169';
102
102
  }
103
103
  if (basicLibraryVersion === void 0) {
104
104
  basicLibraryVersion = {
@@ -103,7 +103,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
103
103
  packageName = 'ydb-components-material';
104
104
  }
105
105
  if (version === void 0) {
106
- version = '0.1.167';
106
+ version = '0.1.169';
107
107
  }
108
108
  if (basicLibraryVersion === void 0) {
109
109
  basicLibraryVersion = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-components-material",
3
- "version": "0.1.167",
3
+ "version": "0.1.169",
4
4
  "description": "ydb-components-material",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -102,10 +102,10 @@
102
102
  },
103
103
  "componentConfig": {
104
104
  "isComponentLibrary": true,
105
- "materialSchema": "https://unpkg.com/ydb-components-material@0.1.167/build/lowcode/assets-prod.json"
105
+ "materialSchema": "https://unpkg.com/ydb-components-material@0.1.169/build/lowcode/assets-prod.json"
106
106
  },
107
107
  "lcMeta": {
108
108
  "type": "component"
109
109
  },
110
- "homepage": "https://unpkg.com/ydb-components-material@0.1.167/build/index.html"
110
+ "homepage": "https://unpkg.com/ydb-components-material@0.1.169/build/index.html"
111
111
  }