ydb-components-material 0.1.182 → 0.1.184

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.
@@ -38,6 +38,7 @@ function SignerInfo(props) {
38
38
  showQRcode = _useState[0],
39
39
  setShowQRcode = _useState[1];
40
40
  var canvasRef = useRef(null);
41
+ var qrcodeRef = useRef(null);
41
42
  var _useState2 = useState(''),
42
43
  url = _useState2[0],
43
44
  setUrl = _useState2[1];
@@ -178,6 +179,25 @@ function SignerInfo(props) {
178
179
  });
179
180
  setSignerInfoList(newList);
180
181
  };
182
+
183
+ // 显示复制成功提示,并把它定位到 qrcode 弹窗上方
184
+ var showSuccessAboveQRcode = function showSuccessAboveQRcode() {
185
+ if (isPC && qrcodeRef.current) {
186
+ // 测量 qrcode 弹窗顶部距视口顶部的距离
187
+ var qrcodeTop = qrcodeRef.current.getBoundingClientRect().top;
188
+ // Message toast 的 wrapper 固定定位在视口 top 处,这里把 top 设为 qrcode 上方 20px
189
+ _Message.config({
190
+ top: qrcodeTop - 20
191
+ });
192
+ _Message.success('复制成功');
193
+ // Message.config 是全局单例配置,渲染完成后再恢复默认值,避免影响后续消息的显示位置
194
+ _Message.config({
195
+ top: 8
196
+ });
197
+ } else {
198
+ _Message.success('复制成功');
199
+ }
200
+ };
181
201
  var onCopy = function onCopy() {
182
202
  var _navigator$clipboard;
183
203
  if ((_navigator$clipboard = navigator.clipboard) !== null && _navigator$clipboard !== void 0 && _navigator$clipboard.writeText) {
@@ -192,7 +212,7 @@ function SignerInfo(props) {
192
212
  document.execCommand('copy');
193
213
  document.body.removeChild(textarea);
194
214
  }
195
- _Message.success('复制成功');
215
+ showSuccessAboveQRcode();
196
216
  };
197
217
  useEffect(function () {
198
218
  if (signInfoMap && file) {
@@ -433,7 +453,11 @@ function SignerInfo(props) {
433
453
  className: "next",
434
454
  onClick: next
435
455
  }, "\u4E0B\u4E00\u6B65"))), showQRcode && /*#__PURE__*/React.createElement("div", {
436
- className: "qrcode" + (isPC ? ' qrcode-pc' : '')
456
+ className: "qrcode" + (isPC ? ' qrcode-pc' : ''),
457
+ style: isPC && componentTop ? {
458
+ top: componentTop - 200
459
+ } : undefined,
460
+ ref: qrcodeRef
437
461
  }, /*#__PURE__*/React.createElement("img", {
438
462
  className: "qrcode-close",
439
463
  src: closeIcon,
@@ -44,6 +44,7 @@ function SignerInfo(props) {
44
44
  showQRcode = _useState[0],
45
45
  setShowQRcode = _useState[1];
46
46
  var canvasRef = (0, _react.useRef)(null);
47
+ var qrcodeRef = (0, _react.useRef)(null);
47
48
  var _useState2 = (0, _react.useState)(''),
48
49
  url = _useState2[0],
49
50
  setUrl = _useState2[1];
@@ -184,6 +185,25 @@ function SignerInfo(props) {
184
185
  });
185
186
  setSignerInfoList(newList);
186
187
  };
188
+
189
+ // 显示复制成功提示,并把它定位到 qrcode 弹窗上方
190
+ var showSuccessAboveQRcode = function showSuccessAboveQRcode() {
191
+ if (isPC && qrcodeRef.current) {
192
+ // 测量 qrcode 弹窗顶部距视口顶部的距离
193
+ var qrcodeTop = qrcodeRef.current.getBoundingClientRect().top;
194
+ // Message toast 的 wrapper 固定定位在视口 top 处,这里把 top 设为 qrcode 上方 20px
195
+ _message["default"].config({
196
+ top: qrcodeTop - 20
197
+ });
198
+ _message["default"].success('复制成功');
199
+ // Message.config 是全局单例配置,渲染完成后再恢复默认值,避免影响后续消息的显示位置
200
+ _message["default"].config({
201
+ top: 8
202
+ });
203
+ } else {
204
+ _message["default"].success('复制成功');
205
+ }
206
+ };
187
207
  var onCopy = function onCopy() {
188
208
  var _navigator$clipboard;
189
209
  if ((_navigator$clipboard = navigator.clipboard) !== null && _navigator$clipboard !== void 0 && _navigator$clipboard.writeText) {
@@ -198,7 +218,7 @@ function SignerInfo(props) {
198
218
  document.execCommand('copy');
199
219
  document.body.removeChild(textarea);
200
220
  }
201
- _message["default"].success('复制成功');
221
+ showSuccessAboveQRcode();
202
222
  };
203
223
  (0, _react.useEffect)(function () {
204
224
  if (signInfoMap && file) {
@@ -439,7 +459,11 @@ function SignerInfo(props) {
439
459
  className: "next",
440
460
  onClick: next
441
461
  }, "\u4E0B\u4E00\u6B65"))), showQRcode && /*#__PURE__*/_react["default"].createElement("div", {
442
- className: "qrcode" + (isPC ? ' qrcode-pc' : '')
462
+ className: "qrcode" + (isPC ? ' qrcode-pc' : ''),
463
+ style: isPC && componentTop ? {
464
+ top: componentTop - 200
465
+ } : undefined,
466
+ ref: qrcodeRef
443
467
  }, /*#__PURE__*/_react["default"].createElement("img", {
444
468
  className: "qrcode-close",
445
469
  src: _close_black["default"],
@@ -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.182';
101
+ version = '0.1.184';
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.182';
106
+ version = '0.1.184';
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.182",
3
+ "version": "0.1.184",
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.182/build/lowcode/assets-prod.json"
105
+ "materialSchema": "https://unpkg.com/ydb-components-material@0.1.184/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.182/build/index.html"
110
+ "homepage": "https://unpkg.com/ydb-components-material@0.1.184/build/index.html"
111
111
  }