ydb-components-material 0.1.164 → 0.1.166

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.
@@ -23,6 +23,14 @@ export default function CheckPoint(props) {
23
23
  setContainerHeight = _useState5[1];
24
24
  var imgRef = useRef();
25
25
  var containerRef = useRef();
26
+
27
+ // 获取 PDF 实际渲染宽度:以容器宽度为准,而非视口宽度。
28
+ // 移动端容器通常占满视口(clientWidth 等于视口宽),但 PC 端 CheckPoint 可能嵌在 Dialog 里
29
+ // (如 width=90vw),容器宽度小于视口,若按视口算缩放系数会整体偏大、标注点位错位
30
+ var getRenderWidth = function getRenderWidth() {
31
+ var container = containerRef.current;
32
+ return container && container.clientWidth ? container.clientWidth : document.documentElement.clientWidth;
33
+ };
26
34
  var initData = function initData() {
27
35
  var fileUrl = checkPointData.fileUrl,
28
36
  _checkPointData$annot = checkPointData.annotations,
@@ -36,11 +44,10 @@ export default function CheckPoint(props) {
36
44
  setResultData(annotations.sort(function (a, b) {
37
45
  return a.page - b.page;
38
46
  }));
39
- var clientWidth = document.documentElement.clientWidth;
40
47
  var _annotations$ = annotations[0],
41
48
  scrollWidth = _annotations$.scrollWidth,
42
49
  scrollHeight = _annotations$.scrollHeight;
43
- var scale = clientWidth / scrollWidth;
50
+ var scale = getRenderWidth() / scrollWidth;
44
51
  setPageHeight(scrollHeight * scale);
45
52
  };
46
53
 
@@ -56,11 +63,11 @@ export default function CheckPoint(props) {
56
63
  console.log(width, height, x, y);
57
64
  var img = imgRef.current;
58
65
  console.log(img, 'refs');
59
- var clientWidth = document.documentElement.clientWidth;
60
- console.log('clientWidth-----', clientWidth);
66
+ var renderWidth = getRenderWidth();
67
+ console.log('renderWidth-----', renderWidth);
61
68
 
62
69
  // 算出一个系数,来动态生成下面的边框样式
63
- var scale = clientWidth / scrollWidth;
70
+ var scale = renderWidth / scrollWidth;
64
71
 
65
72
  // console.log('原始宽高', sourceImgWidth, sourceImgHeight);
66
73
  console.log('原始宽高', scrollWidth, scrollHeight);
@@ -605,6 +605,7 @@ var FileItem = function FileItem(_ref) {
605
605
  }
606
606
  valChange(val, fileIndex, index, subIndex);
607
607
  // invalidHandle()
608
+ console.log('needOtherSign-----', needOtherSign);
608
609
  needOtherSign && setShowSignerInfo(true);
609
610
  };
610
611
 
@@ -28,6 +28,14 @@ function CheckPoint(props) {
28
28
  setContainerHeight = _useState5[1];
29
29
  var imgRef = (0, _react.useRef)();
30
30
  var containerRef = (0, _react.useRef)();
31
+
32
+ // 获取 PDF 实际渲染宽度:以容器宽度为准,而非视口宽度。
33
+ // 移动端容器通常占满视口(clientWidth 等于视口宽),但 PC 端 CheckPoint 可能嵌在 Dialog 里
34
+ // (如 width=90vw),容器宽度小于视口,若按视口算缩放系数会整体偏大、标注点位错位
35
+ var getRenderWidth = function getRenderWidth() {
36
+ var container = containerRef.current;
37
+ return container && container.clientWidth ? container.clientWidth : document.documentElement.clientWidth;
38
+ };
31
39
  var initData = function initData() {
32
40
  var fileUrl = checkPointData.fileUrl,
33
41
  _checkPointData$annot = checkPointData.annotations,
@@ -41,11 +49,10 @@ function CheckPoint(props) {
41
49
  setResultData(annotations.sort(function (a, b) {
42
50
  return a.page - b.page;
43
51
  }));
44
- var clientWidth = document.documentElement.clientWidth;
45
52
  var _annotations$ = annotations[0],
46
53
  scrollWidth = _annotations$.scrollWidth,
47
54
  scrollHeight = _annotations$.scrollHeight;
48
- var scale = clientWidth / scrollWidth;
55
+ var scale = getRenderWidth() / scrollWidth;
49
56
  setPageHeight(scrollHeight * scale);
50
57
  };
51
58
 
@@ -61,11 +68,11 @@ function CheckPoint(props) {
61
68
  console.log(width, height, x, y);
62
69
  var img = imgRef.current;
63
70
  console.log(img, 'refs');
64
- var clientWidth = document.documentElement.clientWidth;
65
- console.log('clientWidth-----', clientWidth);
71
+ var renderWidth = getRenderWidth();
72
+ console.log('renderWidth-----', renderWidth);
66
73
 
67
74
  // 算出一个系数,来动态生成下面的边框样式
68
- var scale = clientWidth / scrollWidth;
75
+ var scale = renderWidth / scrollWidth;
69
76
 
70
77
  // console.log('原始宽高', sourceImgWidth, sourceImgHeight);
71
78
  console.log('原始宽高', scrollWidth, scrollHeight);
@@ -611,6 +611,7 @@ var FileItem = function FileItem(_ref) {
611
611
  }
612
612
  valChange(val, fileIndex, index, subIndex);
613
613
  // invalidHandle()
614
+ console.log('needOtherSign-----', needOtherSign);
614
615
  needOtherSign && setShowSignerInfo(true);
615
616
  };
616
617
 
@@ -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.164';
101
+ version = '0.1.166';
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.164';
106
+ version = '0.1.166';
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.164",
3
+ "version": "0.1.166",
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.164/build/lowcode/assets-prod.json"
105
+ "materialSchema": "https://unpkg.com/ydb-components-material@0.1.166/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.164/build/index.html"
110
+ "homepage": "https://unpkg.com/ydb-components-material@0.1.166/build/index.html"
111
111
  }